X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fvideo%2Fscreen.h;h=c3c1d82eee389498a8377db41d310fb8eaf866dd;hb=1028ce017d6809007e39a8f7c034a0d62bfe3052;hp=93c0bfae7a0e1a0e1400c0a0b32856016e9e5be4;hpb=f10f7bbeb7f782c09c290e2474df2dcedd9a2820;p=supertux.git diff --git a/lib/video/screen.h b/lib/video/screen.h index 93c0bfae7..c3c1d82ee 100644 --- a/lib/video/screen.h +++ b/lib/video/screen.h @@ -49,6 +49,11 @@ namespace SuperTux { if(color.size() >= 3) { red = color[0]; green = color[1]; blue = color[2]; } if(color.size() == 4) alpha = color[3]; } + Color(std::vector color) + : red(0), green(0), blue(0), alpha(255) + { if(color.size() >= 3) { red = color[0]; green = color[1]; blue = color[2]; } + if(color.size() == 4) alpha = color[3]; } + Color(const Color& o) : red(o.red), green(o.green), blue(o.blue), alpha(o.alpha) { } @@ -61,13 +66,19 @@ namespace SuperTux return false; } + Uint32 map_rgb(SDL_Surface* surface) + { return SDL_MapRGB(surface->format, red, green, blue); } + Uint32 map_rgba(SDL_Surface* surface) + { return SDL_MapRGBA(surface->format, red, green, blue, alpha); } + Uint8 red, green, blue, alpha; }; class Vector; - void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel); + Uint32 getpixel(SDL_Surface* surface, int x, int y); + void putpixel(SDL_Surface* surface, int x, int y, Uint32 pixel); void drawpixel(int x, int y, Uint32 pixel); void fillrect(float x, float y, float w, float h, int r, int g, int b, int a = 255); void draw_line(float x1, float y1, float x2, float y2, int r, int g, int b, int a = 255);