Problem with the organisation of classes

Dec 8, 2010 at 12:03 AM

Hello

I am doing some tests and modifications based off the "simple sample" project.

But I'm a problem with how the whole display system works.

At startup, there is a class inherited from "Game" that is only used to instanciate the different samples like :

Demo1Screen demo = new Demo1Screen();

These classes themselves are inherited from a "GameScreen" which is in charge of the display yet isn't properly a "Game" object.

So my questions:

- is it normal/good that there are several objects in charge of drawing ? (the main game calls gamescreen)

- how am I supposed to draw sprites and other objects on the screen, should I draw them using the main original "game" class or should I do this inside the "Demo1Screen" class? If the second one, how?

Thanks for replying

Coordinator
Dec 10, 2010 at 12:31 AM

1. At the moment the samples are "optimized" to be a showcase of how to use FPE 3. I've updated the samples to be a little more generic in FPE 3.2 so everyone can use the structure in their game. To answer your question: You should have a screen manager that is in charge of drawing your game screens. In the SimpleSamples, a ScreenManager object is created and added to the game components, e.i. it gets automatically updated by the game.

2. You use the SpriteBatch to draw textures on the screen. We are a physics engine and don't really fiddle with drawing, so I recommend you ask on the XNA forum or search for a tutorial on how to use the SpriteBatch class.