00001 /* $Id: video_driver.hpp 23241 2011-11-17 21:09:08Z rubidium $ */ 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 00054 virtual bool AfterBlitterChange() 00055 { 00056 return true; 00057 } 00058 00059 virtual bool ClaimMousePointer() 00060 { 00061 return true; 00062 } 00063 00072 virtual bool HasGUI() const 00073 { 00074 return true; 00075 } 00076 }; 00077 00079 class VideoDriverFactoryBase: public DriverFactoryBase { 00080 }; 00081 00086 template <class T> 00087 class VideoDriverFactory: public VideoDriverFactoryBase { 00088 public: 00089 VideoDriverFactory() { this->RegisterDriver(((T *)this)->GetName(), Driver::DT_VIDEO, ((T *)this)->priority); } 00090 00094 const char *GetName(); 00095 }; 00096 00097 extern VideoDriver *_video_driver; 00098 extern char *_ini_videodriver; 00099 extern int _num_resolutions; 00100 extern Dimension _resolutions[32]; 00101 extern Dimension _cur_resolution; 00102 extern bool _rightclick_emulate; 00103 00104 #endif /* VIDEO_VIDEO_DRIVER_HPP */