OpenTTD
video_driver.hpp
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 
10 #ifndef VIDEO_VIDEO_DRIVER_HPP
11 #define VIDEO_VIDEO_DRIVER_HPP
12 
13 #include "../driver.h"
14 #include "../core/geometry_type.hpp"
15 #include <vector>
16 
18 class VideoDriver : public Driver {
19 public:
27  virtual void MakeDirty(int left, int top, int width, int height) = 0;
28 
32  virtual void MainLoop() = 0;
33 
40  virtual bool ChangeResolution(int w, int h) = 0;
41 
47  virtual bool ToggleFullscreen(bool fullscreen) = 0;
48 
54  virtual bool AfterBlitterChange()
55  {
56  return true;
57  }
58 
63  virtual void AcquireBlitterLock() { }
64 
69  virtual void ReleaseBlitterLock() { }
70 
71  virtual bool ClaimMousePointer()
72  {
73  return true;
74  }
75 
84  virtual bool HasGUI() const
85  {
86  return true;
87  }
88 
92  virtual void EditBoxLostFocus() {}
93 
97  virtual void EditBoxGainedFocus() {}
98 
104  }
105 };
106 
107 extern char *_ini_videodriver;
108 extern std::vector<Dimension> _resolutions;
110 extern bool _rightclick_emulate;
111 
112 #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:85
virtual void EditBoxGainedFocus()
An edit box gained the input focus.
Dimension _cur_resolution
The current resolution.
Definition: driver.cpp:21
virtual bool ToggleFullscreen(bool fullscreen)=0
Change the full screen setting.
std::vector< Dimension > _resolutions
List of resolutions.
Definition: driver.cpp:20
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:19
virtual void AcquireBlitterLock()
Acquire any lock(s) required to be held when changing blitters.
A driver for communicating with the user.
Definition: driver.h:22
static VideoDriver * GetInstance()
Get the currently active instance of the video driver.
bool _rightclick_emulate
Whether right clicking is emulated.
Definition: driver.cpp:22
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:43
Dimensions (a width and height) of a rectangle in 2D.