Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Title Screens

This topic is 5220 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, this has got to be my 10th topic helping me along with my game and I must thank you guys so much for all the help. I just finished my level-progressing functions (a good 200-400 lines as a matter of fact) and now I need to make up a title screen. My problem is that I''m not exactly sure how to do it. The game starts and the title screen appears where you set the difficulty and then choose to start the game. But now...I have a function called InitGame() that set''s up all the sdl stuff and items needed for the first level. It looks like this:
int CGame::InitGame()
	// Set the game variables first

	m_GameOver  = 0;			// Game isn''t over

	m_GamePause = 0;			// Game isn''t paused

	m_Scroll    = 0;			// The scrolling background''s position

	m_LevelImage = true;

	// Initialize SDL

    printf("Unable to init SDL: %s\n", SDL_GetError());

	// Now set up the Video

  if (g_GameScreen == NULL)
    printf("Unable to set 640x480 video: %s\n", SDL_GetError());

	// Initialize the key input

	m_Keys = SDL_GetKeyState(NULL);
	// Load the font(s) and initialize it/them

	g_Font.m_FontStruct = g_Font.initFont("data/font3");

	// Set the random number seed


	// Say goodbye to the cursor


	// Load the level data and start on level 1


	return 1;		// Return 1 or true if everything went well

I guess instead of loading the levels I could make a title screen function and do that...hell...I''m answering my own question as I write this. Long question short, what''s the best way to do a title screen?
VG-Force | Ekim Gram Productions

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
A function is only supposed to do one thing. The init function should just do that. Then when it returns that init went well then call a menu function that does your menu stuff. Then call the game function. That way you can set game variables before you start the game.

Share this post

Link to post
Share on other sites
"best" is a subjective term..but using a state manager is a nice way. Clicky to get you started.


Statisticly seen, most things happens to other people.

[edited by - Luctus on April 3, 2004 12:34:24 PM]

Share this post

Link to post
Share on other sites
Well, get rid of the Level.x calls and replace them with calls to load your menu. Then when the user presses the "Go" button, then call the level.load() stuff.

Not sure if that really answers anything though...

Walter O. Krawec

Share this post

Link to post
Share on other sites
My TBS game has several "screen types" where each type is actually a ParaGUI (library) widget the size of the screen which i place other objects under.

But I have a class called RenderMan and i call RenderMan->ChangeScreens( screen_type s ) when it''s time to switch. And of course, there are several flavors of screen_type including:


or whatever else you need. Each screen type is it''s own class, so i just let each class worry about what kind of info actually goes on it.

However, that''s for my game where rendering and logic have been largely decoupled.

Share this post

Link to post
Share on other sites
I haven''t read all your post but heres some ideas...

A Title Screen is a current state of play, that is, like an introduction to the game it shouldn''t process data structures or whatnot but display an image and wait for an action (or whatever you want it to do).

Anyhow heres some code...

if(game_state == GAME_TITLE_SCR)

game_state = GAME_MENU;

Basically, I like to use state transition models, when game_state transists to GAME_MENU the program would decide what the user wants to do, i.e New Game, Load Game, Settings etc.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!