• Advertisement
Sign in to follow this  

splash screen

This topic is 1909 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

I am making a pong game using dx9 and c++.I want to implement a simple splash screen that gives instructions on how to play the game. I am perplexed as to how to start this section of the game.

Share this post


Link to post
Share on other sites
Advertisement
Well, have an enum that keeps the gamestate:

enum GameState
{
InSplashScreen,
InMainMenu,
Playing,
InGameOver,
Exiting
};

Then, create a gamestate and when they start the game set it equal to InSplashScreen. Have an if statement inside your game loop:

if (MyGameState == InSplashScreen)
{
//render splashscreen
//check for the input you need to get out of the splash screen
//if ^ the input is true, set MyGameState to Playing
}

else if (MyGameState == Playing)
{
//Logic
//Render
}


There is a lot of ways to do it. Look into state machines (Great Article in C++, Even though he uses SDL his techniques can be applied to all games)
I hope I helped you. If you have any questions ask away :)!

Share this post


Link to post
Share on other sites
cool I have been doing some research and might use something like WM_CREATE or WM_TIMER windows messages. I have some books on win32.I will look up state machines.

Share this post


Link to post
Share on other sites
For Timers the same basic principle applies, however instead of checking for input every loop just check to see if the timer is up. Edited by superman3275

Share this post


Link to post
Share on other sites
Yes, I believe you are. Really however, making a working system is on the right track. You'll improve your code with every project and I see no point in trying to make a completely "proper" (By someone else's standards) State Machine or Splash Screen manager if you won't even use it. Feel free to message me your Splash Screen / State Machine code if you want and I'll (try to) reply tomorrow and give you some tips learned through development. Edited by superman3275

Share this post


Link to post
Share on other sites
I have this much code so far, I am still stuck on the understanding the function of the WM_TIMER windows message. case WM_CREATE:
SetTimer (hWnd,ID_TIMER,5000,NULL);
return 0;
case WM_TIMER:
MessageBeep(5000);
return 0;

case WM_DESTROY:
KillTimer(hWnd,ID_TIMER);
Cleanup();
PostQuitMessage(0);
return 0;
break;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement