X-Git-Url: https://eleni.mutantstargoat.com/git/?p=winnie;a=blobdiff_plain;f=src%2Fsdl%2Fgfx.cc;h=aec9663a853f8eb1cf8c2762fe692236762926b0;hp=5be33e68fd520cb3115ee728950a8f7fb9d47db6;hb=52044efd7717f4b02bd463c9a26f83c9a41953ea;hpb=906b341b177e5947710107eceb9ab2e4ee09528c diff --git a/src/sdl/gfx.cc b/src/sdl/gfx.cc index 5be33e6..aec9663 100644 --- a/src/sdl/gfx.cc +++ b/src/sdl/gfx.cc @@ -9,6 +9,8 @@ static SDL_Surface *fbsurf; static Rect screen_rect = {0, 0, 1024, 768}; static int color_depth = 32; // bits per pixel +static Pixmap *pixmap; + bool init_gfx() { if(SDL_Init(SDL_INIT_VIDEO) == -1) { @@ -22,11 +24,20 @@ 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; } void destroy_gfx() { + pixmap->pixels = 0; + delete pixmap; SDL_Quit(); } @@ -35,6 +46,11 @@ unsigned char *get_framebuffer() return (unsigned char*)fbsurf->pixels; } +Pixmap *get_framebuffer_pixmap() +{ + return pixmap; +} + Rect get_screen_size() { return screen_rect;