diff options
Diffstat (limited to 'trunk/example.c')
-rw-r--r-- | trunk/example.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/trunk/example.c b/trunk/example.c index 8424c11..f2a7a86 100644 --- a/trunk/example.c +++ b/trunk/example.c @@ -9,11 +9,14 @@ void sdl_draw_pixel(SDL_Surface* surface, uint32_t x, uint32_t y, uint32_t color { uint32_t* pixel = ((uint32_t*) (surface->pixels)) + (y * surface->pitch/4) + x; /* pretty sure SDL can do this, but can't figure out how */ - uint32_t alpha = 0xff;/*color & 0x000000ff;*/ - uint32_t r = ((color & 0xff000000) >> 24) * (alpha / 255.0); + uint32_t alpha = color & 0x000000ff; + uint32_t r = alpha; + uint32_t g = alpha; + uint32_t b = alpha; + /*uint32_t r = ((color & 0xff000000) >> 24) * (alpha / 255.0); uint32_t g = ((color & 0x00ff0000) >> 16) * (alpha / 255.0); - uint32_t b = ((color & 0x0000ff00) >> 8) * (alpha / 255.0); - uint32_t mapped_color = SDL_MapRGBA(surface->format, r, g, b, alpha); + uint32_t b = ((color & 0x0000ff00) >> 8) * (alpha / 255.0);*/ + uint32_t mapped_color = SDL_MapRGB(surface->format, r, g, b); *pixel = mapped_color; } |