00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef VIDEO_HPP_INCLUDED
00015 #define VIDEO_HPP_INCLUDED
00016
00017 #include "events.hpp"
00018 #include "SDL.h"
00019 #include "sdl_utils.hpp"
00020
00021
00022 #define FULL_SCREEN SDL_FULLSCREEN
00023 #define VIDEO_MEMORY SDL_HWSURFACE
00024 #define SYSTEM_MEMORY SDL_SWSURFACE
00025
00026 surface display_format_alpha(surface surf);
00027 surface get_video_surface();
00028 SDL_Rect screen_area();
00029
00030 bool non_interactive();
00031
00032
00033 void update_rect(size_t x, size_t y, size_t w, size_t h);
00034 void update_rect(const SDL_Rect& rect);
00035 void update_whole_screen();
00036
00037 class CVideo {
00038 public:
00039 CVideo();
00040 CVideo(int x, int y, int bits_per_pixel, int flags);
00041 ~CVideo();
00042
00043 int modePossible( int x, int y, int bits_per_pixel, int flags );
00044 int setMode( int x, int y, int bits_per_pixel, int flags );
00045
00046
00047 bool modeChanged();
00048
00049 int setGamma(float gamma);
00050
00051
00052 int getx() const;
00053 int gety() const;
00054 int getBitsPerPixel();
00055 int getBytesPerPixel();
00056 int getRedMask();
00057 int getGreenMask();
00058 int getBlueMask();
00059
00060
00061 void lock();
00062 void unlock();
00063 int mustLock();
00064
00065
00066 void blit_surface(int x, int y, surface surf, SDL_Rect* srcrect=NULL, SDL_Rect* clip_rect=NULL);
00067 void flip();
00068
00069 surface getSurface( void );
00070
00071 bool isFullScreen() const;
00072
00073 struct error {};
00074
00075 struct quit {};
00076
00077
00078 void setBpp( int bpp );
00079 int getBpp();
00080
00081 void make_fake();
00082 bool faked() const { return fake_screen; }
00083
00084
00085
00086
00087 int set_help_string(const std::string& str);
00088 void clear_help_string(int handle);
00089 void clear_all_help_strings();
00090
00091
00092
00093
00094
00095
00096 void lock_updates(bool value);
00097 bool update_locked() const;
00098
00099 private:
00100
00101 bool mode_changed_;
00102
00103 int bpp;
00104
00105
00106 bool fake_screen;
00107
00108
00109 int help_string_;
00110
00111 int updatesLocked_;
00112 };
00113
00114
00115 struct update_locker
00116 {
00117 update_locker(CVideo& v, bool lock=true) : video(v), unlock(lock) {
00118 if(lock) {
00119 video.lock_updates(true);
00120 }
00121 }
00122
00123 ~update_locker() {
00124 unlock_update();
00125 }
00126
00127 void unlock_update() {
00128 if(unlock) {
00129 video.lock_updates(false);
00130 unlock = false;
00131 }
00132 }
00133
00134 private:
00135 CVideo& video;
00136 bool unlock;
00137 };
00138
00139 class resize_monitor : public events::pump_monitor {
00140 void process(events::pump_info &info);
00141 };
00142
00143
00144
00145 struct resize_lock {
00146 resize_lock();
00147 ~resize_lock();
00148 };
00149
00150 #endif