Dragons_Slayer said:
Could anyone explain how to add foxblock's games to my build, I have everything set up to build PandoraPanic but I don't know how to add the new files and if I have to add some lines in another files so the program knows he has to use the new files (Never really used CodeBlocks before, only used visual studio before).
I assume you already have added the .cpp and .h files via Project -> Add files..., they'll most likely end up in "Sources" and "Headers" though, I moved them to "My games -> States -> Minigames"
Next you have to add the games to the list of available games:
In "My game -> MyGame.cpp" add
Code:
void MyGame::stateManagement() {
[...]
else if (next == STATE_SNATCHABEER)
state = new StateSnatchABeer;
else if (next == STATE_THECOUNTJOB)
state = new StateTheCountJob;
[...]
}
In "My game -> States -> Minigames -> Minigames.h" add:
Code:
enum MINIGAMES_LIST {
[...]
GAME_SNATCHABEER,
GAME_THECOUNTJOB,
[...]
}
static string MINIGAMES_NAMES[]= {
[...]
"Snatch A Beer"
"The Count Job"
[...]
}
Make sure you have them added behind the same game so the connection between the game state and the game name is not screwed up.
Also you have to edit the MAX_GAMES integer (at the top of the file), just increase it by 2.
In "My Game -> States -> userStates.h" add
Code:
#include "StateSnatchABeer.h"
#include "StateTheCountJob.h"
[...]
enum STATE_MODES {
[...]
STATE_SNATCHABEER,
STATE_THECOUNTJOB,
[...]
}
Then to add the games to the select screen:
In "My Game -> States -> StateMain.cpp" add:
Code:
void StateMain::genPreview(uint next) {
[...]
else if (next == STATE_SNATCHABEER)
subState = new StateSnatchABeer;
else if (next == STATE_THECOUNTJOB)
subState = new StateTheCountJob;
[...]
}
Phew, I hope that was all, the game will probably crash at some point if I forgort something, so report back if this happens (look what Penjin says in stdout.txt and stderr.txt, it helps identifying the error).
You also have to go through all these steps when you create your own game.
I might be a good idea to update the wiki with a more detailed description, I also recall it lacks the explanation how to add your game to the game selection screen.
Anyway, I hope I could help
foxblock out