Skip to content

Commit

Permalink
Precompute backgroud color and make it solid (ie. no alpha).
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-zago committed Apr 16, 2011
1 parent a62198c commit 44c4fdb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "xgalaga.h"

SDL_Surface *screen;
static Uint32 background_color;

void toggle_fullscreen(void)
{
Expand All @@ -42,6 +43,8 @@ void toggle_fullscreen(void)
fprintf(stderr, "Couldn't toggle screen\n");
exit(1);
}

background_color = SDL_MapRGBA(screen->format, 0, 0, 0, 255);
}

void S_Initialize(int fullscreen)
Expand Down Expand Up @@ -114,9 +117,7 @@ void S_DrawPoint(unsigned int x, unsigned int y, Uint32 pixel)

void S_ClearScreen(void)
{
Uint32 color = 0x000000;

SDL_FillRect (screen, NULL, color);
SDL_FillRect (screen, NULL, background_color);
}

void S_DrawImage(int x, int y, int frame, struct W_Image *image)
Expand Down

0 comments on commit 44c4fdb

Please sign in to comment.