00001 // SuperTux 00002 // Copyright (C) 2006 Matthias Braun <matze@braunis.de> 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #ifndef HEADER_SUPERTUX_VIDEO_SDL_LIGHTMAP_HPP 00018 #define HEADER_SUPERTUX_VIDEO_SDL_LIGHTMAP_HPP 00019 00020 #include "video/lightmap.hpp" 00021 00022 class Color; 00023 struct DrawingRequest; 00024 00025 class SDLLightmap : public Lightmap 00026 { 00027 public: 00028 SDLLightmap(); 00029 ~SDLLightmap(); 00030 00031 void start_draw(const Color &ambient_color); 00032 void end_draw(); 00033 void do_draw(); 00034 void draw_surface(const DrawingRequest& request); 00035 void draw_surface_part(const DrawingRequest& request); 00036 void draw_text(const DrawingRequest& request); 00037 void draw_gradient(const DrawingRequest& request); 00038 void draw_filled_rect(const DrawingRequest& request); 00039 void get_light(const DrawingRequest& request) const; 00040 00041 private: 00042 SDL_Surface* screen; 00043 Uint8 *red_channel; 00044 Uint8 *blue_channel; 00045 Uint8 *green_channel; 00046 int width; 00047 int height; 00048 int numerator; 00049 int denominator; 00050 int LIGHTMAP_DIV; 00051 00052 void light_blit(SDL_Surface *src, SDL_Rect *src_rect, int dstx, int dsty); 00053 00054 private: 00055 SDLLightmap(const SDLLightmap&); 00056 SDLLightmap& operator=(const SDLLightmap&); 00057 }; 00058 00059 #endif 00060 00061 /* EOF */