summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/main.cpp b/main.cpp
index d6ad962..4d050fc 100644
--- a/main.cpp
+++ b/main.cpp
@@ -3,25 +3,44 @@
#include "gl.h"
+#include <SDL_image.h>
+
+bool init_sdl_image() {
+ int real_flags = IMG_Init(IMG_INIT_PNG | IMG_INIT_JPG);
+ if(!(real_flags | IMG_INIT_PNG && real_flags | IMG_INIT_JPG)) {
+ std::cerr << "Missing PNG or JPEG libraries" << std::endl;
+ return false;
+ }
+ return true;
+}
+
int main(int argc, char **argv) {
+ if(!init_sdl_image())
+ return 1;
+
video::width = 1280;
video::height = 720;
video::init();
- Scene scene;
+#ifdef WIN32
+ win32_gl_init();
+#endif
+
+ Scene *scene = new Scene();
SDL_ShowCursor(SDL_DISABLE);
SDL_WarpMouse(video::width/2, video::height/2);
- scene.last_time = SDL_GetTicks();
- scene.update();
- while(scene.running) {
- scene.events();
- scene.render();
+ scene->last_time = SDL_GetTicks();
+ scene->update();
+ while(scene->running) {
+ scene->events();
+ scene->render();
SDL_Delay(1);
}
+ delete scene;
video::free();
return 0;