fbdev version works with truetype
authorEleni Maria Stea <elene.mst@gmail.com>
Wed, 27 Feb 2013 21:31:16 +0000 (23:31 +0200)
committerEleni Maria Stea <elene.mst@gmail.com>
Wed, 27 Feb 2013 21:31:16 +0000 (23:31 +0200)
Makefile
src/fbdev/gfx.cc
src/sdl/gfx.cc

index 4242187..a132c3f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ dbg = -g
 opt = -O0
 inc = -Isrc
 
-backend = SDL
+#backend = SDL
 
 ifeq ($(backend), SDL)
        def = -DWINNIE_SDL
index e4527b0..742b6c6 100644 (file)
@@ -22,6 +22,8 @@ static int dev_fd = -1;
 static Rect screen_rect;
 static int color_depth; // bits per pixel
 
+static Pixmap *pixmap;
+
 bool init_gfx()
 {
        if((dev_fd = open("/dev/fb0", O_RDWR)) == -1) {
@@ -56,19 +58,23 @@ bool init_gfx()
        }
 
 // TODO: uncomment when I find how to use intelfb instead of i915 GRRRR.-      
-
-/*
        fb_vblank vblank;
        if(ioctl(dev_fd, FBIOGET_VBLANK, &vblank) == -1) {
-               fprintf(stderr, "FBIOGET_VBLANK error: %s\n", strerror(errno));
+//             fprintf(stderr, "FBIOGET_VBLANK error: %s\n", strerror(errno));
        }
-       else {
+/*     
+       else {
                printf("flags: %x\n", vblank.flags);
                printf("count: %d\n", vblank.count);
                printf("beam position: %d, %d\n", vblank.hcount, vblank.vcount);
        }
 */
 
+       pixmap = new Pixmap;
+       pixmap->width = screen_rect.width;
+       pixmap->height = screen_rect.height;
+       pixmap->pixels = framebuffer;
+
        return true;
 }
 
@@ -84,6 +90,8 @@ void destroy_gfx()
 
        munmap(framebuffer, FRAMEBUFFER_SIZE(screen_rect.width, screen_rect.height, color_depth));
        framebuffer = 0;
+
+       pixmap->pixels = 0;
 }
 
 unsigned char *get_framebuffer()
@@ -91,6 +99,11 @@ unsigned char *get_framebuffer()
        return framebuffer;
 }
 
+Pixmap *get_framebuffer_pixmap()
+{
+       return pixmap;
+}
+
 Rect get_screen_size()
 {
        return screen_rect;
index aec9663..1c4f347 100644 (file)
@@ -25,10 +25,8 @@ bool init_gfx()
        SDL_ShowCursor(0);
 
        pixmap = new Pixmap;
-
        pixmap->width = screen_rect.width;
        pixmap->height = screen_rect.height;
-
        pixmap->pixels = (unsigned char*)fbsurf->pixels;
 
        return true;