Add: INR currency (#8136)
[openttd-github.git] / src / video / video_driver.hpp
blob2cca66d3b26e3db144cd8f1321a007dbbb932512
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 */
8 /** @file video_driver.hpp Base of all video drivers. */
10 #ifndef VIDEO_VIDEO_DRIVER_HPP
11 #define VIDEO_VIDEO_DRIVER_HPP
13 #include "../driver.h"
14 #include "../core/geometry_type.hpp"
15 #include <vector>
17 /** The base of all video drivers. */
18 class VideoDriver : public Driver {
19 public:
20 /**
21 * Mark a particular area dirty.
22 * @param left The left most line of the dirty area.
23 * @param top The top most line of the dirty area.
24 * @param width The width of the dirty area.
25 * @param height The height of the dirty area.
27 virtual void MakeDirty(int left, int top, int width, int height) = 0;
29 /**
30 * Perform the actual drawing.
32 virtual void MainLoop() = 0;
34 /**
35 * Change the resolution of the window.
36 * @param w The new width.
37 * @param h The new height.
38 * @return True if the change succeeded.
40 virtual bool ChangeResolution(int w, int h) = 0;
42 /**
43 * Change the full screen setting.
44 * @param fullscreen The new setting.
45 * @return True if the change succeeded.
47 virtual bool ToggleFullscreen(bool fullscreen) = 0;
49 /**
50 * Callback invoked after the blitter was changed.
51 * This may only be called between AcquireBlitterLock and ReleaseBlitterLock.
52 * @return True if no error.
54 virtual bool AfterBlitterChange()
56 return true;
59 /**
60 * Acquire any lock(s) required to be held when changing blitters.
61 * These lock(s) may not be acquired recursively.
63 virtual void AcquireBlitterLock() { }
65 /**
66 * Release any lock(s) required to be held when changing blitters.
67 * These lock(s) may not be acquired recursively.
69 virtual void ReleaseBlitterLock() { }
71 virtual bool ClaimMousePointer()
73 return true;
76 /**
77 * Whether the driver has a graphical user interface with the end user.
78 * Or in other words, whether we should spawn a thread for world generation
79 * and NewGRF scanning so the graphical updates can keep coming. Otherwise
80 * progress has to be shown on the console, which uses by definition another
81 * thread/process for display purposes.
82 * @return True for all drivers except null and dedicated.
84 virtual bool HasGUI() const
86 return true;
89 /**
90 * An edit box lost the input focus. Abort character compositing if necessary.
92 virtual void EditBoxLostFocus() {}
94 /**
95 * An edit box gained the input focus
97 virtual void EditBoxGainedFocus() {}
99 /**
100 * Get the currently active instance of the video driver.
102 static VideoDriver *GetInstance() {
103 return static_cast<VideoDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_VIDEO));
107 extern char *_ini_videodriver;
108 extern std::vector<Dimension> _resolutions;
109 extern Dimension _cur_resolution;
110 extern bool _rightclick_emulate;
112 #endif /* VIDEO_VIDEO_DRIVER_HPP */