Well to get some better understanding of the whole game logic I recommend looking at an existing minigame.
I also recommend the following games for this purpose:
SpaceInvaders, as it is a pretty simple game, so it should be easy to understand the basics
TestYourSight, as I added quite a lot comments, so it should be easy to track what is going on
You can also just take one of these cames, duplicate it and replace the function implementations with your ones to get a working framework.
Basically:
- Name your class StateYOURGAMENAME, also name your source files like that
- Make it a child class of mgBaseState
- All of the following functions will get called automatically by the game engine, so you only have to fill them with the correct content
init - all game initialization goes here, like loading images, sounds, etc.
render - render your sprites here
update - do all the game logic here (advance counters, etc)
userInput - handle user input here
pauseScreen - render the pause screen here (show instructions, etc.)
onpause / onresume - stop/start counters here, so they don't continue running while the pause screen is shown
For help on classes you can check the manual, but it is WIP, so only a few have been added yet:
http://projectinfini...senjin:manual
I hope this helps to get you started, feel free to send me a PM, too, in case you have more in-depth questions,
foxblock out
Edit: Forgot the actual framework implementation (which maybe only was what you were looking for anyway):
To add your game to the list, edit the following files:
MiniGameStates.h, add (below the one for Fire)
Code:
else if (next == STATE_YOURGAMENAME)
state = new StateYOURGAMENAME;
userStates.h, add
The header file of your game to the includes and
STATE_YOURGAMENAME to STATE_MODES
MiniGames.h, add
GAME_YOURGAMENAME to MINIGAMES_LIST
"YourGameName" to the string array