At first: Please excuse my poor English skills :-(.
But let me tell you about my problem:
I wanted to lean how to use SDL. So, at first I read some articles and tutorials. Then I started to code a "game", less a game, more object of my personal study.
I want to create a framework, which grows with my knowledge, where I can implement my ideas and learn out of it.
I have chosen C++ because I already have some Skills in it and want to improve them.
This is my working state:
- I am using Windows 7 64bit Professional
- game-state-machine with actual 2 states (menu & "game"-mode)
- button, timer, tileMap, animation, player, bitmapFont & log classes
- menu state shows a background, with a barely animated cloud and a button, which switches to gameState
- game-mode has a tileMap based background with a level read in by a file, A test of the bitmapFont, and a moveable "hero" with a camara following him (2D if there are any uncertainties) and an exit button.
All this works fine on the computer I coded it on.
Now the actual problem:
I placed the compiled .exe and all necessary .dll's and images in my DropBox because I wanted to test it on my notebook and I direct linked the folder with a fellow student.
On the source computer it isn't possible to start the game, direct ".exe doesn't work anymore..." (- hope I translated this one right -).
On my Notebook (also Windows 7 64bit Professional / no seperate SDL installation) the game starts correct and enters the main Menu, but if click on the new Game button the game closes without any error message.
So I set up my log and logged every step happening (See code & log below).
This way I pointed out that the program exits without a reason (visible for me) after the end of the constructor of the exit button in game state.
(This is the most important problem)
On the computer of my friend (he actually tested with ArchLinux) it works fine in some cases or it isn't startable. (Also interesting, but it's more important for me to get a working version on my notebook, but I am interested in articles/tutorials about using SDL cross platform, because reading windows and linux tutorials and then point out the differences isn't fun, I think.)
Edit: Talked to my friend again, he used windows, too, but I am still interested in cross platform sources.
I am thankful for every help and advice you can provide me. :-)
If new Game button is clicked nxtState is set to STATE_HOME_FARM, changeState is called every gameloop before rendering.
void changeState()
{
if (nxtState != STATE_NO_CHANGE)
{
log->log("start change");
if (nxtState != STATE_EXIT)
{
log->log("delete act");
delete workingState;
log->log("done");
}
switch (nxtState)
{
case STATE_HOME_FARM:
log->log("detected home farm");
workingState = new HomeFarm();
log->log("createt state");
break;
}
log->log("set vars");
actState = nxtState;
nxtState = STATE_NO_CHANGE;
log->log("done");
}
}
This is the constructor of my HomeFarm class.
actWid = LEVEL_WIDTH;
actHig = LEVEL_HEIGHT;
log->log("create hero");
hero = new Farmer;
log->log("create exit button");
exitButton = new ExitButton(SCREEN_WIDTH/2, SCREEN_HEIGHT-200 , 200, 100, "Buttons/test_button_exit.png");
log->log("create font");
This is the constructor of my ExitButton class
log->log("set vars");
CLIP_MOUSEOVER = 0;
CLIP_MOUSEOUT = 1;
CLIP_MOUSEDOWN = 2;
CLIP_MOUSEUP = 3;
button.x = x;
button.y = y;
button.w = width;
button.h = height;
log->log("load img");
img = loadImg(filename);
log->log("set clip");
setClips();
log->log("set initial clip");
state = &clip[CLIP_MOUSEOUT];
log->log("done");
And finally this is my log.txt created if I run the game on my notebook and try to start a Game.
start change delete act done detected home farm create hero create exit button set vars load img set clip set initial clip done
Nazzrim
Edited by Nazzrim, 10 May 2012 - 02:13 AM.






