X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fapp.c;h=87f3a1070c6cb6bef3aa38663a581b1d82f67a21;hb=86aa9bdd85243207bbd7e888d73c2b865d805265;hp=9db63b047c9b01de8c105b11f846d616c8bc948d;hpb=5f50ec3c542ea29211591d4865bdaf1368f8c649;p=retroray
diff --git a/src/app.c b/src/app.c
index 9db63b0..87f3a10 100644
--- a/src/app.c
+++ b/src/app.c
@@ -23,6 +23,7 @@ along with this program. If not, see .
#include
#include "gaw/gaw.h"
#include "app.h"
+#include "rend.h"
#include "options.h"
#include "font.h"
#include "util.h"
@@ -36,7 +37,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;
@@ -52,6 +52,7 @@ struct font *uifont;
uint32_t *framebuf;
+struct scene *scn;
/* available screens */
#define MAX_SCREENS 8
@@ -65,8 +66,6 @@ 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");
enable_fpexcept();
@@ -75,6 +74,7 @@ int app_init(void)
#ifdef GFX_SW
gaw_sw_init();
#endif
+ rend_init();
load_options("retroray.cfg");
app_resize(opt.xres, opt.yres);
@@ -83,16 +83,22 @@ int app_init(void)
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;
}
rtk_setup(&guigfx);
+ if(!(scn = create_scene())) {
+ return -1;
+ }
+
/* initialize screens */
screens[num_screens++] = &scr_model;
screens[num_screens++] = &scr_rend;
@@ -141,6 +147,8 @@ void app_shutdown(void)
gaw_sw_destroy();
#endif
+ free_scene(scn);
+
cleanup_logger();
}
@@ -149,8 +157,6 @@ void app_display(void)
time_msec = app_getmsec();
cur_scr->display();
-
- app_swap_buffers();
}
void app_reshape(int x, int y)
@@ -171,6 +177,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;
@@ -192,6 +199,13 @@ void app_keyboard(int key, int press)
return;
#endif
+ case 'q':
+ if(modkeys & KEY_MOD_CTRL) {
+ app_quit();
+ return;
+ }
+ break;
+
case '\n':
case '\r':
if(modkeys & KEY_MOD_ALT) {
@@ -313,7 +327,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)
-{
-}