frodo-wii/main.cpp

51 lines
770 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"
#include <C64.h>
2009-11-23 19:52:30 +01:00
SDL_Surface *screen;
C64 *TheC64;
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
Gui::gui->pushEvent(&ev);
2009-11-23 19:52:30 +01:00
}
Gui::gui->runLogic();
Gui::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)
{
/* Creation of the mocks */
TheC64 = new C64();
2009-11-23 19:52:30 +01:00
screen = SDL_SetVideoMode(640, 480, 16,
SDL_DOUBLEBUF);
panic_if(!screen, "Cannot initialize video: %s\n", SDL_GetError());
TTF_Init();
Gui::init();
Gui::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;
}