video_driver.hpp

Go to the documentation of this file.
00001 /* $Id$ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * 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.
00006  * 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.
00007  * 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/>.
00008  */
00009 
00012 #ifndef VIDEO_VIDEO_DRIVER_HPP
00013 #define VIDEO_VIDEO_DRIVER_HPP
00014 
00015 #include "../driver.h"
00016 #include "../core/geometry_type.hpp"
00017 
00019 class VideoDriver: public Driver {
00020 public:
00028   virtual void MakeDirty(int left, int top, int width, int height) = 0;
00029 
00033   virtual void MainLoop() = 0;
00034 
00041   virtual bool ChangeResolution(int w, int h) = 0;
00042 
00048   virtual bool ToggleFullscreen(bool fullscreen) = 0;
00049 };
00050 
00052 class VideoDriverFactoryBase: public DriverFactoryBase {
00053 };
00054 
00059 template <class T>
00060 class VideoDriverFactory: public VideoDriverFactoryBase {
00061 public:
00062   VideoDriverFactory() { this->RegisterDriver(((T *)this)->GetName(), Driver::DT_VIDEO, ((T *)this)->priority); }
00063 
00067   const char *GetName();
00068 };
00069 
00070 extern VideoDriver *_video_driver;
00071 extern char *_ini_videodriver;
00072 extern int _num_resolutions;
00073 extern Dimension _resolutions[32];
00074 extern Dimension _cur_resolution;
00075 extern bool _rightclick_emulate;
00076 
00077 #endif /* VIDEO_VIDEO_DRIVER_HPP */