Added automatic backtracing via RegisterStacktrace in Backtrace. Added a simple hello world demo that just throws up a window. Started working on TileSet again and skeletoned a demo for it.

This commit is contained in:
2011-06-19 14:36:21 +00:00
parent 1cdf80aab6
commit f62a36e1c6
35 changed files with 22529 additions and 53 deletions

33
demo/helloworld/cpp/demo.cpp Executable file
View File

@@ -0,0 +1,33 @@
/*
* This demo starts up and does nothing until you hit Escape to kill it.
*/
#include <libsdlgame/libsdlgame.h>
int main(int argc, char *argv[])
{
Display2D display = Display2D();
Game &myGame = Game::NewSingleton();
unsigned int lastTimer = 0;
myGame.initSDL();
myGame.initVideo(640, 480, 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
display.initVideo((Vector){0,0,0}, 640, 480, 32, SDL_HWSURFACE);
display.setActive(1);
myGame.windows.push_back(&display);
lastTimer = SDL_GetTicks();
while ( 1 ) {
if ( (SDL_GetTicks() - lastTimer) >= (1000/30) ) {
myGame.update();
lastTimer = SDL_GetTicks();
} else {
myGame.update(1);
}
if ( myGame.keyHeldDown(SDLK_ESCAPE) ) {
break;
}
myGame.finishFrame();
}
}