stop appending repeat keys to the input buffer
[retroray] / src / app.c
index b0fc2e8..a79777f 100644 (file)
--- a/src/app.c
+++ b/src/app.c
@@ -77,8 +77,6 @@ int app_init(void)
 #endif
        rend_init();
 
-       load_options("retroray.cfg");
-       app_resize(opt.xres, opt.yres);
        app_vsync(opt.vsync);
        if(opt.fullscreen) {
                app_fullscreen(1);
@@ -165,8 +163,6 @@ void app_reshape(int x, int y)
        int numpix = x * y;
        int prev_numpix = win_width * win_height;
 
-       dbgmsg("reshape(%d, %d)\n", x, y);
-
        if(!framebuf || numpix > prev_numpix) {
                void *tmp;
                if(!(tmp = realloc(framebuf, numpix * sizeof *framebuf))) {
@@ -188,6 +184,8 @@ void app_reshape(int x, int y)
        if(cur_scr && cur_scr->reshape) {
                cur_scr->reshape(x, y);
        }
+
+       app_redisplay(0, 0, 0, 0);
 }
 
 void app_keyboard(int key, int press)
@@ -202,9 +200,10 @@ void app_keyboard(int key, int press)
                        msec = get_msec();
                        if(msec - prev_esc < 1000) {
                                app_quit();
+                               return;
                        }
                        prev_esc = msec;
-                       return;
+                       break;
 #endif
 
                case 'q':
@@ -327,11 +326,21 @@ static void gui_blit(int x, int y, rtk_icon *icon)
 
 static void gui_drawtext(int x, int y, const char *str)
 {
+       use_font(uifont);
+       dtx_position(x, y);
+       dtx_color(0, 0, 0, 1);
+       dtx_string(str);
 }
 
 static void gui_textrect(const char *str, rtk_rect *rect)
 {
-       rect->x = rect->y = 0;
-       rect->width = 20;
-       rect->height = 10;/* TODO */
+       struct dtx_box dbox;
+
+       use_font(uifont);
+       dtx_string_box(str, &dbox);
+
+       rect->x = dbox.x;
+       rect->y = dbox.y;
+       rect->width = dbox.width;
+       rect->height = dbox.height;
 }