frodo-wii/main.cpp

49 lines
778 B
C++
Raw Normal View History

2009-11-23 20:47:01 +01:00
#include <SDL_image.h>
#include <SDL_ttf.h>
2009-12-06 10:11:04 +01:00
#include "gui.hh"
2009-11-23 19:52:30 +01:00
#include "utils.hh"
SDL_Surface *screen;
2009-11-28 09:43:37 +01:00
static Gui *g_gui;
2009-11-23 19:52:30 +01:00
static void run(void)
{
while(1)
{
SDL_Event ev;
while (SDL_PollEvent(&ev)) {
2009-11-23 19:52:30 +01:00
if (ev.type == SDL_QUIT)
2009-11-23 20:47:01 +01:00
exit(1);
2009-11-23 19:52:30 +01:00
2009-11-28 09:43:37 +01:00
g_gui->pushEvent(&ev);
2009-11-23 19:52:30 +01:00
}
2009-11-28 09:43:37 +01:00
g_gui->runLogic();
g_gui->draw(screen);
2009-11-23 19:52:30 +01:00
2009-11-23 20:33:51 +01:00
SDL_Flip(screen);
2009-11-23 19:52:30 +01:00
SDL_Delay(50);
}
}
static void init(void)
{
screen = SDL_SetVideoMode(640, 480, 16,
SDL_DOUBLEBUF);
panic_if(!screen, "Cannot initialize video: %s\n", SDL_GetError());
TTF_Init();
2009-11-28 09:43:37 +01:00
g_gui = new Gui();
panic_if(!g_gui->setTheme("themes/default"),
"Setting theme failed\n");
g_gui->activate();
2009-11-23 19:52:30 +01:00
}
2009-11-19 18:59:43 +01:00
int main(int argc, char *argv[])
{
2009-11-23 19:52:30 +01:00
init();
run();
2009-11-19 18:59:43 +01:00
return 0;
}