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:
33
demo/tilemap/cpp/demo.cpp
Executable file
33
demo/tilemap/cpp/demo.cpp
Executable 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user