Mercurial > fife-parpg
comparison engine/core/video/devicecaps.cpp @ 649:b9c132cb6ea4
* Fixed the non standard integer definitions in DeviceCaps
* FIFE should compile again with MSVC
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 14 Oct 2010 15:06:26 +0000 |
parents | 07b1cf8e92b5 |
children | 01acc9fc35ea |
comparison
equal
deleted
inserted
replaced
648:6837a83471e0 | 649:b9c132cb6ea4 |
---|---|
123 m_availableDrivers.push_back("x11"); | 123 m_availableDrivers.push_back("x11"); |
124 #endif | 124 #endif |
125 } | 125 } |
126 | 126 |
127 void DeviceCaps::fillDeviceCaps() { | 127 void DeviceCaps::fillDeviceCaps() { |
128 int bufferSize = 256; | 128 //buffer to store driver name |
129 const uint32_t bufferSize = 256; | |
129 char buffer[bufferSize]; | 130 char buffer[bufferSize]; |
130 | |
131 int numBPP = 3; | |
132 int bpps[numBPP]; | |
133 | 131 |
134 //clear in case this is called twice | 132 //clear in case this is called twice |
135 reset(); | 133 reset(); |
136 | 134 |
137 //FLAGS | 135 //FLAGS |
138 #ifdef HAVE_OPENGL | 136 #ifdef HAVE_OPENGL |
139 int numFlags = 4; | 137 const uint32_t numFlags = 4; |
140 Uint32 flags[numFlags]; | 138 uint32_t flags[numFlags]; |
141 | 139 |
142 //OpenGL, windowed, hw accel | 140 //OpenGL, windowed, hw accel |
143 flags[0] = ScreenMode::HW_WINDOWED_OPENGL; | 141 flags[0] = ScreenMode::HW_WINDOWED_OPENGL; |
144 //OpenGL, fullscree, hw accel | 142 //OpenGL, fullscree, hw accel |
145 flags[1] = ScreenMode::HW_FULLSCREEN_OPENGL; | 143 flags[1] = ScreenMode::HW_FULLSCREEN_OPENGL; |
146 //SDL, windowed | 144 //SDL, windowed |
147 flags[2] = ScreenMode::WINDOWED_SDL; | 145 flags[2] = ScreenMode::WINDOWED_SDL; |
148 //SDL, fullscreen | 146 //SDL, fullscreen |
149 flags[3] = ScreenMode::FULLSCREEN_SDL; | 147 flags[3] = ScreenMode::FULLSCREEN_SDL; |
150 #else | 148 #else |
151 int numFlags = 2; | 149 const uint32_tnumFlags = 2; |
152 Uint32 flags[numFlags]; | 150 uint32_t flags[numFlags]; |
153 | 151 |
154 //SDL, windowed | 152 //SDL, windowed |
155 flags[0] = ScreenMode::WINDOWED_SDL; | 153 flags[0] = ScreenMode::WINDOWED_SDL; |
156 //SDL, fullscreen | 154 //SDL, fullscreen |
157 flags[1] = ScreenMode::FULLSCREEN_SDL; | 155 flags[1] = ScreenMode::FULLSCREEN_SDL; |
158 #endif | 156 #endif |
157 | |
159 //BITS PER PIXEL | 158 //BITS PER PIXEL |
159 const uint32_t numBPP = 3; | |
160 uint16_t bpps[numBPP]; | |
160 | 161 |
161 bpps[0] = 16; | 162 bpps[0] = 16; |
162 bpps[1] = 24; | 163 bpps[1] = 24; |
163 bpps[2] = 32; | 164 bpps[2] = 32; |
164 | 165 |
165 //COMMON FS RESOLUTIONS | 166 //COMMON FS RESOLUTIONS |
166 int resolutions[15][2] = { | 167 const uint32_t numRes = 15; |
168 uint16_t resolutions[numRes][2] = { | |
167 {640, 480}, | 169 {640, 480}, |
168 {800, 600}, | 170 {800, 600}, |
169 {1024, 768}, | 171 {1024, 768}, |
170 {1152, 864}, | 172 {1152, 864}, |
171 {1280, 768}, | 173 {1280, 768}, |
178 {1600, 1200}, | 180 {1600, 1200}, |
179 {1680, 1050}, | 181 {1680, 1050}, |
180 {1920, 1080}, | 182 {1920, 1080}, |
181 {1920, 1200} | 183 {1920, 1200} |
182 }; | 184 }; |
183 int numRes = 15; | 185 |
184 | 186 |
185 | 187 for (uint32_t i = 0; i < numBPP; ++i){ |
186 for (int i = 0; i < numBPP; ++i){ | 188 for (uint32_t j = 0; j < numFlags; ++j) { |
187 for (int j = 0; j < numFlags; ++j) { | 189 for ( uint32_t k = 0; k < numRes; ++k) { |
188 for ( int k = 0; k < numRes; ++k) { | 190 uint16_t bpp; |
189 int bpp; | |
190 if (flags[j] & SDL_FULLSCREEN) { | 191 if (flags[j] & SDL_FULLSCREEN) { |
191 bpp = SDL_VideoModeOK(resolutions[k][0],resolutions[k][1], bpps[i], flags[j]); | 192 bpp = SDL_VideoModeOK(resolutions[k][0],resolutions[k][1], bpps[i], flags[j]); |
192 | 193 |
193 if (bpp > 0) { | 194 if (bpp > 0) { |
194 m_screenModes.push_back(ScreenMode(resolutions[k][0],resolutions[k][1], bpps[i], flags[j])); | 195 m_screenModes.push_back(ScreenMode(resolutions[k][0],resolutions[k][1], bpps[i], flags[j])); |