comparison engine/core/controller/engine.cpp @ 642:6e2151325017

* Added the ability to query the current running screen mode * Added a method to detect the closest supported screen mode (not complete yet). If no matching screen modes are detected an exception is thrown. * Small change to the way the screen is initialized. The screen mode now MUST be in the supported screen mode list before the screen will initialize.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 08 Oct 2010 21:22:02 +0000
parents 855ad500f991
children edf6dcfe8cd4
comparison
equal deleted inserted replaced
641:52708806f35c 642:6e2151325017
123 123
124 EngineSettings& Engine::getSettings() { 124 EngineSettings& Engine::getSettings() {
125 return m_settings; 125 return m_settings;
126 } 126 }
127 127
128 DeviceCaps& Engine::getDeviceCaps() { 128 const DeviceCaps& Engine::getDeviceCaps() const {
129 return m_devcaps; 129 return m_devcaps;
130 }
131
132 const ScreenMode& Engine::getCurrentScreenMode() const{
133 return m_screenMode;
130 } 134 }
131 135
132 void Engine::preInit() { 136 void Engine::preInit() {
133 m_logmanager = LogManager::instance(); 137 m_logmanager = LogManager::instance();
134 138
198 m_renderbackend->init(m_settings.getVideoDriver()); 202 m_renderbackend->init(m_settings.getVideoDriver());
199 203
200 FL_LOG(_log, "Querying device capabilities"); 204 FL_LOG(_log, "Querying device capabilities");
201 m_devcaps.fillDeviceCaps(); 205 m_devcaps.fillDeviceCaps();
202 206
207 uint32_t bpp = m_settings.getBitsPerPixel();
208
209 m_screenMode = m_devcaps.getNearestScreenMode(
210 m_settings.getScreenWidth(),
211 m_settings.getScreenHeight(),
212 (bpp ? bpp : 32) , //if it's 0 we use 32 bit as a default
213 rbackend,
214 m_settings.isFullScreen());
215
203 FL_LOG(_log, "Creating main screen"); 216 FL_LOG(_log, "Creating main screen");
204 m_renderbackend->createMainScreen( 217 m_renderbackend->createMainScreen(
205 m_settings.getScreenWidth(), 218 m_screenMode,
206 m_settings.getScreenHeight(),
207 static_cast<unsigned char>(m_settings.getBitsPerPixel()),
208 m_settings.isFullScreen(),
209 m_settings.getWindowTitle(), 219 m_settings.getWindowTitle(),
210 m_settings.getWindowIcon()); 220 m_settings.getWindowIcon());
211 FL_LOG(_log, "Main screen created"); 221 FL_LOG(_log, "Main screen created");
212 222
213 #ifdef HAVE_OPENGL 223 #ifdef HAVE_OPENGL