# video_driver.hpp

Go to the documentation of this file.

    00001 /* $Id: video_driver.hpp 17248 2009-08-21 20:21:05Z 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
    00018 class VideoDriver: public Driver {
    00019 public:
    00020   virtual void MakeDirty(int left, int top, int width, int height) = 0;
    00021
    00022   virtual void MainLoop() = 0;
    00023
    00024   virtual bool ChangeResolution(int w, int h) = 0;
    00025
    00026   virtual bool ToggleFullscreen(bool fullscreen) = 0;
    00027 };
    00028
    00029 class VideoDriverFactoryBase: public DriverFactoryBase {
    00030 };
    00031
    00032 template <class T>
    00033 class VideoDriverFactory: public VideoDriverFactoryBase {
    00034 public:
    00035   VideoDriverFactory() { this->RegisterDriver(((T *)this)->GetName(), Driver::DT_VIDEO, ((T *)this)->priority); }
    00036
    00040   const char *GetName();
    00041 };
    00042
    00043 extern VideoDriver *_video_driver;
    00044 extern char *_ini_videodriver;
    00045 extern int _num_resolutions;
    00046 extern Dimension _resolutions[32];
    00047 extern Dimension _cur_resolution;
    00048
    00049 #endif /* VIDEO_VIDEO_DRIVER_HPP */