Title Screen

Started by
2 comments, last by Bezzant 23 years, 3 months ago
Hi, Im making a game, nothing special because Its the first game I started making but will be my 4 game made. Well I want to make a title screen before gameplay begins. I have an idea: My game screen is like this: ... DrawGLGame(); ... ... // draw everything ... DrawGLTitle(); ... ... // draw title ... Well when you load the DrawGLGame in the WinMain part I load DrawGLTitle(); instead. Well I want so if they press say ''B'' it loads DrawGLGame(); So my key control looks like this: if(keys[66]) { DrawGLGame(); } This works fine but you need to hold in the ''B'' key for it to display the game screen. I understand why, BUT cant figure out a way so you don''t have to hold ''B'' What a few of you kindly help, Many Thanks Alan IF YA SMELL... WHAT THE BEZZ IS COOKIN''''
Advertisement
One method would be to set a flag

bool gamerunning = false;

Then in your loop

if(keys[66])
gamerunning = true;

if (gamerunning)
DrawGLGame();
else
DrawGLTitle();


You could also have an int holding the game state and call the appropriate function from the value of int.

Many Thanks TwoFlower. It works like a charm, I can now continue with the rest of the game.

One more question, about displaying text, I have done it before I build the font, print, and kill it but when I try to display it I set the rasterpos and give it a color have it all set as I have with other demo''s/games but with this one It won''t display the text. Any ideas on the possile cause of this problem?

Many Thanks For The Help

Alan

IF YA SMELL... WHAT THE BEZZ IS COOKIN''''

at first ensure that you enable GL_TEXTURE_2D before printing the text, because otherwise it won''t work!



This topic is closed to new replies.

Advertisement