fixed RLEsprite bug
[eradicate] / src / game.c
index 88a7e3f..4c220b5 100644 (file)
@@ -1,28 +1,52 @@
 #include "game.h"
-#include "menuscr.h"
+#include "screens.h"
+#include "sprite.h"
 
 int fb_width, fb_height;
 long fb_size;
-void *fb_pixels, *vmem;
+uint16_t *fb_pixels;
 
 long time_msec;
 
 void (*draw)(void);
 void (*key_event)(int key, int pressed);
 
+static struct sprites dbgfont;
+
 
 int init(int argc, char **argv)
 {
+       if(load_sprites(&dbgfont, "data/dbgfont.spr") == -1) {
+               return -1;
+       }
+       if(intro_init() == -1) {
+               return -1;
+       }
        if(menu_init() == -1) {
                return -1;
        }
 
-       draw = menu_draw;
-       key_event = menu_keyb;
+       intro_start();
        return 0;
 }
 
 void cleanup(void)
 {
+       intro_cleanup();
        menu_cleanup();
 }
+
+void dbg_print(void *fb, int x, int y, const char *str)
+{
+       uint16_t *dest = (uint16_t*)fb + y * fb_width + x;
+
+       while(*str) {
+               int c = *str++;
+
+               if(c > ' ' && c < 128) {
+                       draw_sprite(dest, fb_width * 2, &dbgfont, c - ' ');
+               }
+               dest += 8;
+       }
+}
+