OpenTTD Source  1.11.0-beta2
allegro_v.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
15 #ifdef WITH_ALLEGRO
16 
17 #include "../stdafx.h"
18 #include "../openttd.h"
19 #include "../gfx_func.h"
20 #include "../rev.h"
21 #include "../blitter/factory.hpp"
22 #include "../core/random_func.hpp"
23 #include "../core/math_func.hpp"
24 #include "../framerate_type.h"
25 #include "../progress.h"
26 #include "../thread.h"
27 #include "../window_func.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 
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 
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  _resolutions.clear();
142 
143  GFX_MODE_LIST *mode_list = get_gfx_mode_list(gfx_driver->id);
144  if (mode_list == nullptr) {
145  _resolutions.assign(std::begin(default_resolutions), std::end(default_resolutions));
146  return;
147  }
148 
149  GFX_MODE *modes = mode_list->mode;
150 
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) continue;
155  if (std::find(_resolutions.begin(), _resolutions.end(), Dimension(w, h)) != _resolutions.end()) continue;
156  _resolutions.emplace_back(w, h);
157  }
158 
159  SortResolutions();
160 
161  destroy_gfx_mode_list(mode_list);
162 }
163 
164 static void GetAvailableVideoMode(uint *w, uint *h)
165 {
166  /* No video modes, so just try it and see where it ends */
167  if (_resolutions.empty()) return;
168 
169  /* is the wanted mode among the available modes? */
170  if (std::find(_resolutions.begin(), _resolutions.end(), Dimension(*w, *h)) != _resolutions.end()) return;
171 
172  /* use the closest possible resolution */
173  uint best = 0;
174  uint delta = Delta(_resolutions[0].width, *w) * Delta(_resolutions[0].height, *h);
175  for (uint i = 1; i != _resolutions.size(); ++i) {
176  uint newdelta = Delta(_resolutions[i].width, *w) * Delta(_resolutions[i].height, *h);
177  if (newdelta < delta) {
178  best = i;
179  delta = newdelta;
180  }
181  }
182  *w = _resolutions[best].width;
183  *h = _resolutions[best].height;
184 }
185 
186 static bool CreateMainSurface(uint w, uint h)
187 {
189  if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
190  set_color_depth(bpp);
191 
192  GetAvailableVideoMode(&w, &h);
193  if (set_gfx_mode(_fullscreen ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, w, h, 0, 0) != 0) {
194  DEBUG(driver, 0, "Allegro: Couldn't allocate a window to draw on '%s'", allegro_error);
195  return false;
196  }
197 
198  /* The size of the screen might be bigger than the part we can actually draw on!
199  * So calculate the size based on the top, bottom, left and right */
200  _allegro_screen = create_bitmap_ex(bpp, screen->cr - screen->cl, screen->cb - screen->ct);
201  _screen.width = _allegro_screen->w;
202  _screen.height = _allegro_screen->h;
203  _screen.pitch = ((byte*)screen->line[1] - (byte*)screen->line[0]) / (bpp / 8);
204  _screen.dst_ptr = _allegro_screen->line[0];
205 
206  /* Initialise the screen so we don't blit garbage to the screen */
207  memset(_screen.dst_ptr, 0, _screen.height * _screen.pitch);
208 
209  /* Set the mouse at the place where we expect it */
210  poll_mouse();
211  _cursor.pos.x = mouse_x;
212  _cursor.pos.y = mouse_y;
213 
215 
216  InitPalette();
217 
218  char caption[32];
219  seprintf(caption, lastof(caption), "OpenTTD %s", _openttd_revision);
220  set_window_title(caption);
221 
222  enable_hardware_cursor();
223  select_mouse_cursor(MOUSE_CURSOR_ARROW);
224  show_mouse(_allegro_screen);
225 
226  GameSizeChanged();
227 
228  return true;
229 }
230 
231 bool VideoDriver_Allegro::ClaimMousePointer()
232 {
233  select_mouse_cursor(MOUSE_CURSOR_NONE);
234  show_mouse(nullptr);
235  disable_hardware_cursor();
236  return true;
237 }
238 
239 struct AllegroVkMapping {
240  uint16 vk_from;
241  byte vk_count;
242  byte map_to;
243 };
244 
245 #define AS(x, z) {x, 0, z}
246 #define AM(x, y, z, w) {x, y - x, z}
247 
248 static const AllegroVkMapping _vk_mapping[] = {
249  /* Pageup stuff + up/down */
250  AM(KEY_PGUP, KEY_PGDN, WKC_PAGEUP, WKC_PAGEDOWN),
251  AS(KEY_UP, WKC_UP),
252  AS(KEY_DOWN, WKC_DOWN),
253  AS(KEY_LEFT, WKC_LEFT),
254  AS(KEY_RIGHT, WKC_RIGHT),
255 
256  AS(KEY_HOME, WKC_HOME),
257  AS(KEY_END, WKC_END),
258 
259  AS(KEY_INSERT, WKC_INSERT),
260  AS(KEY_DEL, WKC_DELETE),
261 
262  /* Map letters & digits */
263  AM(KEY_A, KEY_Z, 'A', 'Z'),
264  AM(KEY_0, KEY_9, '0', '9'),
265 
266  AS(KEY_ESC, WKC_ESC),
267  AS(KEY_PAUSE, WKC_PAUSE),
268  AS(KEY_BACKSPACE, WKC_BACKSPACE),
269 
270  AS(KEY_SPACE, WKC_SPACE),
271  AS(KEY_ENTER, WKC_RETURN),
272  AS(KEY_TAB, WKC_TAB),
273 
274  /* Function keys */
275  AM(KEY_F1, KEY_F12, WKC_F1, WKC_F12),
276 
277  /* Numeric part. */
278  AM(KEY_0_PAD, KEY_9_PAD, '0', '9'),
279  AS(KEY_SLASH_PAD, WKC_NUM_DIV),
280  AS(KEY_ASTERISK, WKC_NUM_MUL),
281  AS(KEY_MINUS_PAD, WKC_NUM_MINUS),
282  AS(KEY_PLUS_PAD, WKC_NUM_PLUS),
283  AS(KEY_ENTER_PAD, WKC_NUM_ENTER),
284  AS(KEY_DEL_PAD, WKC_DELETE),
285 
286  /* Other non-letter keys */
287  AS(KEY_SLASH, WKC_SLASH),
288  AS(KEY_SEMICOLON, WKC_SEMICOLON),
289  AS(KEY_EQUALS, WKC_EQUALS),
290  AS(KEY_OPENBRACE, WKC_L_BRACKET),
291  AS(KEY_BACKSLASH, WKC_BACKSLASH),
292  AS(KEY_CLOSEBRACE, WKC_R_BRACKET),
293 
294  AS(KEY_QUOTE, WKC_SINGLEQUOTE),
295  AS(KEY_COMMA, WKC_COMMA),
296  AS(KEY_MINUS, WKC_MINUS),
297  AS(KEY_STOP, WKC_PERIOD),
298  AS(KEY_TILDE, WKC_BACKQUOTE),
299 };
300 
301 static uint32 ConvertAllegroKeyIntoMy(WChar *character)
302 {
303  int scancode;
304  int unicode = ureadkey(&scancode);
305 
306  const AllegroVkMapping *map;
307  uint key = 0;
308 
309  for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
310  if ((uint)(scancode - map->vk_from) <= map->vk_count) {
311  key = scancode - map->vk_from + map->map_to;
312  break;
313  }
314  }
315 
316  if (key_shifts & KB_SHIFT_FLAG) key |= WKC_SHIFT;
317  if (key_shifts & KB_CTRL_FLAG) key |= WKC_CTRL;
318  if (key_shifts & KB_ALT_FLAG) key |= WKC_ALT;
319 #if 0
320  DEBUG(driver, 0, "Scancode character pressed %u", scancode);
321  DEBUG(driver, 0, "Unicode character pressed %u", unicode);
322 #endif
323 
324  *character = unicode;
325  return key;
326 }
327 
328 static const uint LEFT_BUTTON = 0;
329 static const uint RIGHT_BUTTON = 1;
330 
332 {
333  poll_mouse();
334 
335  bool mouse_action = false;
336 
337  /* Mouse buttons */
338  static int prev_button_state;
339  if (prev_button_state != mouse_b) {
340  uint diff = prev_button_state ^ mouse_b;
341  while (diff != 0) {
342  uint button = FindFirstBit(diff);
343  ClrBit(diff, button);
344  if (HasBit(mouse_b, button)) {
345  /* Pressed mouse button */
346  if (_rightclick_emulate && (key_shifts & KB_CTRL_FLAG)) {
347  button = RIGHT_BUTTON;
348  ClrBit(diff, RIGHT_BUTTON);
349  }
350  switch (button) {
351  case LEFT_BUTTON:
352  _left_button_down = true;
353  break;
354 
355  case RIGHT_BUTTON:
356  _right_button_down = true;
357  _right_button_clicked = true;
358  break;
359 
360  default:
361  /* ignore rest */
362  break;
363  }
364  } else {
365  /* Released mouse button */
366  if (_rightclick_emulate) {
367  _right_button_down = false;
368  _left_button_down = false;
369  _left_button_clicked = false;
370  } else if (button == LEFT_BUTTON) {
371  _left_button_down = false;
372  _left_button_clicked = false;
373  } else if (button == RIGHT_BUTTON) {
374  _right_button_down = false;
375  }
376  }
377  }
378  prev_button_state = mouse_b;
379  mouse_action = true;
380  }
381 
382  /* Mouse movement */
383  if (_cursor.UpdateCursorPosition(mouse_x, mouse_y, false)) {
384  position_mouse(_cursor.pos.x, _cursor.pos.y);
385  }
386  if (_cursor.delta.x != 0 || _cursor.delta.y) mouse_action = true;
387 
388  static int prev_mouse_z = 0;
389  if (prev_mouse_z != mouse_z) {
390  _cursor.wheel = (prev_mouse_z - mouse_z) < 0 ? -1 : 1;
391  prev_mouse_z = mouse_z;
392  mouse_action = true;
393  }
394 
395  if (mouse_action) HandleMouseEvents();
396 
397  poll_keyboard();
398  if ((key_shifts & KB_ALT_FLAG) && (key[KEY_ENTER] || key[KEY_F])) {
399  ToggleFullScreen(!_fullscreen);
400  } else if (keypressed()) {
401  WChar character;
402  uint keycode = ConvertAllegroKeyIntoMy(&character);
403  HandleKeypress(keycode, character);
404  }
405 
406  return false;
407 }
408 
413 int _allegro_instance_count = 0;
414 
415 const char *VideoDriver_Allegro::Start(const StringList &parm)
416 {
417  if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) {
418  DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
419  return "Failed to set up Allegro";
420  }
421  _allegro_instance_count++;
422 
423  this->UpdateAutoResolution();
424 
425  install_timer();
426  install_mouse();
427  install_keyboard();
428 
429 #if defined _DEBUG
430 /* Allegro replaces SEGV/ABRT signals meaning that the debugger will never
431  * be triggered, so rereplace the signals and make the debugger useful. */
432  signal(SIGABRT, nullptr);
433  signal(SIGSEGV, nullptr);
434 #endif
435 
436  GetVideoModes();
437  if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
438  return "Failed to set up Allegro video";
439  }
441  set_close_button_callback(HandleExitGameRequest);
442 
443  return nullptr;
444 }
445 
447 {
448  if (--_allegro_instance_count == 0) allegro_exit();
449 }
450 
452 {
453  bool old_ctrl_pressed = _ctrl_pressed;
454 
455  _ctrl_pressed = !!(key_shifts & KB_CTRL_FLAG);
456  _shift_pressed = !!(key_shifts & KB_SHIFT_FLAG);
457 
458 #if defined(_DEBUG)
460 #else
461  /* Speedup when pressing tab, except when using ALT+TAB
462  * to switch to another application. */
463  this->fast_forward_key_pressed = key[KEY_TAB] && (key_shifts & KB_ALT_FLAG) == 0;
464 #endif
465 
466  /* Determine which directional keys are down. */
467  _dirkeys =
468  (key[KEY_LEFT] ? 1 : 0) |
469  (key[KEY_UP] ? 2 : 0) |
470  (key[KEY_RIGHT] ? 4 : 0) |
471  (key[KEY_DOWN] ? 8 : 0);
472 
473  if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
474 }
475 
477 {
478  for (;;) {
479  if (_exit_game) return;
480 
481  if (this->Tick()) {
482  this->Paint();
483  }
484  this->SleepTillNextTick();
485  }
486 }
487 
488 bool VideoDriver_Allegro::ChangeResolution(int w, int h)
489 {
490  return CreateMainSurface(w, h);
491 }
492 
493 bool VideoDriver_Allegro::ToggleFullscreen(bool fullscreen)
494 {
495  _fullscreen = fullscreen;
496  GetVideoModes(); // get the list of available video modes
497  if (_resolutions.empty() || !this->ChangeResolution(_cur_resolution.width, _cur_resolution.height)) {
498  /* switching resolution failed, put back full_screen to original status */
499  _fullscreen ^= true;
500  return false;
501  }
502  return true;
503 }
504 
506 {
507  return CreateMainSurface(_screen.width, _screen.height);
508 }
509 
510 #endif /* WITH_ALLEGRO */
_dirkeys
byte _dirkeys
1 = left, 2 = up, 4 = right, 8 = down
Definition: gfx.cpp:31
WKC_SINGLEQUOTE
@ WKC_SINGLEQUOTE
' Single quote
Definition: gfx_type.h:101
Palette::first_dirty
int first_dirty
The first dirty element.
Definition: gfx_type.h:315
VideoDriver::Tick
bool Tick()
Run the game for a single tick, processing boththe game-tick and draw-tick.
Definition: video_driver.cpp:20
WChar
char32_t WChar
Type for wide characters, i.e.
Definition: string_type.h:35
usererror
void CDECL usererror(const char *s,...)
Error handling for fatal user errors.
Definition: openttd.cpp:100
PFE_VIDEO
@ PFE_VIDEO
Speed of painting drawn video buffer.
Definition: framerate_type.h:59
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
_left_button_down
bool _left_button_down
Is left mouse button pressed?
Definition: gfx.cpp:38
Blitter::UsePaletteAnimation
virtual Blitter::PaletteAnimation UsePaletteAnimation()=0
Check if the blitter uses palette animation at all.
HandleKeypress
void HandleKeypress(uint keycode, WChar key)
Handle keyboard input.
Definition: window.cpp:2681
Blitter
How all blitters should look like.
Definition: base.hpp:28
FVideoDriver_Allegro
Factory for the allegro video driver.
Definition: allegro_v.h:44
Blitter::GetScreenDepth
virtual uint8 GetScreenDepth()=0
Get the screen depth this blitter works for.
VideoDriver_Allegro::AfterBlitterChange
bool AfterBlitterChange() override
Callback invoked after the blitter was changed.
WKC_SLASH
@ WKC_SLASH
/ Forward slash
Definition: gfx_type.h:95
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103
WKC_BACKSLASH
@ WKC_BACKSLASH
\ Backslash
Definition: gfx_type.h:99
PerformanceMeasurer
RAII class for measuring simple elements of performance.
Definition: framerate_type.h:92
ClrBit
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
Definition: bitmath_func.hpp:151
WKC_L_BRACKET
@ WKC_L_BRACKET
[ Left square bracket
Definition: gfx_type.h:98
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:35
AS
#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.
Definition: airport_defaults.h:391
VideoDriver_Allegro::Paint
void Paint() override
Paint the window.
VideoDriver_Allegro::ChangeResolution
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
VideoDriver_Allegro::Start
const char * Start(const StringList &param) override
Start this driver.
VideoDriver_Allegro::InputLoop
void InputLoop() override
Handle input logic, is CTRL pressed, should we fast-forward, etc.
WKC_EQUALS
@ WKC_EQUALS
= Equals
Definition: gfx_type.h:97
HandleMouseEvents
void HandleMouseEvents()
Handle a mouse event from the video driver.
Definition: window.cpp:2989
CursorVars::UpdateCursorPosition
bool UpdateCursorPosition(int x, int y, bool queued_warp)
Update cursor position on mouse movement.
Definition: gfx.cpp:1828
DEBUG
#define DEBUG(name, level,...)
Output a line of debugging information.
Definition: debug.h:35
Palette::palette
Colour palette[256]
Current palette. Entry 0 has to be always fully transparent!
Definition: gfx_type.h:314
allegro_v.h
Blitter::PostResize
virtual void PostResize()
Post resize event.
Definition: base.hpp:209
VideoDriver_Allegro::CheckPaletteAnim
void CheckPaletteAnim() override
Process any pending palette animation.
BlitterFactory::GetCurrentBlitter
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
Definition: factory.hpp:140
StringList
std::vector< std::string > StringList
Type for a list of strings.
Definition: string_type.h:58
_resolutions
std::vector< Dimension > _resolutions
List of resolutions.
Definition: driver.cpp:22
_shift_pressed
bool _shift_pressed
Is Shift pressed?
Definition: gfx.cpp:36
CursorVars::wheel
int wheel
mouse wheel movement
Definition: gfx_type.h:119
Palette::count_dirty
int count_dirty
The number of dirty elements.
Definition: gfx_type.h:316
VideoDriver_Allegro::MakeDirty
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.
WKC_R_BRACKET
@ WKC_R_BRACKET
] Right square bracket
Definition: gfx_type.h:100
_rightclick_emulate
bool _rightclick_emulate
Whether right clicking is emulated.
Definition: driver.cpp:24
WKC_PERIOD
@ WKC_PERIOD
. Period
Definition: gfx_type.h:103
VideoDriver::UpdateAutoResolution
void UpdateAutoResolution()
Apply resolution auto-detection and clamp to sensible defaults.
Definition: video_driver.hpp:208
endof
#define endof(x)
Get the end element of an fixed size array.
Definition: stdafx.h:375
Blitter::PALETTE_ANIMATION_VIDEO_BACKEND
@ PALETTE_ANIMATION_VIDEO_BACKEND
Palette animation should be done by video backend (8bpp only!)
Definition: base.hpp:51
CursorVars::delta
Point delta
relative mouse movement in this tick
Definition: gfx_type.h:118
seprintf
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
Definition: string.cpp:442
WKC_COMMA
@ WKC_COMMA
, Comma
Definition: gfx_type.h:102
Blitter::PALETTE_ANIMATION_NONE
@ PALETTE_ANIMATION_NONE
No palette animation.
Definition: base.hpp:50
WKC_SEMICOLON
@ WKC_SEMICOLON
; Semicolon
Definition: gfx_type.h:96
_cur_palette
Palette _cur_palette
Current palette.
Definition: gfx.cpp:48
GameSizeChanged
void GameSizeChanged()
Size of the application screen changed.
Definition: main_gui.cpp:561
VideoDriver_Allegro::MainLoop
void MainLoop() override
Perform the actual drawing.
Blitter::PaletteAnimate
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...
HandleCtrlChanged
void HandleCtrlChanged()
State of CONTROL key has changed.
Definition: window.cpp:2738
MarkWholeScreenDirty
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1619
VideoDriver::SleepTillNextTick
void SleepTillNextTick()
Sleep till the next tick is about to happen.
Definition: video_driver.cpp:75
Blitter::PALETTE_ANIMATION_BLITTER
@ PALETTE_ANIMATION_BLITTER
The blitter takes care of the palette animation.
Definition: base.hpp:52
VideoDriver_Allegro::ToggleFullscreen
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
VideoDriver::fast_forward_key_pressed
bool fast_forward_key_pressed
The fast-forward key is being pressed.
Definition: video_driver.hpp:288
PointDimension
Specification of a rectangle with an absolute top-left coordinate and a (relative) width/height.
Definition: geometry_type.hpp:58
VideoDriver_Allegro::Stop
void Stop() override
Stop this driver.
WKC_MINUS
@ WKC_MINUS
Definition: gfx_type.h:104
VideoDriver_Allegro::PollEvent
bool PollEvent() override
Process a single system event.
CursorVars::pos
Point pos
logical mouse position
Definition: gfx_type.h:117
_right_button_clicked
bool _right_button_clicked
Is right mouse button clicked?
Definition: gfx.cpp:41
lastof
#define lastof(x)
Get the last element of an fixed size array.
Definition: stdafx.h:383
_left_button_clicked
bool _left_button_clicked
Is left mouse button clicked?
Definition: gfx.cpp:39
_cur_resolution
Dimension _cur_resolution
The current resolution.
Definition: driver.cpp:23
_right_button_down
bool _right_button_down
Is right mouse button pressed?
Definition: gfx.cpp:40
FindFirstBit
uint8 FindFirstBit(uint32 x)
Search the first set bit in a 32 bit variable.
Definition: bitmath_func.cpp:37
Delta
static T Delta(const T a, const T b)
Returns the (absolute) difference between two (scalar) variables.
Definition: math_func.hpp:170