OpenTTD
allegro_v.cpp
Go to the documentation of this file.
1 /* $Id$ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
17 #ifdef WITH_ALLEGRO
18 
19 #include "../stdafx.h"
20 #include "../openttd.h"
21 #include "../gfx_func.h"
22 #include "../rev.h"
23 #include "../blitter/factory.hpp"
24 #include "../network/network.h"
25 #include "../core/random_func.hpp"
26 #include "../core/math_func.hpp"
27 #include "../framerate_type.h"
28 #include "allegro_v.h"
29 #include <allegro.h>
30 
31 #include "../safeguards.h"
32 
33 #ifdef _DEBUG
34 /* Allegro replaces SEGV/ABRT signals meaning that the debugger will never
35  * be triggered, so rereplace the signals and make the debugger useful. */
36 #include <signal.h>
37 #endif
38 
39 static FVideoDriver_Allegro iFVideoDriver_Allegro;
40 
41 static BITMAP *_allegro_screen;
42 
43 #define MAX_DIRTY_RECTS 100
44 static PointDimension _dirty_rects[MAX_DIRTY_RECTS];
45 static int _num_dirty_rects;
46 
47 void VideoDriver_Allegro::MakeDirty(int left, int top, int width, int height)
48 {
49  if (_num_dirty_rects < MAX_DIRTY_RECTS) {
50  _dirty_rects[_num_dirty_rects].x = left;
51  _dirty_rects[_num_dirty_rects].y = top;
52  _dirty_rects[_num_dirty_rects].width = width;
53  _dirty_rects[_num_dirty_rects].height = height;
54  }
55  _num_dirty_rects++;
56 }
57 
58 static void DrawSurfaceToScreen()
59 {
60  PerformanceMeasurer framerate(PFE_VIDEO);
61 
62  int n = _num_dirty_rects;
63  if (n == 0) return;
64 
65  _num_dirty_rects = 0;
66  if (n > MAX_DIRTY_RECTS) {
67  blit(_allegro_screen, screen, 0, 0, 0, 0, _allegro_screen->w, _allegro_screen->h);
68  return;
69  }
70 
71  for (int i = 0; i < n; i++) {
72  blit(_allegro_screen, screen, _dirty_rects[i].x, _dirty_rects[i].y, _dirty_rects[i].x, _dirty_rects[i].y, _dirty_rects[i].width, _dirty_rects[i].height);
73  }
74 }
75 
76 
77 static void UpdatePalette(uint start, uint count)
78 {
79  static PALETTE pal;
80 
81  uint end = start + count;
82  for (uint i = start; i != end; i++) {
83  pal[i].r = _cur_palette.palette[i].r / 4;
84  pal[i].g = _cur_palette.palette[i].g / 4;
85  pal[i].b = _cur_palette.palette[i].b / 4;
86  pal[i].filler = 0;
87  }
88 
89  set_palette_range(pal, start, end - 1, 1);
90 }
91 
92 static void InitPalette()
93 {
94  UpdatePalette(0, 256);
95 }
96 
97 static void CheckPaletteAnim()
98 {
99  if (_cur_palette.count_dirty != 0) {
101 
102  switch (blitter->UsePaletteAnimation()) {
105  break;
106 
108  blitter->PaletteAnimate(_cur_palette);
109  break;
110 
112  break;
113 
114  default:
115  NOT_REACHED();
116  }
118  }
119 }
120 
121 static const Dimension default_resolutions[] = {
122  { 640, 480},
123  { 800, 600},
124  {1024, 768},
125  {1152, 864},
126  {1280, 800},
127  {1280, 960},
128  {1280, 1024},
129  {1400, 1050},
130  {1600, 1200},
131  {1680, 1050},
132  {1920, 1200}
133 };
134 
135 static void GetVideoModes()
136 {
137  /* Need to set a gfx_mode as there is NO other way to autodetect for
138  * cards ourselves... and we need a card to get the modes. */
139  set_gfx_mode(_fullscreen ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
140 
141  GFX_MODE_LIST *mode_list = get_gfx_mode_list(gfx_driver->id);
142  if (mode_list == NULL) {
143  memcpy(_resolutions, default_resolutions, sizeof(default_resolutions));
144  _num_resolutions = lengthof(default_resolutions);
145  return;
146  }
147 
148  GFX_MODE *modes = mode_list->mode;
149 
150  int n = 0;
151  for (int i = 0; modes[i].bpp != 0; i++) {
152  uint w = modes[i].width;
153  uint h = modes[i].height;
154  if (w >= 640 && h >= 480) {
155  int j;
156  for (j = 0; j < n; j++) {
157  if (_resolutions[j].width == w && _resolutions[j].height == h) break;
158  }
159 
160  if (j == n) {
161  _resolutions[j].width = w;
162  _resolutions[j].height = h;
163  if (++n == lengthof(_resolutions)) break;
164  }
165  }
166  }
167  _num_resolutions = n;
168  SortResolutions(_num_resolutions);
169 
170  destroy_gfx_mode_list(mode_list);
171 }
172 
173 static void GetAvailableVideoMode(uint *w, uint *h)
174 {
175  /* No video modes, so just try it and see where it ends */
176  if (_num_resolutions == 0) return;
177 
178  /* is the wanted mode among the available modes? */
179  for (int i = 0; i != _num_resolutions; i++) {
180  if (*w == _resolutions[i].width && *h == _resolutions[i].height) return;
181  }
182 
183  /* use the closest possible resolution */
184  int best = 0;
185  uint delta = Delta(_resolutions[0].width, *w) * Delta(_resolutions[0].height, *h);
186  for (int i = 1; i != _num_resolutions; ++i) {
187  uint newdelta = Delta(_resolutions[i].width, *w) * Delta(_resolutions[i].height, *h);
188  if (newdelta < delta) {
189  best = i;
190  delta = newdelta;
191  }
192  }
193  *w = _resolutions[best].width;
194  *h = _resolutions[best].height;
195 }
196 
197 static bool CreateMainSurface(uint w, uint h)
198 {
200  if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
201  set_color_depth(bpp);
202 
203  GetAvailableVideoMode(&w, &h);
204  if (set_gfx_mode(_fullscreen ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, w, h, 0, 0) != 0) {
205  DEBUG(driver, 0, "Allegro: Couldn't allocate a window to draw on '%s'", allegro_error);
206  return false;
207  }
208 
209  /* The size of the screen might be bigger than the part we can actually draw on!
210  * So calculate the size based on the top, bottom, left and right */
211  _allegro_screen = create_bitmap_ex(bpp, screen->cr - screen->cl, screen->cb - screen->ct);
212  _screen.width = _allegro_screen->w;
213  _screen.height = _allegro_screen->h;
214  _screen.pitch = ((byte*)screen->line[1] - (byte*)screen->line[0]) / (bpp / 8);
215  _screen.dst_ptr = _allegro_screen->line[0];
216 
217  /* Initialise the screen so we don't blit garbage to the screen */
218  memset(_screen.dst_ptr, 0, _screen.height * _screen.pitch);
219 
220  /* Set the mouse at the place where we expect it */
221  poll_mouse();
222  _cursor.pos.x = mouse_x;
223  _cursor.pos.y = mouse_y;
224 
226 
227  InitPalette();
228 
229  char caption[32];
230  seprintf(caption, lastof(caption), "OpenTTD %s", _openttd_revision);
231  set_window_title(caption);
232 
233  enable_hardware_cursor();
234  select_mouse_cursor(MOUSE_CURSOR_ARROW);
235  show_mouse(_allegro_screen);
236 
237  GameSizeChanged();
238 
239  return true;
240 }
241 
242 bool VideoDriver_Allegro::ClaimMousePointer()
243 {
244  select_mouse_cursor(MOUSE_CURSOR_NONE);
245  show_mouse(NULL);
246  disable_hardware_cursor();
247  return true;
248 }
249 
250 struct VkMapping {
251  uint16 vk_from;
252  byte vk_count;
253  byte map_to;
254 };
255 
256 #define AS(x, z) {x, 0, z}
257 #define AM(x, y, z, w) {x, y - x, z}
258 
259 static const VkMapping _vk_mapping[] = {
260  /* Pageup stuff + up/down */
261  AM(KEY_PGUP, KEY_PGDN, WKC_PAGEUP, WKC_PAGEDOWN),
262  AS(KEY_UP, WKC_UP),
263  AS(KEY_DOWN, WKC_DOWN),
264  AS(KEY_LEFT, WKC_LEFT),
265  AS(KEY_RIGHT, WKC_RIGHT),
266 
267  AS(KEY_HOME, WKC_HOME),
268  AS(KEY_END, WKC_END),
269 
270  AS(KEY_INSERT, WKC_INSERT),
271  AS(KEY_DEL, WKC_DELETE),
272 
273  /* Map letters & digits */
274  AM(KEY_A, KEY_Z, 'A', 'Z'),
275  AM(KEY_0, KEY_9, '0', '9'),
276 
277  AS(KEY_ESC, WKC_ESC),
278  AS(KEY_PAUSE, WKC_PAUSE),
279  AS(KEY_BACKSPACE, WKC_BACKSPACE),
280 
281  AS(KEY_SPACE, WKC_SPACE),
282  AS(KEY_ENTER, WKC_RETURN),
283  AS(KEY_TAB, WKC_TAB),
284 
285  /* Function keys */
286  AM(KEY_F1, KEY_F12, WKC_F1, WKC_F12),
287 
288  /* Numeric part. */
289  AM(KEY_0_PAD, KEY_9_PAD, '0', '9'),
290  AS(KEY_SLASH_PAD, WKC_NUM_DIV),
291  AS(KEY_ASTERISK, WKC_NUM_MUL),
292  AS(KEY_MINUS_PAD, WKC_NUM_MINUS),
293  AS(KEY_PLUS_PAD, WKC_NUM_PLUS),
294  AS(KEY_ENTER_PAD, WKC_NUM_ENTER),
295  AS(KEY_DEL_PAD, WKC_DELETE),
296 
297  /* Other non-letter keys */
298  AS(KEY_SLASH, WKC_SLASH),
299  AS(KEY_SEMICOLON, WKC_SEMICOLON),
300  AS(KEY_EQUALS, WKC_EQUALS),
301  AS(KEY_OPENBRACE, WKC_L_BRACKET),
302  AS(KEY_BACKSLASH, WKC_BACKSLASH),
303  AS(KEY_CLOSEBRACE, WKC_R_BRACKET),
304 
305  AS(KEY_QUOTE, WKC_SINGLEQUOTE),
306  AS(KEY_COMMA, WKC_COMMA),
307  AS(KEY_MINUS, WKC_MINUS),
308  AS(KEY_STOP, WKC_PERIOD),
309  AS(KEY_TILDE, WKC_BACKQUOTE),
310 };
311 
312 static uint32 ConvertAllegroKeyIntoMy(WChar *character)
313 {
314  int scancode;
315  int unicode = ureadkey(&scancode);
316 
317  const VkMapping *map;
318  uint key = 0;
319 
320  for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
321  if ((uint)(scancode - map->vk_from) <= map->vk_count) {
322  key = scancode - map->vk_from + map->map_to;
323  break;
324  }
325  }
326 
327  if (key_shifts & KB_SHIFT_FLAG) key |= WKC_SHIFT;
328  if (key_shifts & KB_CTRL_FLAG) key |= WKC_CTRL;
329  if (key_shifts & KB_ALT_FLAG) key |= WKC_ALT;
330 #if 0
331  DEBUG(driver, 0, "Scancode character pressed %u", scancode);
332  DEBUG(driver, 0, "Unicode character pressed %u", unicode);
333 #endif
334 
335  *character = unicode;
336  return key;
337 }
338 
339 static const uint LEFT_BUTTON = 0;
340 static const uint RIGHT_BUTTON = 1;
341 
342 static void PollEvent()
343 {
344  poll_mouse();
345 
346  bool mouse_action = false;
347 
348  /* Mouse buttons */
349  static int prev_button_state;
350  if (prev_button_state != mouse_b) {
351  uint diff = prev_button_state ^ mouse_b;
352  while (diff != 0) {
353  uint button = FindFirstBit(diff);
354  ClrBit(diff, button);
355  if (HasBit(mouse_b, button)) {
356  /* Pressed mouse button */
357  if (_rightclick_emulate && (key_shifts & KB_CTRL_FLAG)) {
358  button = RIGHT_BUTTON;
359  ClrBit(diff, RIGHT_BUTTON);
360  }
361  switch (button) {
362  case LEFT_BUTTON:
363  _left_button_down = true;
364  break;
365 
366  case RIGHT_BUTTON:
367  _right_button_down = true;
368  _right_button_clicked = true;
369  break;
370 
371  default:
372  /* ignore rest */
373  break;
374  }
375  } else {
376  /* Released mouse button */
377  if (_rightclick_emulate) {
378  _right_button_down = false;
379  _left_button_down = false;
380  _left_button_clicked = false;
381  } else if (button == LEFT_BUTTON) {
382  _left_button_down = false;
383  _left_button_clicked = false;
384  } else if (button == RIGHT_BUTTON) {
385  _right_button_down = false;
386  }
387  }
388  }
389  prev_button_state = mouse_b;
390  mouse_action = true;
391  }
392 
393  /* Mouse movement */
394  if (_cursor.UpdateCursorPosition(mouse_x, mouse_y, false)) {
395  position_mouse(_cursor.pos.x, _cursor.pos.y);
396  }
397  if (_cursor.delta.x != 0 || _cursor.delta.y) mouse_action = true;
398 
399  static int prev_mouse_z = 0;
400  if (prev_mouse_z != mouse_z) {
401  _cursor.wheel = (prev_mouse_z - mouse_z) < 0 ? -1 : 1;
402  prev_mouse_z = mouse_z;
403  mouse_action = true;
404  }
405 
406  if (mouse_action) HandleMouseEvents();
407 
408  poll_keyboard();
409  if ((key_shifts & KB_ALT_FLAG) && (key[KEY_ENTER] || key[KEY_F])) {
410  ToggleFullScreen(!_fullscreen);
411  } else if (keypressed()) {
412  WChar character;
413  uint keycode = ConvertAllegroKeyIntoMy(&character);
414  HandleKeypress(keycode, character);
415  }
416 }
417 
422 int _allegro_instance_count = 0;
423 
424 const char *VideoDriver_Allegro::Start(const char * const *parm)
425 {
426  if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) {
427  DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
428  return "Failed to set up Allegro";
429  }
430  _allegro_instance_count++;
431 
432  install_timer();
433  install_mouse();
434  install_keyboard();
435 
436 #if defined _DEBUG
437 /* Allegro replaces SEGV/ABRT signals meaning that the debugger will never
438  * be triggered, so rereplace the signals and make the debugger useful. */
439  signal(SIGABRT, NULL);
440  signal(SIGSEGV, NULL);
441 #endif
442 
443 #if defined(DOS)
444  /* Force DOS builds to ALWAYS use full screen as
445  * it can't do windowed. */
446  _fullscreen = true;
447 #endif
448 
449  GetVideoModes();
450  if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
451  return "Failed to set up Allegro video";
452  }
454  set_close_button_callback(HandleExitGameRequest);
455 
456  return NULL;
457 }
458 
460 {
461  if (--_allegro_instance_count == 0) allegro_exit();
462 }
463 
464 #if defined(UNIX) || defined(__OS2__) || defined(DOS)
465 # include <sys/time.h> /* gettimeofday */
466 
467 static uint32 GetTime()
468 {
469  struct timeval tim;
470 
471  gettimeofday(&tim, NULL);
472  return tim.tv_usec / 1000 + tim.tv_sec * 1000;
473 }
474 #else
475 static uint32 GetTime()
476 {
477  return GetTickCount();
478 }
479 #endif
480 
481 
483 {
484  uint32 cur_ticks = GetTime();
485  uint32 last_cur_ticks = cur_ticks;
486  uint32 next_tick = cur_ticks + MILLISECONDS_PER_TICK;
487 
488  CheckPaletteAnim();
489 
490  for (;;) {
491  uint32 prev_cur_ticks = cur_ticks; // to check for wrapping
492  InteractiveRandom(); // randomness
493 
494  PollEvent();
495  if (_exit_game) return;
496 
497 #if defined(_DEBUG)
498  if (_shift_pressed)
499 #else
500  /* Speedup when pressing tab, except when using ALT+TAB
501  * to switch to another application */
502  if (key[KEY_TAB] && (key_shifts & KB_ALT_FLAG) == 0)
503 #endif
504  {
505  if (!_networking && _game_mode != GM_MENU) _fast_forward |= 2;
506  } else if (_fast_forward & 2) {
507  _fast_forward = 0;
508  }
509 
510  cur_ticks = GetTime();
511  if (cur_ticks >= next_tick || (_fast_forward && !_pause_mode) || cur_ticks < prev_cur_ticks) {
512  _realtime_tick += cur_ticks - last_cur_ticks;
513  last_cur_ticks = cur_ticks;
514  next_tick = cur_ticks + MILLISECONDS_PER_TICK;
515 
516  bool old_ctrl_pressed = _ctrl_pressed;
517 
518  _ctrl_pressed = !!(key_shifts & KB_CTRL_FLAG);
519  _shift_pressed = !!(key_shifts & KB_SHIFT_FLAG);
520 
521  /* determine which directional keys are down */
522  _dirkeys =
523  (key[KEY_LEFT] ? 1 : 0) |
524  (key[KEY_UP] ? 2 : 0) |
525  (key[KEY_RIGHT] ? 4 : 0) |
526  (key[KEY_DOWN] ? 8 : 0);
527 
528  if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
529 
530  GameLoop();
531 
532  UpdateWindows();
533  CheckPaletteAnim();
534  DrawSurfaceToScreen();
535  } else {
536  CSleep(1);
538  DrawMouseCursor();
539  DrawSurfaceToScreen();
540  }
541  }
542 }
543 
544 bool VideoDriver_Allegro::ChangeResolution(int w, int h)
545 {
546  return CreateMainSurface(w, h);
547 }
548 
549 bool VideoDriver_Allegro::ToggleFullscreen(bool fullscreen)
550 {
551 #ifdef DOS
552  return false;
553 #else
554  _fullscreen = fullscreen;
555  GetVideoModes(); // get the list of available video modes
556  if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution.width, _cur_resolution.height)) {
557  /* switching resolution failed, put back full_screen to original status */
558  _fullscreen ^= true;
559  return false;
560  }
561  return true;
562 #endif
563 }
564 
566 {
567  return CreateMainSurface(_screen.width, _screen.height);
568 }
569 
570 #endif /* WITH_ALLEGRO */
bool _networking
are we in networking mode?
Definition: network.cpp:56
void MakeDirty(int left, int top, int width, int height)
Mark a particular area dirty.
uint32 _realtime_tick
The real time in the game.
Definition: debug.cpp:52
Point pos
logical mouse position
Definition: gfx_type.h:119
bool ChangeResolution(int w, int h)
Change the resolution of the window.
Factory for the allegro video driver.
Definition: allegro_v.h:40
, Comma
Definition: gfx_type.h:104
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
Definition: string.cpp:409
bool _right_button_down
Is right mouse button pressed?
Definition: gfx.cpp:41
Colour palette[256]
Current palette. Entry 0 has to be always fully transparent!
Definition: gfx_type.h:310
void MainLoop()
Perform the actual drawing.
= Equals
Definition: gfx_type.h:99
Dimension _cur_resolution
The current resolution.
Definition: driver.cpp:24
int _num_resolutions
The number of resolutions.
Definition: driver.cpp:22
#define lastof(x)
Get the last element of an fixed size array.
Definition: depend.cpp:50
No palette animation.
Definition: base.hpp:52
How all blitters should look like.
Definition: base.hpp:30
RAII class for measuring simple elements of performance.
virtual void PostResize()
Post resize event.
Definition: base.hpp:203
Palette animation should be done by video backend (8bpp only!)
Definition: base.hpp:53
bool _left_button_clicked
Is left mouse button clicked?
Definition: gfx.cpp:40
Base of the Allegro video driver.
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:36
&#39; Single quote
Definition: gfx_type.h:103
bool _right_button_clicked
Is right mouse button clicked?
Definition: gfx.cpp:42
The blitter takes care of the palette animation.
Definition: base.hpp:54
virtual void PaletteAnimate(const Palette &palette)=0
Called when the 8bpp palette is changed; you should redraw all pixels on the screen that are equal to...
bool _left_button_down
Is left mouse button pressed?
Definition: gfx.cpp:39
[ Left square bracket
Definition: gfx_type.h:100
] Right square bracket
Definition: gfx_type.h:102
\ Backslash
Definition: gfx_type.h:101
void CDECL usererror(const char *s,...)
Error handling for fatal user errors.
Definition: openttd.cpp:92
int wheel
mouse wheel movement
Definition: gfx_type.h:121
bool UpdateCursorPosition(int x, int y, bool queued_warp)
Update cursor position on mouse movement.
Definition: gfx.cpp:1648
bool AfterBlitterChange()
Callback invoked after the blitter was changed.
/ Forward slash
Definition: gfx_type.h:97
static const uint MILLISECONDS_PER_TICK
The number of milliseconds per game tick.
Definition: gfx_type.h:306
void HandleKeypress(uint keycode, WChar key)
Handle keyboard input.
Definition: window.cpp:2654
byte _dirkeys
1 = left, 2 = up, 4 = right, 8 = down
Definition: gfx.cpp:32
void HandleMouseEvents()
Handle a mouse event from the video driver.
Definition: window.cpp:2961
#define lengthof(x)
Return the length of an fixed size array.
Definition: depend.cpp:42
PauseModeByte _pause_mode
The current pause mode.
Definition: gfx.cpp:48
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
Definition: factory.hpp:147
int first_dirty
The first dirty element.
Definition: gfx_type.h:311
bool ToggleFullscreen(bool fullscreen)
Change the full screen setting.
; Semicolon
Definition: gfx_type.h:98
Palette _cur_palette
Current palette.
Definition: gfx.cpp:49
bool _shift_pressed
Is Shift pressed?
Definition: gfx.cpp:37
#define DEBUG(name, level,...)
Output a line of debugging information.
Definition: debug.h:36
uint8 FindFirstBit(uint32 x)
Search the first set bit in a 32 bit variable.
Dimension _resolutions[32]
List of resolutions.
Definition: driver.cpp:23
virtual Blitter::PaletteAnimation UsePaletteAnimation()=0
Check if the blitter uses palette animation at all.
void HandleCtrlChanged()
State of CONTROL key has changed.
Definition: window.cpp:2711
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
void Stop()
Stop this driver.
Specification of a rectangle with an absolute top-left coordinate and a (relative) width/height...
Speed of painting drawn video buffer.
void NetworkDrawChatMessage()
Draw the chat message-box.
#define endof(x)
Get the end element of an fixed size array.
Definition: stdafx.h:412
virtual uint8 GetScreenDepth()=0
Get the screen depth this blitter works for.
const char * Start(const char *const *param)
Start this driver.
#define AS(ap_name, size_x, size_y, min_year, max_year, catchment, noise, maint_cost, ttdpatch_type, class_id, name, preview)
AirportSpec definition for airports with at least one depot.
bool _rightclick_emulate
Whether right clicking is emulated.
Definition: driver.cpp:25
void GameSizeChanged()
Size of the application screen changed.
Definition: main_gui.cpp:606
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
. Period
Definition: gfx_type.h:105
Point delta
relative mouse movement in this tick
Definition: gfx_type.h:120
int count_dirty
The number of dirty elements.
Definition: gfx_type.h:312
static T Delta(const T a, const T b)
Returns the (absolute) difference between two (scalar) variables.
Definition: math_func.hpp:232
uint32 WChar
Type for wide characters, i.e.
Definition: string_type.h:35
Dimensions (a width and height) of a rectangle in 2D.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1463
void UpdateWindows()
Update the continuously changing contents of the windows, such as the viewports.
Definition: window.cpp:3112