FIFE 2008.0
|
00001 /*************************************************************************** 00002 * Copyright (C) 2005-2010 by the FIFE team * 00003 * http://www.fifengine.net * 00004 * This file is part of FIFE. * 00005 * * 00006 * FIFE is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Lesser General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2.1 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * Lesser General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Lesser General Public * 00017 * License along with this library; if not, write to the * 00018 * Free Software Foundation, Inc., * 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00020 ***************************************************************************/ 00021 00022 #ifndef FIFE_DEVICECAPS_H 00023 #define FIFE_DEVICECAPS_H 00024 00025 // Standard C++ library includes 00026 #include <string> 00027 #include <vector> 00028 00029 // Platform specific includes 00030 00031 // 3rd party library includes 00032 00033 // FIFE includes 00034 // These includes are split up in two parts, separated by one empty line 00035 // First block: files included from the FIFE root src directory 00036 // Second block: files included from the same folder 00037 00038 namespace FIFE { 00039 00040 class ScreenMode { 00041 public: 00046 ScreenMode(); 00047 ScreenMode(uint16_t width, uint16_t height, uint16_t bpp, uint32_t SDLFlags); 00048 ScreenMode(const ScreenMode& rhs); 00049 00052 ~ScreenMode() {}; 00053 00054 bool operator <(const ScreenMode& rhs) const; 00055 00060 uint16_t getWidth() const { return m_width; }; 00061 00066 uint16_t getHeight() const { return m_height; }; 00067 00070 uint16_t getBPP() const { return m_bpp; }; 00071 00074 uint32_t getSDLFlags() const { return m_SDLFlags; }; 00075 00078 bool isFullScreen() const { return (m_SDLFlags & SDL_FULLSCREEN) ? true : false;}; 00079 00082 bool isOpenGL() const { return (m_SDLFlags & SDL_OPENGL) ? true : false; }; 00083 00086 bool isSDL() const { return (!(m_SDLFlags & SDL_OPENGL)) ? true : false; }; 00087 00090 bool isSDLHardwareSurface() const { return (m_SDLFlags & SDL_HWSURFACE) ? true : false; }; 00091 00092 00093 //OpenGL, windowed, hw accel 00094 static const uint32_t HW_WINDOWED_OPENGL = SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL; 00095 //OpenGL, fullscreen, hw accel 00096 static const uint32_t HW_FULLSCREEN_OPENGL = SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL | SDL_FULLSCREEN; 00097 //SDL, windowed 00098 static const uint32_t WINDOWED_SDL = 0; 00099 //SDL, windowed, HW surface and double buffer 00100 static const uint32_t WINDOWED_SDL_DB_HW = SDL_HWSURFACE | SDL_DOUBLEBUF; 00101 //SDL, fullscreen 00102 static const uint32_t FULLSCREEN_SDL = SDL_FULLSCREEN; 00103 //SDL, fullscreen, HW surface and double buffer 00104 static const uint32_t FULLSCREEN_SDL_DB_HW = SDL_FULLSCREEN | SDL_HWSURFACE | SDL_DOUBLEBUF; 00105 00106 private: 00107 uint16_t m_width; 00108 uint16_t m_height; 00109 uint16_t m_bpp; 00110 uint32_t m_SDLFlags; 00111 00112 }; //ScreenMode 00113 00114 class DeviceCaps { 00115 public: 00118 DeviceCaps(); 00119 00122 ~DeviceCaps(); 00123 00126 void fillDeviceCaps(); 00127 00130 void reset(); 00131 00134 std::vector<std::string> getAvailableDrivers() const { return m_availableDrivers; }; 00135 00138 std::vector<ScreenMode> getSupportedScreenModes() const { return m_screenModes; }; 00139 00142 ScreenMode getNearestScreenMode(uint16_t width, uint16_t height, uint16_t bpp, const std::string& renderer, bool fs) const; 00143 00146 std::string getDriverName() const { return m_driverName; }; 00147 00150 bool isHwSurfaceAvail() const { return m_hwAvailable; }; 00151 00154 bool isWindowManagerAvail() const { return m_wmAvailable;} ; 00155 00158 bool isHwBlitAccel() const { return m_hwBlitAccel; }; 00159 00162 bool isHwColorkeyBlitAccel() const { return m_hwCCBlitAccel; }; 00163 00166 bool isHwAlphaBlitAccel() const { return m_hwToHwAlphaBlitAccel; }; 00167 00170 bool isSwToHwBlitAccel() const { return m_swToHwBlitAccel; }; 00171 00174 bool isSwToHwColorkeyBlitAccel() const { return m_swToHwCCBlistAccel; }; 00175 00178 bool isSwToHwAlphaBlitAccel() const { return m_swToHwAlphaBlitAccel; }; 00179 00182 bool isBlitFillAccel() const { return m_BlitFillAccel; }; 00183 00186 uint32_t getVideoMemory() const { return m_videoMem; }; 00187 00188 private: 00189 std::vector<ScreenMode> m_screenModes; 00190 std::string m_driverName; 00191 std::vector<std::string> m_availableDrivers; 00192 00193 bool m_hwAvailable; 00194 bool m_wmAvailable; 00195 bool m_hwBlitAccel; 00196 bool m_hwCCBlitAccel; 00197 bool m_hwToHwAlphaBlitAccel; 00198 bool m_swToHwBlitAccel; 00199 bool m_swToHwCCBlistAccel; 00200 bool m_swToHwAlphaBlitAccel; 00201 bool m_BlitFillAccel; 00202 00203 uint32_t m_videoMem; 00204 00207 void fillAvailableDrivers(); 00208 }; //DeviceCaps 00209 } //FIFE 00210 00211 00212 00213 #endif //FIFE_DEVICECAPS_H