comparison src/video/SDL_sysvideo.h @ 1733:0b1070f2f94d SDL-1.3

Implemented gamma correction on Windows. Added general code to restore the video mode and gamma when windows lose focus.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 09 Jul 2006 09:02:26 +0000
parents 0ef52d56e8bb
children f7c667ded87d
comparison
equal deleted inserted replaced
1732:fd65f12b6de6 1733:0b1070f2f94d
115 char *title; 115 char *title;
116 int x, y; 116 int x, y;
117 int w, h; 117 int w, h;
118 Uint32 flags; 118 Uint32 flags;
119 119
120 Uint16 *gamma;
121
122 int display; 120 int display;
123 SDL_Renderer *renderer; 121 SDL_Renderer *renderer;
124 122
125 void *userdata; 123 void *userdata;
126 void *driverdata; 124 void *driverdata;
127 }; 125 };
126 #define FULLSCREEN_VISIBLE(W) \
127 ((W->flags & SDL_WINDOW_FULLSCREEN) && \
128 (W->flags & SDL_WINDOW_SHOWN) && \
129 !(W->flags & SDL_WINDOW_MINIMIZED))
128 130
129 /* Define the SDL display structure 131 /* Define the SDL display structure
130 This corresponds to physical monitors attached to the system. 132 This corresponds to physical monitors attached to the system.
131 */ 133 */
132 struct SDL_VideoDisplay 134 struct SDL_VideoDisplay
134 int max_display_modes; 136 int max_display_modes;
135 int num_display_modes; 137 int num_display_modes;
136 SDL_DisplayMode *display_modes; 138 SDL_DisplayMode *display_modes;
137 SDL_DisplayMode desktop_mode; 139 SDL_DisplayMode desktop_mode;
138 SDL_DisplayMode current_mode; 140 SDL_DisplayMode current_mode;
141 SDL_DisplayMode desired_mode;
142 SDL_DisplayMode *fullscreen_mode;
139 SDL_Palette *palette; 143 SDL_Palette *palette;
144
145 Uint16 *gamma;
146 Uint16 *saved_gamma; /* (just offset into gamma) */
140 147
141 int num_render_drivers; 148 int num_render_drivers;
142 SDL_RenderDriver *render_drivers; 149 SDL_RenderDriver *render_drivers;
143 150
144 int num_windows; 151 int num_windows;
172 int (*VideoInit) (_THIS); 179 int (*VideoInit) (_THIS);
173 180
174 /* * * */ 181 /* * * */
175 /* Display functions 182 /* Display functions
176 */ 183 */
184
185 /* Get a list of the available display modes.
186 * e.g. SDL_AddDisplayMode(_this->current_display, mode)
187 */
188 void (*GetDisplayModes) (_THIS);
189
177 /* Setting the display mode is independent of creating windows, 190 /* Setting the display mode is independent of creating windows,
178 * so when the display mode is changed, all existing windows 191 * so when the display mode is changed, all existing windows
179 * should have their data updated accordingly, including the 192 * should have their data updated accordingly, including the
180 * display surfaces associated with them. 193 * display surfaces associated with them.
181 */ 194 */
182 int (*SetDisplayMode) (_THIS, SDL_DisplayMode * mode); 195 int (*SetDisplayMode) (_THIS, SDL_DisplayMode * mode);
183 196
184 /* Sets the color entries of the display palette to those in 'colors'. 197 /* Set the color entries of the display palette */
185 The return value is 0 if all entries could be set properly or -1
186 otherwise.
187 */
188 int (*SetDisplayPalette) (_THIS, SDL_Palette * palette); 198 int (*SetDisplayPalette) (_THIS, SDL_Palette * palette);
199
200 /* Get the color entries of the display palette */
201 int (*GetDisplayPalette) (_THIS, SDL_Palette * palette);
202
203 /* Set the gamma ramp */
204 int (*SetDisplayGammaRamp) (_THIS, Uint16 * ramp);
205
206 /* Get the gamma ramp */
207 int (*GetDisplayGammaRamp) (_THIS, Uint16 * ramp);
189 208
190 /* * * */ 209 /* * * */
191 /* Window functions 210 /* Window functions
192 */ 211 */
193 int (*CreateWindow) (_THIS, SDL_Window * window); 212 int (*CreateWindow) (_THIS, SDL_Window * window);
210 229
211 /* Reverse the effects VideoInit() -- called if VideoInit() fails 230 /* Reverse the effects VideoInit() -- called if VideoInit() fails
212 or if the application is shutting down the video subsystem. 231 or if the application is shutting down the video subsystem.
213 */ 232 */
214 void (*VideoQuit) (_THIS); 233 void (*VideoQuit) (_THIS);
215
216 /* * * */
217 /* Gamma support */
218
219 /* Set the gamma correction directly (emulated with gamma ramps) */
220 int (*SetGamma) (_THIS, float red, float green, float blue);
221
222 /* Get the gamma correction directly (emulated with gamma ramps) */
223 int (*GetGamma) (_THIS, float *red, float *green, float *blue);
224
225 /* Set the gamma ramp */
226 int (*SetGammaRamp) (_THIS, Uint16 * ramp);
227
228 /* Get the gamma ramp */
229 int (*GetGammaRamp) (_THIS, Uint16 * ramp);
230 234
231 /* * * */ 235 /* * * */
232 /* OpenGL support */ 236 /* OpenGL support */
233 237
234 /* Sets the dll to use for OpenGL and loads it */ 238 /* Sets the dll to use for OpenGL and loads it */
403 #if SDL_VIDEO_DRIVER_GLSDL 407 #if SDL_VIDEO_DRIVER_GLSDL
404 extern VideoBootStrap glSDL_bootstrap; 408 extern VideoBootStrap glSDL_bootstrap;
405 #endif 409 #endif
406 410
407 #define SDL_CurrentDisplay (_this->displays[_this->current_display]) 411 #define SDL_CurrentDisplay (_this->displays[_this->current_display])
408 #define SDL_CurrentWindow (SDL_CurrentDisplay.windows[0])
409 412
410 extern SDL_VideoDevice *SDL_GetVideoDevice(); 413 extern SDL_VideoDevice *SDL_GetVideoDevice();
411 extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); 414 extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
412 extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display); 415 extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
413 extern SDL_bool SDL_AddDisplayMode(int displayIndex, 416 extern SDL_bool SDL_AddDisplayMode(int displayIndex,
416 const SDL_RenderDriver * driver); 419 const SDL_RenderDriver * driver);
417 420
418 extern SDL_Window *SDL_GetWindowFromID(SDL_WindowID windowID); 421 extern SDL_Window *SDL_GetWindowFromID(SDL_WindowID windowID);
419 extern SDL_VideoDisplay *SDL_GetDisplayFromWindow(SDL_Window * window); 422 extern SDL_VideoDisplay *SDL_GetDisplayFromWindow(SDL_Window * window);
420 423
424 extern void SDL_OnWindowShown(SDL_Window * window);
425 extern void SDL_OnWindowHidden(SDL_Window * window);
426 extern void SDL_OnWindowFocusGained(SDL_Window * window);
427 extern void SDL_OnWindowFocusLost(SDL_Window * window);
428
421 #endif /* _SDL_sysvideo_h */ 429 #endif /* _SDL_sysvideo_h */
422 430
423 /* vi: set ts=4 sw=4 expandtab: */ 431 /* vi: set ts=4 sw=4 expandtab: */