Fix compiler warnings.
[openttd-joker.git] / src / video / video_driver.hpp
blobbc71cdd6cc7e096793320c41dd2be337f2b729f1
1 /* $Id: video_driver.hpp 26108 2013-11-25 14:30:22Z rubidium $ */
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 */
10 /** @file video_driver.hpp Base of all video drivers. */
12 #ifndef VIDEO_VIDEO_DRIVER_HPP
13 #define VIDEO_VIDEO_DRIVER_HPP
15 #include "../driver.h"
16 #include "../core/geometry_type.hpp"
18 /** The base of all video drivers. */
19 class VideoDriver : public Driver {
20 public:
21 /**
22 * Mark a particular area dirty.
23 * @param left The left most line of the dirty area.
24 * @param top The top most line of the dirty area.
25 * @param width The width of the dirty area.
26 * @param height The height of the dirty area.
28 virtual void MakeDirty(int left, int top, int width, int height) = 0;
30 /**
31 * Perform the actual drawing.
33 virtual void MainLoop() = 0;
35 /**
36 * Change the resolution of the window.
37 * @param w The new width.
38 * @param h The new height.
39 * @return True if the change succeeded.
41 virtual bool ChangeResolution(int w, int h) = 0;
43 /**
44 * Change the full screen setting.
45 * @param fullscreen The new setting.
46 * @return True if the change succeeded.
48 virtual bool ToggleFullscreen(bool fullscreen) = 0;
50 /**
51 * Callback invoked after the blitter was changed.
52 * This may only be called between AcquireBlitterLock and ReleaseBlitterLock.
53 * @return True if no error.
55 virtual bool AfterBlitterChange()
57 return true;
60 /**
61 * Acquire any lock(s) required to be held when changing blitters.
62 * These lock(s) may not be acquired recursively.
64 virtual void AcquireBlitterLock() { }
66 /**
67 * Release any lock(s) required to be held when changing blitters.
68 * These lock(s) may not be acquired recursively.
70 virtual void ReleaseBlitterLock() { }
72 virtual bool ClaimMousePointer()
74 return true;
77 /**
78 * Whether the driver has a graphical user interface with the end user.
79 * Or in other words, whether we should spawn a thread for world generation
80 * and NewGRF scanning so the graphical updates can keep coming. Otherwise
81 * progress has to be shown on the console, which uses by definition another
82 * thread/process for display purposes.
83 * @return True for all drivers except null and dedicated.
85 virtual bool HasGUI() const
87 return true;
90 /**
91 * An edit box lost the input focus. Abort character compositing if necessary.
93 virtual void EditBoxLostFocus() {}
95 /**
96 * Get the currently active instance of the video driver.
98 static VideoDriver *GetInstance() {
99 return static_cast<VideoDriver*>(*DriverFactoryBase::GetActiveDriver(Driver::DT_VIDEO));
103 extern char *_ini_videodriver;
104 extern int _num_resolutions;
105 extern Dimension _resolutions[32];
106 extern Dimension _cur_resolution;
107 extern bool _rightclick_emulate;
109 #endif /* VIDEO_VIDEO_DRIVER_HPP */