Screen control

I am working on a screen manager for a miniature game engine, and so far I can’t find the right solution for managing screen objects without using a “blob” for each of the screens. Is blob valid in circumstances where I need a list of rendered objects in one controller?

+3
source share
2 answers

I would consider using the MVC pattern in this situation. Otherwise, if you are not careful, it is very easy to get a bunch of spaghetti code, where the screen code reaches the game code, and vice versa.

+1
source

I recently encoded something that you might call a "screen manager."

, , , , ( ). , , - , , ( , .. , ... ..).

, " " , , , ( , , , .. ).

singleton GraphicsSystem, :

GameState gs;
Graphics::System().Init(DOUBLE_BUFFER, 640, 480);
...
while(still_looping) {
    ...
    // When it is time to render:
    Graphics::System().RenderGameState(&gs);
}

, , Graphics:: System() singleton , ? , , ...

//within GraphicsSystem.h...
class BaseRenderer
{
public:
    virtual void Render(BITMAP *render_surface) = 0;
};

//GameState defined with:
class GameState : public BaseRenderer
{
public:
    void Render(BITMAP *render_surface);
    ...

... (, , ).

? , ++, , 1 . , . , ( C ).

. . , .

, , , .

+1

All Articles