X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fapp.c;h=d62ef606fb9946735dc374b40dd0737eea7540d3;hb=3c3612761bcf77a5c4ec6810aa47e0e3f0131bf1;hp=b7e2bdbdff70a8187e98cfc03144bfe0366ce520;hpb=f0f09a5f3f76fd4207e4d2d71f29f876b2b379f7;p=retroray
diff --git a/src/app.c b/src/app.c
index b7e2bdb..d62ef60 100644
--- a/src/app.c
+++ b/src/app.c
@@ -23,6 +23,8 @@ along with this program. If not, see .
#include
#include "gaw/gaw.h"
#include "app.h"
+#include "timer.h"
+#include "rend.h"
#include "options.h"
#include "font.h"
#include "util.h"
@@ -36,7 +38,6 @@ static void gui_fill(rtk_rect *rect, uint32_t color);
static void gui_blit(int x, int y, rtk_icon *icon);
static void gui_drawtext(int x, int y, const char *str);
static void gui_textrect(const char *str, rtk_rect *rect);
-static void txdraw(struct dtx_vertex *v, int vcount, struct dtx_pixmap *pixmap, void *cls);
int mouse_x, mouse_y, mouse_state[3];
unsigned int modkeys;
@@ -66,28 +67,27 @@ int app_init(void)
char *start_scr_name;
static rtk_draw_ops guigfx = {gui_fill, gui_blit, gui_drawtext, gui_textrect};
- init_logger();
-
#if !defined(NDEBUG) && defined(DBG_FPEXCEPT)
- printf("floating point exceptions enabled\n");
+ infomsg("floating point exceptions enabled\n");
enable_fpexcept();
#endif
#ifdef GFX_SW
gaw_sw_init();
#endif
+ rend_init();
- load_options("retroray.cfg");
- app_resize(opt.xres, opt.yres);
app_vsync(opt.vsync);
if(opt.fullscreen) {
app_fullscreen(1);
}
- dtx_target_user(txdraw, 0);
+ /*dtx_target_user(txdraw, 0);*/
+ dtx_target_raster((unsigned char*)framebuf, win_width, win_height);
+ dtx_set(DTX_RASTER_THRESHOLD, 127);
uifont = malloc_nf(sizeof *uifont);
- if(load_font(uifont, "data/uifont12.gmp") == -1) {
+ if(load_font(uifont, "data/uifont14.gmp") == -1) {
free(uifont);
return -1;
}
@@ -110,7 +110,7 @@ int app_init(void)
}
}
- time_msec = app_getmsec();
+ time_msec = get_msec();
for(i=0; iname && start_scr_name && strcmp(screens[i]->name, start_scr_name) == 0) {
@@ -153,11 +153,9 @@ void app_shutdown(void)
void app_display(void)
{
- time_msec = app_getmsec();
+ time_msec = get_msec();
cur_scr->display();
-
- app_swap_buffers();
}
void app_reshape(int x, int y)
@@ -165,8 +163,6 @@ void app_reshape(int x, int y)
int numpix = x * y;
int prev_numpix = win_width * win_height;
- printf("reshape(%d, %d)\n", x, y);
-
if(!framebuf || numpix > prev_numpix) {
void *tmp;
if(!(tmp = realloc(framebuf, numpix * sizeof *framebuf))) {
@@ -178,6 +174,7 @@ void app_reshape(int x, int y)
#ifdef GFX_SW
gaw_sw_framebuffer(x, y, framebuf);
#endif
+ dtx_target_raster((unsigned char*)framebuf, x, y);
win_width = x;
win_height = y;
@@ -187,18 +184,35 @@ 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)
{
+ long msec;
+ static long prev_esc;
+
if(press) {
switch(key) {
#ifdef DBG_ESCQUIT
case 27:
- app_quit();
- return;
+ msec = get_msec();
+ if(msec - prev_esc < 1000) {
+ app_quit();
+ return;
+ }
+ prev_esc = msec;
+ break;
#endif
+ case 'q':
+ if(modkeys & KEY_MOD_CTRL) {
+ app_quit();
+ return;
+ }
+ break;
+
case '\n':
case '\r':
if(modkeys & KEY_MOD_ALT) {
@@ -320,7 +334,3 @@ static void gui_textrect(const char *str, rtk_rect *rect)
rect->width = 20;
rect->height = 10;/* TODO */
}
-
-static void txdraw(struct dtx_vertex *v, int vcount, struct dtx_pixmap *pixmap, void *cls)
-{
-}