00001 /* 00002 * Video mode enumerator header 00003 * 00004 * This file is part of the "SoftPixel Engine" (Copyright (c) 2008 by Lukas Hermanns) 00005 * See "SoftPixelEngine.hpp" for license information. 00006 */ 00007 00008 #ifndef __SP_VIDEOMODE_RECEIVER_H__ 00009 #define __SP_VIDEOMODE_RECEIVER_H__ 00010 00011 00012 #include "Base/spStandard.hpp" 00013 #include "Base/spDimensionSize2D.hpp" 00014 #include "Base/spInputOutputString.hpp" 00015 00016 00017 namespace sp 00018 { 00019 namespace video 00020 { 00021 00022 00024 struct SVideoMode 00025 { 00026 SVideoMode(const dim::size2di &InitResolution = 0, s32 InitColorDepth = 0) : 00027 Resolution(InitResolution), 00028 ColorDepth(InitColorDepth) 00029 { 00030 } 00031 SVideoMode(const SVideoMode &Other) : 00032 Resolution(Other.Resolution), 00033 ColorDepth(Other.ColorDepth) 00034 { 00035 } 00036 ~SVideoMode() 00037 { 00038 } 00039 00040 /* Operators */ 00041 bool operator == (const SVideoMode &Other) const 00042 { 00043 return Resolution == Other.Resolution && ColorDepth == Other.ColorDepth; 00044 } 00045 00046 /* Members */ 00047 dim::size2di Resolution; 00048 s32 ColorDepth; 00049 }; 00050 00052 struct SDisplayDevice 00053 { 00054 SDisplayDevice() 00055 { 00056 } 00057 SDisplayDevice(const io::stringc &InitVideoController, const io::stringc &InitMonitor) : 00058 VideoController (InitVideoController), 00059 Monitor (InitMonitor ) 00060 { 00061 } 00062 SDisplayDevice(const SDisplayDevice &Other) : 00063 VideoController (Other.VideoController ), 00064 Monitor (Other.Monitor ) 00065 { 00066 } 00067 ~SDisplayDevice() 00068 { 00069 } 00070 00071 /* Members */ 00072 io::stringc VideoController; 00073 io::stringc Monitor; 00074 }; 00075 00076 00083 class SP_EXPORT VideoModeEnumerator 00084 { 00085 00086 public: 00087 00088 VideoModeEnumerator(); 00089 ~VideoModeEnumerator(); 00090 00091 /* Inline functions */ 00092 00094 inline SVideoMode getDesktop() const 00095 { 00096 return Desktop_; 00097 } 00098 00100 inline u32 getVideoModeCount() const 00101 { 00102 return VideoModes_.size(); 00103 } 00105 inline SVideoMode getVideoMode(u32 Index) const 00106 { 00107 return Index < VideoModes_.size() ? VideoModes_[Index] : SVideoMode(); 00108 } 00109 inline const std::vector<SVideoMode>& getVideoModeList() const 00110 { 00111 return VideoModes_; 00112 } 00113 00115 inline u32 getDisplayDeviceCount() const 00116 { 00117 return DisplayDevices_.size(); 00118 } 00120 inline SDisplayDevice getDisplayDevice(u32 Index) const 00121 { 00122 return Index < DisplayDevices_.size() ? DisplayDevices_[Index] : SDisplayDevice(); 00123 } 00124 inline const std::vector<SDisplayDevice>& getDisplayDeviceList() const 00125 { 00126 return DisplayDevices_; 00127 } 00128 00129 private: 00130 00131 /* Members */ 00132 00133 SVideoMode Desktop_; 00134 std::vector<SVideoMode> VideoModes_; 00135 std::vector<SDisplayDevice> DisplayDevices_; 00136 00137 }; 00138 00139 00140 } // /namespace video 00141 00142 } // /namespace sp 00143 00144 00145 #endif 00146 00147 00148 00149 // ================================================================================