Sign in to follow this  
SleepySlowpoke

The requirements and aspects of creating a Game Manager/Screen Manager class file

Recommended Posts

SleepySlowpoke    112

I made this thread to ask exactly what and how to make a class file for a game that controls all of the different screens and events. I'm still somewhat new to programming and game making so I've been watching a few game making tutorials in C++ but all they do is tell you EXACTLY how to put the code in without exactly teaching you what it does and how it works, that's a problem as I don't want to just make a game by copying someone else's exact code, I'd rather then just get his/her source code for his/her game engine. I wish to learn what all the processes in the code are doing or at least the basics.

 

I wish to make a 2D Platformer using SFML as my API if that helps at all.

Share this post


Link to post
Share on other sites
wintertime    4108

I'm sure pretty soon someone will jump in to tell you how to make your overengineered GameStateManager class that depends on a StateMachine class, but that is all just fluff.

You could simply make a short function to call a different function with its own gameloop to input/update/draw any of the screens, these return some value that tells you which screen is next. Or place a switch statement into the gameloop, save the return value from one of the functions (that are this time just handling a single frame for one of the screens) in a variable and use it next frame.

Share this post


Link to post
Share on other sites
ByteTroll    3035
Hey Sleepy,

From what you describe you are looking for a game state system. A screen manager tends to be something different (depending on who you ask). Anyways, you will usually want a class that represents a game state. This includes routines like update, draw, etc. You will also want a class that manages the states. A common implementation uses a vector of game state objects and has routines for adding, removing, starting game states, etc. You would then inherit from the base game state class and implement the actual states -- play, menu, pause, etc.

Here is an example:
http://gamedevgeek.com/tutorials/managing-game-states-in-c/

@EDIT - Winter is also correct - there are several ways to go about this subject.

Posted from my iPhone 5

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this