OpenTTD
video_driver.hpp
Go to the documentation of this file.
1 /* $Id: video_driver.hpp 27775 2017-03-11 13:05:54Z frosch $ */
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 
12 #ifndef VIDEO_VIDEO_DRIVER_HPP
13 #define VIDEO_VIDEO_DRIVER_HPP
14 
15 #include "../driver.h"
16 #include "../core/geometry_type.hpp"
17 
19 class VideoDriver : public Driver {
20 public:
28  virtual void MakeDirty(int left, int top, int width, int height) = 0;
29 
33  virtual void MainLoop() = 0;
34 
41  virtual bool ChangeResolution(int w, int h) = 0;
42 
48  virtual bool ToggleFullscreen(bool fullscreen) = 0;
49 
55  virtual bool AfterBlitterChange()
56  {
57  return true;
58  }
59 
64  virtual void AcquireBlitterLock() { }
65 
70  virtual void ReleaseBlitterLock() { }
71 
72  virtual bool ClaimMousePointer()
73  {
74  return true;
75  }
76 
85  virtual bool HasGUI() const
86  {
87  return true;
88  }
89 
93  virtual void EditBoxLostFocus() {}
94 
100  }
101 };
102 
103 extern char *_ini_videodriver;
104 extern int _num_resolutions;
105 extern Dimension _resolutions[32];
107 extern bool _rightclick_emulate;
108 
109 #endif /* VIDEO_VIDEO_DRIVER_HPP */
virtual void MakeDirty(int left, int top, int width, int height)=0
Mark a particular area dirty.
virtual void ReleaseBlitterLock()
Release any lock(s) required to be held when changing blitters.
virtual bool HasGUI() const
Whether the driver has a graphical user interface with the end user.
static Driver ** GetActiveDriver(Driver::Type type)
Get the active driver for the given type.
Definition: driver.h:87
Dimension _cur_resolution
The current resolution.
Definition: driver.cpp:24
virtual bool ToggleFullscreen(bool fullscreen)=0
Change the full screen setting.
int _num_resolutions
The number of resolutions.
Definition: driver.cpp:22
Dimension _resolutions[32]
List of resolutions.
Definition: driver.cpp:23
virtual bool ChangeResolution(int w, int h)=0
Change the resolution of the window.
char * _ini_videodriver
The video driver a stored in the configuration file.
Definition: driver.cpp:21
virtual void AcquireBlitterLock()
Acquire any lock(s) required to be held when changing blitters.
A driver for communicating with the user.
Definition: driver.h:24
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
bool _rightclick_emulate
Whether right clicking is emulated.
Definition: driver.cpp:25
virtual void MainLoop()=0
Perform the actual drawing.
The base of all video drivers.
virtual void EditBoxLostFocus()
An edit box lost the input focus.
virtual bool AfterBlitterChange()
Callback invoked after the blitter was changed.
A video driver.
Definition: driver.h:45
Dimensions (a width and height) of a rectangle in 2D.