The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
video.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /**
16  * @file
17  * Video-testprogram, standalone
18  */
19 
20 #include "global.hpp"
21 
22 #include "font.hpp"
23 #include "floating_label.hpp"
24 #include "image.hpp"
25 #include "log.hpp"
26 #include "preferences.hpp"
27 #include "sdl/utils.hpp"
28 #include "sdl/rect.hpp"
29 #include "sdl/window.hpp"
30 #include "video.hpp"
31 #include "sdl/gpu.hpp"
32 #include "display.hpp"
33 
34 #include <vector>
35 #include <map>
36 #include <algorithm>
37 
38 #include <assert.h>
39 
40 static lg::log_domain log_display("display");
41 #define LOG_DP LOG_STREAM(info, log_display)
42 #define ERR_DP LOG_STREAM(err, log_display)
43 
44 CVideo* CVideo::singleton_ = nullptr;
45 
46 namespace {
47 #ifdef SDL_GPU
48  GPU_Target *render_target_;
49 #endif
50 }
51 
52 static unsigned int get_flags(unsigned int flags)
53 {
54  /* The wanted flags for the render need to be evaluated for SDL2. */
55 #ifdef SDL_GPU
56  flags |= SDL_OPENGLBLIT;
57 #endif
58 
59  flags |= SDL_WINDOW_RESIZABLE;
60 
61  return flags;
62 }
63 
64 
65 namespace {
66 
67 surface frameBuffer = nullptr;
68 bool fake_interactive = false;
69 }
70 
71 namespace video2 {
72 
73 std::list<events::sdl_handler *> draw_layers;
74 
75 draw_layering::draw_layering(const bool auto_join) :
76  sdl_handler(auto_join)
77 {
78  draw_layers.push_back(this);
79 }
80 
82 {
83  draw_layers.remove(this);
84 
86 }
87 
89  SDL_Event event;
90  event.type = SDL_WINDOWEVENT;
91  event.window.event = SDL_WINDOWEVENT_RESIZED;
92  event.window.data1 = (*frameBuffer).h;
93  event.window.data2 = (*frameBuffer).w;
94 
95  for(std::list<events::sdl_handler*>::iterator it = draw_layers.begin(); it != draw_layers.end(); ++it) {
96  (*it)->handle_window_event(event);
97  }
98 
99  SDL_Event drawEvent;
100  SDL_UserEvent data;
101 
102  data.type = DRAW_ALL_EVENT;
103  data.code = 0;
104  data.data1 = nullptr;
105  data.data2 = nullptr;
106 
107  drawEvent.type = DRAW_ALL_EVENT;
108  drawEvent.user = data;
109  SDL_FlushEvent(DRAW_ALL_EVENT);
110  SDL_PushEvent(&drawEvent);
111 }
112 }
113 
114 
116 {
117  if (fake_interactive)
118  return false;
119  return window == nullptr;
120 }
121 
122 
123 #ifdef SDL_GPU
124 GPU_Target *get_render_target()
125 {
126  return render_target_;
127 }
128 #endif
129 
131 {
132  return frameBuffer;
133 }
134 
135 SDL_Rect screen_area()
136 {
137  return sdl::create_rect(0, 0, frameBuffer->w, frameBuffer->h);
138 }
139 
140 void update_rect(size_t x, size_t y, size_t w, size_t h)
141 {
142  update_rect(sdl::create_rect(x, y, w, h));
143 }
144 
145 void update_rect(const SDL_Rect& rect_value)
146 {
147 
148  SDL_Rect rect = rect_value;
149 
150  surface const fb = nullptr;
151  if(fb != nullptr) {
152  if(rect.x < 0) {
153  if(rect.x*-1 >= int(rect.w))
154  return;
155 
156  rect.w += rect.x;
157  rect.x = 0;
158  }
159 
160  if(rect.y < 0) {
161  if(rect.y*-1 >= int(rect.h))
162  return;
163 
164  rect.h += rect.y;
165  rect.y = 0;
166  }
167 
168  if(rect.x + rect.w > fb->w) {
169  rect.w = fb->w - rect.x;
170  }
171 
172  if(rect.y + rect.h > fb->h) {
173  rect.h = fb->h - rect.y;
174  }
175 
176  if(rect.x >= fb->w) {
177  return;
178  }
179 
180  if(rect.y >= fb->h) {
181  return;
182  }
183  }
184 }
185 
187 {
188  if (event.type == SDL_WINDOWEVENT) {
189  switch (event.window.event) {
190  case SDL_WINDOWEVENT_RESIZED:
191  case SDL_WINDOWEVENT_RESTORED:
192  case SDL_WINDOWEVENT_SHOWN:
193  case SDL_WINDOWEVENT_EXPOSED:
194  //if (display::get_singleton())
195  //display::get_singleton()->redraw_everything();
196  SDL_Event drawEvent;
197  SDL_UserEvent data;
198 
199  data.type = DRAW_ALL_EVENT;
200  data.code = 0;
201  data.data1 = nullptr;
202  data.data2 = nullptr;
203 
204  drawEvent.type = DRAW_ALL_EVENT;
205  drawEvent.user = data;
206 
207  SDL_FlushEvent(DRAW_ALL_EVENT);
208  SDL_PushEvent(&drawEvent);
209  break;
210  }
211  }
212 }
213 
214 
216  window(),
217 #ifdef SDL_GPU
218  shader_(),
219 #endif
220  mode_changed_(false),
221  fake_screen_(false),
222  help_string_(0),
223  updatesLocked_(0)
224 {
225  assert(!singleton_);
226  singleton_ = this;
227  initSDL();
228  switch(type)
229  {
230  case NO_FAKE:
231  break;
232  case FAKE:
233  make_fake();
234  break;
235  case FAKE_TEST:
236  make_test_fake();
237  break;
238  }
239 }
240 
242 {
243 #ifdef SDL_GPU
244  //800x600 is a dummy value, the actual resolution is set in setMode
245  render_target_ = GPU_Init(800, 600, GPU_DEFAULT_INIT_FLAGS);
246 
247  if(render_target_ == nullptr) {
248  ERR_DP << "Could not initialize window: " << SDL_GetError() << std::endl;
249  throw CVideo::error();
250  }
251 
252  const std::string vertex_src = game_config::path + "/data/shaders/default.vert";
253  const std::string frag_src = game_config::path + "/data/shaders/default.frag";
254  shader_ = sdl::shader_program(vertex_src, frag_src);
255  shader_.activate();
256 #else
257  const int res = SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
258 
259  if(res < 0) {
260  ERR_DP << "Could not initialize SDL_video: " << SDL_GetError() << std::endl;
261  throw CVideo::error();
262  }
263 #endif
264 }
265 
266 #ifdef SDL_GPU
267 void CVideo::update_overlay(SDL_Rect *rect)
268 {
269  sdl::timage img(overlay_);
270  shader_.set_overlay(img);
271 
272  // Re-render the appropriate screen area so that overlay change is visible
273  static sdl::timage empty(image::get_texture("images/misc/blank.png"));
274  SDL_Rect whole = sdl::create_rect(0, 0, overlay_->w, overlay_->h);
275  SDL_Rect *r = rect == nullptr ? &whole : rect;
276  empty.set_scale(float(r->w) / empty.base_width(), float(r->h) / empty.base_height());
277  draw_texture(empty, r->x, r->y);
278 }
279 #endif
280 
282 {
283  LOG_DP << "calling SDL_Quit()\n";
284  SDL_Quit();
285  assert(singleton_);
286  singleton_ = nullptr;
287  LOG_DP << "called SDL_Quit()\n";
288 }
289 
290 void CVideo::blit_surface(int x, int y, surface surf, SDL_Rect* srcrect, SDL_Rect* clip_rect)
291 {
293  SDL_Rect dst = sdl::create_rect(x, y, 0, 0);
294 
295  const clip_rect_setter clip_setter(target, clip_rect, clip_rect != nullptr);
296  sdl_blit(surf,srcrect,target,&dst);
297 }
298 
299 #ifdef SDL_GPU
300 GPU_Target *CVideo::render_target() const
301 {
302  return render_target_;
303 }
304 
305 void CVideo::draw_texture(sdl::timage &texture, int x, int y)
306 {
307  texture.draw(*this, x, y);
308 }
309 
310 void CVideo::set_texture_color_modulation(int r, int g, int b, int a)
311 {
312  shader_.set_color_mod(r, g, b, a);
313 }
314 
315 void CVideo::set_texture_submerge(float f)
316 {
317  shader_.set_submerge(f);
318 }
319 
320 void CVideo::set_texture_effects(int effects)
321 {
322  shader_.set_effects(effects);
323 }
324 
325 void CVideo::blit_to_overlay(surface surf, int x, int y)
326 {
327  if (x < 0 || y < 0 || x > overlay_->w || y > overlay_->h) {
328  return;
329  }
330  SDL_Rect r = sdl::create_rect(x, y, surf->w, surf->h);
331  SDL_BlitSurface(surf, nullptr, overlay_, &r);
332  update_overlay(&r);
333 }
334 
335 void CVideo::clear_overlay_area(SDL_Rect area)
336 {
337  const Uint32 color = SDL_MapRGBA(overlay_->format, 0, 0, 0, 0);
338  Uint32 *pixels = static_cast<Uint32*>(overlay_->pixels);
339  for (int x = area.x; x<area.x + area.w; ++x) {
340  for (int y = area.y; y<area.y +area.h; ++y) {
341  const int index = y * (area.w + overlay_->pitch) + x;
342  pixels[index] = color;
343  }
344  }
345  update_overlay(&area);
346 }
347 
348 void CVideo::clear_overlay()
349 {
350  overlay_ = create_compatible_surface(overlay_, getx(), gety());
351  update_overlay();
352 }
353 #endif
354 
356 {
357  fake_screen_ = true;
358  frameBuffer = SDL_CreateRGBSurface(SDL_SWSURFACE,16,16,24,0xFF0000,0xFF00,0xFF,0);
359  image::set_pixel_format(frameBuffer->format);
360 }
361 
362 void CVideo::make_test_fake(const unsigned width,
363  const unsigned height, const unsigned bpp)
364 {
365  frameBuffer = SDL_CreateRGBSurface(SDL_SWSURFACE,
366  width, height, bpp, 0xFF0000, 0xFF00, 0xFF, 0);
367  image::set_pixel_format(frameBuffer->format);
368 
369  fake_interactive = true;
370 
371 }
372 
373 
374 
376 {
377  if (!window)
378  return;
379 
380  surface fb = SDL_GetWindowSurface(*window);
381  if (!frameBuffer)
382  frameBuffer = fb;
383  else
384  frameBuffer.assign(fb);
385 }
386 
387 /**
388  * Creates a new window instance.
389  */
391 {
392  // Position
393  const int x = preferences::fullscreen() ? SDL_WINDOWPOS_UNDEFINED : SDL_WINDOWPOS_CENTERED;
394  const int y = preferences::fullscreen() ? SDL_WINDOWPOS_UNDEFINED : SDL_WINDOWPOS_CENTERED;
395 
396  // Dimensions
397  const int w = preferences::resolution().first;
398  const int h = preferences::resolution().second;
399 
400  // Video flags
401  int video_flags = 0;
402 
403  video_flags = get_flags(video_flags);
404 
405  if (preferences::fullscreen()) {
406  video_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
407  } else if (preferences::maximized()) {
408  video_flags |= SDL_WINDOW_MAXIMIZED;
409  }
410 
411  // Initialize window
412  window.reset(new sdl::twindow("", x, y, w, h, video_flags, SDL_RENDERER_SOFTWARE));
413 
414  std::cerr << "Setting mode to " << w << "x" << h << std::endl;
415 
416  window->set_minimum_size(
419  );
420 
422 
424  if(frameBuffer) {
425  image::set_pixel_format(frameBuffer->format);
426  }
427 
428  return true;
429 }
430 
431 void CVideo::setMode(int x, int y, const MODE_EVENT mode)
432 {
433  assert(window);
434  if (fake_screen_) return;
435  mode_changed_ = true;
436 
437  switch(mode) {
438  case TO_FULLSCREEN:
439  window->full_screen();
440  break;
441 
442  case TO_WINDOWED:
443  window->to_window();
444  window->restore();
445  break;
446 
447  case TO_MAXIMIZED_WINDOW:
448  window->to_window();
449  window->maximize();
450  break;
451 
452  case TO_RES:
453  window->restore();
454  window->set_size(x, y);
455  window->center();
456  break;
457  }
458 
460  if(frameBuffer) {
461  image::set_pixel_format(frameBuffer->format);
462  }
463 }
464 
466 {
467  bool ret = mode_changed_;
468  mode_changed_ = false;
469  return ret;
470 }
471 
472 int CVideo::getx() const
473 {
474 #ifdef SDL_GPU
475  return GPU_GetContextTarget()->w;
476 #else
477  return frameBuffer->w;
478 #endif
479 }
480 
481 int CVideo::gety() const
482 {
483 #ifdef SDL_GPU
484  return GPU_GetContextTarget()->h;
485 #else
486  return frameBuffer->h;
487 #endif
488 }
489 
490 void CVideo::delay(unsigned int milliseconds)
491 {
493  SDL_Delay(milliseconds);
494 }
495 
497 {
498  if(fake_screen_)
499  return;
500 #ifdef SDL_GPU
501  assert(render_target_);
502  GPU_Flip(render_target_);
503 #else
504  if (window)
505  window->render();
506 #endif
507 }
508 
510 {
511  if(value == true)
512  ++updatesLocked_;
513  else
514  --updatesLocked_;
515 }
516 
518 {
519  return updatesLocked_ > 0;
520 }
521 
523 {
524  Uint8 state = 0;
525  Uint32 flags = 0;
526 
527  if(!window) {
528  return state;
529  }
530 
531  flags = SDL_GetWindowFlags(*window);
532  if ((flags & SDL_WINDOW_SHOWN) && !(flags & SDL_WINDOW_MINIMIZED)) {
533  state |= SDL_APPACTIVE;
534  }
535  if (flags & SDL_WINDOW_INPUT_FOCUS) {
536  state |= SDL_APPINPUTFOCUS;
537  }
538  if (flags & SDL_WINDOW_MOUSE_FOCUS) {
539  state |= SDL_APPMOUSEFOCUS;
540  }
541  if (flags & SDL_WINDOW_MAXIMIZED) {
542  state |= SDL_WINDOW_MAXIMIZED;
543  }
544  if (flags & SDL_WINDOW_FULLSCREEN_DESKTOP) {
545  state |= SDL_WINDOW_FULLSCREEN_DESKTOP;
546  }
547  return state;
548 }
549 
551 {
552  assert(window);
553  window->set_title(title);
554 }
555 
557 {
558  assert(window);
559  window->set_icon(icon);
560 }
561 
563 {
564  return window.get();
565 }
566 
567 
568 static int sdl_display_index(sdl::twindow* window)
569 {
570  if(window) {
571  return SDL_GetWindowDisplayIndex(*window);
572  }
573  return 0;
574 }
575 
576 std::vector<std::pair<int, int> > CVideo::get_available_resolutions(const bool include_current)
577 {
578  std::vector<std::pair<int, int> > result;
579 
580  const int modes = SDL_GetNumDisplayModes(sdl_display_index(window.get()));
581  if (modes <= 0) {
582  std::cerr << "No modes supported\n";
583  return result;
584  }
585 
586  const std::pair<int,int> min_res = std::make_pair(preferences::min_allowed_width(),preferences::min_allowed_height());
587 
588  SDL_DisplayMode mode;
589  for (int i = 0; i < modes; ++i) {
590  if(SDL_GetDisplayMode(0, i, &mode) == 0) {
591  if (mode.w >= min_res.first && mode.h >= min_res.second)
592  result.push_back(std::make_pair(mode.w, mode.h));
593  }
594  }
595 
596  if (std::find(result.begin(), result.end(), min_res) == result.end()) {
597  result.push_back(min_res);
598  }
599 
600  if(include_current) {
601  result.push_back(current_resolution());
602  }
603 
604  std::sort(result.begin(), result.end());
605  result.erase(std::unique(result.begin(), result.end()), result.end());
606 
607  return result;
608 }
609 
611 {
612  return frameBuffer;
613 }
614 
615 std::pair<int,int> CVideo::current_resolution()
616 {
617  return std::make_pair(getSurface()->w, getSurface()->h);
618 }
619 
620 bool CVideo::isFullScreen() const {
621  return (window->get_flags() & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
622 }
623 
624 
626 {
628 
629  const SDL_Color color = { 0, 0, 0, 0xbb };
630 
631  int size = font::SIZE_LARGE;
632 
633  while(size > 0) {
634  if(font::line_width(str, size) > getx()) {
635  size--;
636  } else {
637  break;
638  }
639  }
640 
641  const int border = 5;
642 
643  font::floating_label flabel(str);
644  flabel.set_font_size(size);
645  flabel.set_position(getx()/2, gety());
646  flabel.set_bg_color(color);
647  flabel.set_border_size(border);
648 
650 
651  const SDL_Rect& rect = font::get_floating_label_rect(help_string_);
652  font::move_floating_label(help_string_,0.0,-double(rect.h));
653  return help_string_;
654 }
655 
657 {
658  if(handle == help_string_) {
660  help_string_ = 0;
661  }
662 }
663 
665 {
667 }
668 
669 
670 void CVideo::set_fullscreen(bool ison)
671 {
672 
673  if (window && isFullScreen() != ison) {
674 
675  const std::pair<int,int>& res = preferences::resolution();
676 
678 
679  if (ison) {
680  mode = TO_FULLSCREEN;
681  } else {
683  }
684 
685  setMode(res.first, res.second, mode);
686 
687  if (display::get_singleton()) {
689  }
690  }
691 
692  // Change the config value.
694 }
695 
696 void CVideo::set_resolution(const std::pair<int,int>& resolution)
697 {
698  set_resolution(resolution.first, resolution.second);
699 }
700 
701 void CVideo::set_resolution(const unsigned width, const unsigned height)
702 {
703  if (static_cast<unsigned int> (current_resolution().first) == width &&
704  static_cast<unsigned int> (current_resolution().second) == height) {
705 
706  return;
707  }
708 
709  setMode(width, height, TO_RES);
710 
711  if(display::get_singleton()) {
713  }
714 
715  // Change the config values.
716  preferences::_set_resolution(std::make_pair(width, height));
718 }
void set_window_icon(surface &icon)
Sets the icon of the main window.
Definition: video.cpp:556
surface & get_video_surface()
Definition: video.cpp:130
void _set_fullscreen(bool ison)
std::list< events::sdl_handler * > draw_layers
Definition: video.cpp:73
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: glew.h:1222
draw_layering(const bool auto_join=true)
Definition: video.cpp:75
void _set_resolution(const std::pair< int, int > &res)
static display * get_singleton()
Returns the display object if a display object exists.
Definition: display.hpp:88
void set_pixel_format(SDL_PixelFormat *format)
sets the pixel format used by the images.
Definition: image.cpp:666
void _set_maximized(bool ison)
static unsigned int get_flags(unsigned int flags)
Definition: video.cpp:52
std::pair< int, int > current_resolution()
Definition: video.cpp:615
void set_resolution(const std::pair< int, int > &res)
Set the resolution.
Definition: video.cpp:696
FAKE_TYPES
Definition: video.hpp:60
#define ERR_DP
Definition: video.cpp:42
#define LOG_DP
Definition: video.cpp:41
void set_bg_color(const SDL_Color &bg_color)
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
static l_noret error(LoadState *S, const char *why)
Definition: lundump.cpp:29
int help_string_
Definition: video.hpp:242
Definition: video.hpp:58
static int sdl_display_index(sdl::twindow *window)
Definition: video.cpp:568
void flip()
Definition: video.cpp:496
void lock_updates(bool value)
Definition: video.cpp:509
GPU_Target * GPU_Init(Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
Definition: SDL_gpu.c:325
void remove_floating_label(int handle)
removes the floating label given by 'handle' from the screen
void redraw_everything()
Invalidates entire screen, including all tiles and sidebar.
Definition: display.cpp:2650
GPU_Target * GPU_GetContextTarget(void)
Definition: SDL_gpu.c:882
static CVideo * singleton_
Definition: video.hpp:213
std::vector< std::pair< int, int > > get_available_resolutions(const bool include_current=false)
Returns the list of available screen resolutions.
Definition: video.cpp:576
GLenum GLenum GLuint texture
Definition: glew.h:3453
MODE_EVENT
Definition: video.hpp:66
GLboolean GLboolean g
Definition: glew.h:7319
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
void set_font_size(int font_size)
void blit_surface(int x, int y, surface surf, SDL_Rect *srcrect=nullptr, SDL_Rect *clip_rect=nullptr)
Definition: video.cpp:290
sdl::twindow * get_window()
Definition: video.cpp:562
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
Definition: glew.h:1347
GLenum mode
Definition: glew.h:2390
-file util.hpp
~CVideo()
Definition: video.cpp:281
#define GPU_DEFAULT_INIT_FLAGS
Definition: SDL_gpu.h:351
Uint16 h
Definition: SDL_gpu.h:291
surface & getSurface()
Definition: dummy_video.cpp:22
bool maximized()
void move_floating_label(int handle, double xmove, double ymove)
moves the floating label given by 'handle' by (xmove,ymove)
virtual ~draw_layering()
Definition: video.cpp:81
SDL_Rect screen_area()
Definition: video.cpp:135
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
void setMode(int x, int y, const MODE_EVENT mode)
Definition: video.cpp:431
void set_window_title(const std::string &title)
Sets the title of the main window.
Definition: video.cpp:550
void make_fake()
Definition: video.cpp:355
boost::scoped_ptr< sdl::twindow > window
Definition: video.hpp:215
void initSDL()
Definition: video.cpp:241
GLuint64EXT * result
Definition: glew.h:10727
The wrapper class for the SDL_Window class.
Definition: window.hpp:52
#define SDL_APPINPUTFOCUS
The app has input focus.
Definition: video.hpp:39
Uint8 window_state()
Wrapper for SDL_GetAppState.
Definition: video.cpp:522
void GPU_Flip(GPU_Target *target)
Definition: SDL_gpu.c:2183
int gety() const
Definition: video.cpp:481
bool isFullScreen() const
Definition: video.cpp:620
bool fullscreen()
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1858
GLsizei const GLfloat * value
Definition: glew.h:1817
GLenum GLenum dst
Definition: glew.h:2392
static lg::log_domain log_display("display")
bool init_window()
Initializes a new window, taking into account any preiously saved states.
Definition: video.cpp:390
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:7319
std::pair< int, int > resolution()
std::string path
void set_position(double xpos, double ypos)
map_display and display: classes which take care of displaying the map and game-data on the screen...
int updatesLocked_
Definition: video.hpp:244
Uint16 w
Definition: SDL_gpu.h:291
surf
Definition: filter.cpp:143
cl_event GLbitfield flags
Definition: glew.h:3070
GLuint color
Definition: glew.h:5801
bool non_interactive()
Definition: video.cpp:115
#define DRAW_ALL_EVENT
Definition: events.hpp:29
Definition: video.cpp:71
GLuint res
Definition: glew.h:9258
#define SDL_APPMOUSEFOCUS
The app has mouse coverage.
Definition: video.hpp:38
#define SDL_APPACTIVE
The application is active.
Definition: video.hpp:40
virtual void handle_window_event(const SDL_Event &event)
Definition: video.cpp:186
int getx() const
Definition: video.cpp:472
bool update_locked() const
Definition: video.cpp:517
GLuint index
Definition: glew.h:1782
bool mode_changed_
Definition: video.hpp:233
GLfloat GLfloat GLfloat GLfloat h
Definition: glew.h:5910
size_t i
Definition: function.cpp:1057
int add_floating_label(const floating_label &flabel)
add a label floating on the screen above everything else.
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
void set_fullscreen(bool ison)
Definition: video.cpp:670
SDL_Rect get_floating_label_rect(int handle)
GLdouble GLdouble GLdouble r
Definition: glew.h:1374
CVideo(FAKE_TYPES type=NO_FAKE)
Definition: video.cpp:215
static int sort(lua_State *L)
Definition: ltablib.cpp:246
void set_border_size(int border)
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
Definition: glew.h:1220
int set_help_string(const std::string &str)
Definition: video.cpp:625
const int SIZE_LARGE
Definition: font.hpp:66
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: glew.h:1222
SDL_Rect create_rect(const int x, const int y, const int w, const int h)
Creates an empty SDL_Rect.
Definition: rect.cpp:28
GLsizeiptr size
Definition: glew.h:1649
int min_allowed_width()
Contains the SDL_Rect helper code.
bool find(E event, F functor)
Tests whether an event handler is available.
cl_event event
Definition: glew.h:3070
void trigger_full_redraw()
Definition: video.cpp:88
GLint GLvoid * img
Definition: glew.h:1353
Standard logging facilities (interface).
video_event_handler event_handler_
Definition: video.hpp:239
void assign(const surface &o)
Definition: utils.hpp:83
surface create_compatible_surface(const surface &surf, int width, int height)
Definition: utils.cpp:2166
void make_test_fake(const unsigned width=1024, const unsigned height=768, const unsigned bpp=DefaultBpp)
Creates a fake frame buffer for the unit tests.
Definition: video.cpp:362
GLint * first
Definition: glew.h:1496
void clear_all_help_strings()
Definition: video.cpp:664
static void delay(unsigned int milliseconds)
Definition: video.cpp:490
Contains a wrapper class for the SDL_Window class.
bool fake_screen_
Definition: video.hpp:237
int min_allowed_height()
GLint GLint GLint GLint GLint GLint GLsizei width
Definition: glew.h:1220
void update_framebuffer()
Definition: video.cpp:375
void sdl_blit(const surface &src, SDL_Rect *src_rect, surface &dst, SDL_Rect *dst_rect)
Definition: utils.hpp:112
std::string::const_iterator iterator
Definition: tokenizer.hpp:21
GLsizei const GLcharARB ** string
Definition: glew.h:4503
virtual void join_global()
Definition: events.cpp:230
int line_width(const std::string &line, int font_size, int style)
Determine the width of a line of text given a certain font size.
Definition: font.cpp:969
GLenum target
Definition: glew.h:5190
void clear_help_string(int handle)
Definition: video.cpp:656
boost::shared_ptr< halo_record > handle
Definition: halo.hpp:34
bool modeChanged()
Definition: video.cpp:465
void update_rect(size_t x, size_t y, size_t w, size_t h)
Definition: video.cpp:140
GLclampf f
Definition: glew.h:3024