devicecaps.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIFE_DEVICECAPS_H
00023 #define FIFE_DEVICECAPS_H
00024
00025
00026 #include <string>
00027 #include <vector>
00028
00029
00030
00031
00032
00033
00034
00035
00036
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
00094 static const uint32_t HW_WINDOWED_OPENGL = SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL;
00095
00096 static const uint32_t HW_FULLSCREEN_OPENGL = SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL | SDL_FULLSCREEN;
00097
00098 static const uint32_t WINDOWED_SDL = 0;
00099
00100 static const uint32_t WINDOWED_SDL_DB_HW = SDL_HWSURFACE | SDL_DOUBLEBUF;
00101
00102 static const uint32_t FULLSCREEN_SDL = SDL_FULLSCREEN;
00103
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 };
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 };
00209 }
00210
00211
00212
00213 #endif //FIFE_DEVICECAPS_H