dos port underway
[retroray] / src / app.c
index fdcbe11..b7e2bdb 100644 (file)
--- a/src/app.c
+++ b/src/app.c
@@ -52,6 +52,7 @@ struct font *uifont;
 
 uint32_t *framebuf;
 
+struct scene *scn;
 
 /* available screens */
 #define MAX_SCREENS    8
@@ -72,6 +73,10 @@ int app_init(void)
        enable_fpexcept();
 #endif
 
+#ifdef GFX_SW
+       gaw_sw_init();
+#endif
+
        load_options("retroray.cfg");
        app_resize(opt.xres, opt.yres);
        app_vsync(opt.vsync);
@@ -89,6 +94,10 @@ int app_init(void)
 
        rtk_setup(&guigfx);
 
+       if(!(scn = create_scene())) {
+               return -1;
+       }
+
        /* initialize screens */
        screens[num_screens++] = &scr_model;
        screens[num_screens++] = &scr_rend;
@@ -133,6 +142,12 @@ void app_shutdown(void)
        destroy_font(uifont);
        free(uifont);
 
+#ifdef GFX_SW
+       gaw_sw_destroy();
+#endif
+
+       free_scene(scn);
+
        cleanup_logger();
 }
 
@@ -150,7 +165,9 @@ void app_reshape(int x, int y)
        int numpix = x * y;
        int prev_numpix = win_width * win_height;
 
-       if(numpix > prev_numpix) {
+       printf("reshape(%d, %d)\n", x, y);
+
+       if(!framebuf || numpix > prev_numpix) {
                void *tmp;
                if(!(tmp = realloc(framebuf, numpix * sizeof *framebuf))) {
                        errormsg("failed to resize framebuffer to %dx%d\n", x, y);