Files
@ r20758:f233b5e2cdd2
Branch filter:
Location: cpp/openttd-patchpack/source/src/video/video_driver.hpp
r20758:f233b5e2cdd2
3.1 KiB
text/x-c++hdr
(svn r25801) -Update from WebTranslator v3.0:
estonian - 4 changes by notAbot
japanese - 5 changes by guppy
slovenian - 1 changes by matej1245
estonian - 4 changes by notAbot
japanese - 5 changes by guppy
slovenian - 1 changes by matej1245
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | /* $Id$ */
/*
* This file is part of OpenTTD.
* 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.
* 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.
* 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/>.
*/
/** @file video_driver.hpp Base of all video drivers. */
#ifndef VIDEO_VIDEO_DRIVER_HPP
#define VIDEO_VIDEO_DRIVER_HPP
#include "../driver.h"
#include "../core/geometry_type.hpp"
/** The base of all video drivers. */
class VideoDriver: public Driver {
public:
/**
* Mark a particular area dirty.
* @param left The left most line of the dirty area.
* @param top The top most line of the dirty area.
* @param width The width of the dirty area.
* @param height The height of the dirty area.
*/
virtual void MakeDirty(int left, int top, int width, int height) = 0;
/**
* Perform the actual drawing.
*/
virtual void MainLoop() = 0;
/**
* Change the resolution of the window.
* @param w The new width.
* @param h The new height.
* @return True if the change succeeded.
*/
virtual bool ChangeResolution(int w, int h) = 0;
/**
* Change the full screen setting.
* @param fullscreen The new setting.
* @return True if the change succeeded.
*/
virtual bool ToggleFullscreen(bool fullscreen) = 0;
/**
* Callback invoked after the blitter was changed.
* @return True if no error.
*/
virtual bool AfterBlitterChange()
{
return true;
}
virtual bool ClaimMousePointer()
{
return true;
}
/**
* Whether the driver has a graphical user interface with the end user.
* Or in other words, whether we should spawn a thread for world generation
* and NewGRF scanning so the graphical updates can keep coming. Otherwise
* progress has to be shown on the console, which uses by definition another
* thread/process for display purposes.
* @return True for all drivers except null and dedicated.
*/
virtual bool HasGUI() const
{
return true;
}
/**
* An edit box lost the input focus. Abort character compositing if necessary.
*/
virtual void EditBoxLostFocus() {}
};
/** Base of the factory for the video drivers. */
class VideoDriverFactoryBase: public DriverFactoryBase {
};
/**
* Factory for the video drivers.
* @tparam T The type of the video factory to register.
*/
template <class T>
class VideoDriverFactory: public VideoDriverFactoryBase {
public:
VideoDriverFactory() { this->RegisterDriver(((T *)this)->GetName(), Driver::DT_VIDEO, ((T *)this)->priority); }
/**
* Get the long, human readable, name for the Driver-class.
*/
const char *GetName();
};
extern VideoDriver *_video_driver;
extern char *_ini_videodriver;
extern int _num_resolutions;
extern Dimension _resolutions[32];
extern Dimension _cur_resolution;
extern bool _rightclick_emulate;
#endif /* VIDEO_VIDEO_DRIVER_HPP */
|