comparison engine/core/video/devicecaps.cpp @ 653:01acc9fc35ea

* Moved getCurrentScreenMode() to the renderbackend as renderbackend is what initializes the screen. * Updated the Color masks to follow the integer standards * Added some new SDL modes (HW Surface and double buffer) to check for in DeviceCaps. * RenderBackend now saves the actual flags used to initialize the screen.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 15 Oct 2010 18:54:34 +0000
parents b9c132cb6ea4
children 5d6b1820b953
comparison
equal deleted inserted replaced
652:da9c4cfe8f8e 653:01acc9fc35ea
54 54
55 bool ScreenMode::operator <(const ScreenMode& rhs) const { 55 bool ScreenMode::operator <(const ScreenMode& rhs) const {
56 if (m_bpp < rhs.getBPP() ) { 56 if (m_bpp < rhs.getBPP() ) {
57 return true; 57 return true;
58 } 58 }
59
59 else if (m_bpp == rhs.getBPP()) { 60 else if (m_bpp == rhs.getBPP()) {
60 if (m_width < rhs.getWidth() || m_height < rhs.getHeight()) { 61 if (m_width == rhs.getWidth() && m_height == rhs.getHeight()){
62 if (!(m_SDLFlags & SDL_HWSURFACE) && (rhs.getSDLFlags() & SDL_HWSURFACE)) {
63 //I would like return true so that we prefer hardware surfaces but
64 //it really slows the engine down in fullscreen. See the SDL FAQ for an
65 //explanation.
66 return false;
67 }
68 }
69
70 else if (m_width < rhs.getWidth() || m_height < rhs.getHeight()) {
61 return true; 71 return true;
62 } 72 }
63 } 73 }
64 return false; 74 return false;
65 } 75 }
132 //clear in case this is called twice 142 //clear in case this is called twice
133 reset(); 143 reset();
134 144
135 //FLAGS 145 //FLAGS
136 #ifdef HAVE_OPENGL 146 #ifdef HAVE_OPENGL
137 const uint32_t numFlags = 4; 147 const uint32_t numFlags = 6;
138 uint32_t flags[numFlags]; 148 uint32_t flags[numFlags];
139 149
140 //OpenGL, windowed, hw accel 150 //OpenGL, windowed, hw accel
141 flags[0] = ScreenMode::HW_WINDOWED_OPENGL; 151 flags[0] = ScreenMode::HW_WINDOWED_OPENGL;
142 //OpenGL, fullscree, hw accel 152 //OpenGL, fullscree, hw accel
143 flags[1] = ScreenMode::HW_FULLSCREEN_OPENGL; 153 flags[1] = ScreenMode::HW_FULLSCREEN_OPENGL;
144 //SDL, windowed 154 //SDL, windowed
145 flags[2] = ScreenMode::WINDOWED_SDL; 155 flags[2] = ScreenMode::WINDOWED_SDL;
156 //SDL, windowed, hw surface, double buffer
157 flags[3] = ScreenMode::WINDOWED_SDL_DB_HW;
146 //SDL, fullscreen 158 //SDL, fullscreen
147 flags[3] = ScreenMode::FULLSCREEN_SDL; 159 flags[4] = ScreenMode::FULLSCREEN_SDL;
160 //SDL, fullscreen, hw surface, double buffer
161 flags[5] = ScreenMode::FULLSCREEN_SDL_DB_HW;
162
148 #else 163 #else
149 const uint32_tnumFlags = 2; 164 const uint32_tnumFlags = 4;
150 uint32_t flags[numFlags]; 165 uint32_t flags[numFlags];
151 166
152 //SDL, windowed 167 //SDL, windowed
153 flags[0] = ScreenMode::WINDOWED_SDL; 168 flags[0] = ScreenMode::WINDOWED_SDL;
169 //SDL, windowed, hw surface, double buffer
170 flags[1] = ScreenMode::WINDOWED_SDL_DB_HW;
154 //SDL, fullscreen 171 //SDL, fullscreen
155 flags[1] = ScreenMode::FULLSCREEN_SDL; 172 flags[2] = ScreenMode::FULLSCREEN_SDL;
173 //SDL, fullscreen, hw surface, double buffer
174 flags[3] = ScreenMode::FULLSCREEN_SDL_DB_HW;
156 #endif 175 #endif
157 176
158 //BITS PER PIXEL 177 //BITS PER PIXEL
159 const uint32_t numBPP = 3; 178 const uint32_t numBPP = 3;
160 uint16_t bpps[numBPP]; 179 uint16_t bpps[numBPP];