diff options
Diffstat (limited to 'src/sdl/gfx.cc')
| -rw-r--r-- | src/sdl/gfx.cc | 16 |
1 files changed, 16 insertions, 0 deletions
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; |
