From 13e42a77b1a17f65035c5772956b3addc1fab386 Mon Sep 17 00:00:00 2001 From: Kostas Nakos Date: Sun, 27 May 2007 19:05:51 +0000 Subject: getting screen extents from the sdl backend. Builders must use the newer sdl port lib svn-id: r26979 --- backends/platform/wince/wince-sdl.cpp | 64 +++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 48eca8164e..a52a6856f2 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -176,7 +176,6 @@ int SDL_main(int argc, char **argv) { #endif CEDevice::init(); - OSystem_WINCE3::initScreenInfos(); /* Redirect standard input and standard output */ strcpy(stdout_fname, getcwd(NULL, MAX_PATH)); @@ -265,16 +264,6 @@ static Uint32 timer_handler_wrapper(Uint32 interval) { void OSystem_WINCE3::initBackend() { - // Initialize global key mapping - GUI::Actions::init(); - GUI_Actions::Instance()->initInstanceMain(this); - if (!GUI_Actions::Instance()->loadMapping()) { // error during loading means not present/wrong version - warning("Setting default action mappings."); - GUI_Actions::Instance()->saveMapping(); // write defaults - } - - loadDeviceConfiguration(); - // Instantiate our own sound mixer // mixer init is postponed until a game engine is selected. if (_mixer == 0) { @@ -290,6 +279,23 @@ void OSystem_WINCE3::initBackend() // Chain init OSystem_SDL::initBackend(); + + // Query SDL for screen size and init screen dependent stuff + OSystem_WINCE3::initScreenInfos(); + _isSmartphone = CEDevice::isSmartphone(); + create_toolbar(); + _hasSmartphoneResolution = CEDevice::hasSmartphoneResolution() || CEDevice::isSmartphone(); + if (_hasSmartphoneResolution) _panelVisible = false; // init correctly in smartphones + + // Initialize global key mapping + GUI::Actions::init(); + GUI_Actions::Instance()->initInstanceMain(this); + if (!GUI_Actions::Instance()->loadMapping()) { // error during loading means not present/wrong version + warning("Setting default action mappings."); + GUI_Actions::Instance()->saveMapping(); // write defaults + } + + loadDeviceConfiguration(); } int OSystem_WINCE3::getScreenWidth() { @@ -303,8 +309,13 @@ int OSystem_WINCE3::getScreenHeight() { void OSystem_WINCE3::initScreenInfos() { // sdl port ensures that we use correctly full screen _isOzone = 0; - _platformScreenWidth = GetSystemMetrics(SM_CXSCREEN); - _platformScreenHeight = GetSystemMetrics(SM_CYSCREEN); + SDL_Rect **r; + r = SDL_ListModes(NULL, 0); + printf("listmodes: %dx%d\n", r[0]->w, r[0]->h); + //_platformScreenWidth = GetSystemMetrics(SM_CXSCREEN); + //_platformScreenHeight = GetSystemMetrics(SM_CYSCREEN); + _platformScreenWidth = r[0]->w; + _platformScreenHeight = r[0]->h; } bool OSystem_WINCE3::isOzone() { @@ -322,15 +333,11 @@ OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(), _saveToolbarState(false), _saveActiveToolbar(NAME_MAIN_PANEL), _rbutton(false), _hasfocus(true), _usesEmulatedMouse(false), _mouseBackupOld(NULL), _mouseBackupToolbar(NULL), _mouseBackupDim(0) { - _isSmartphone = CEDevice::isSmartphone(); - _hasSmartphoneResolution = CEDevice::hasSmartphoneResolution() || CEDevice::isSmartphone(); memset(&_mouseCurState, 0, sizeof(_mouseCurState)); if (_isSmartphone) { _mouseCurState.x = 20; _mouseCurState.y = 20; } - if (_hasSmartphoneResolution) _panelVisible = false; // init correctly in smartphones - create_toolbar(); _mixer = 0; _screen = NULL; @@ -912,7 +919,6 @@ void OSystem_WINCE3::update_game_settings() { } void OSystem_WINCE3::initSize(uint w, uint h) { - if (_hasSmartphoneResolution && h == 240) h = 200; // mainly for the launcher @@ -975,7 +981,6 @@ int OSystem_WINCE3::getDefaultGraphicsMode() const { } bool OSystem_WINCE3::update_scalers() { - if (_mode != GFX_NORMAL) return false; @@ -984,12 +989,21 @@ bool OSystem_WINCE3::update_scalers() { if (CEDevice::hasPocketPCResolution()) { if ( (!_orientationLandscape && (_screenWidth == 320 || !_screenWidth)) || CEDevice::hasSquareQVGAResolution() ) { - _scaleFactorXm = 3; - _scaleFactorXd = 4; - _scaleFactorYm = 1; - _scaleFactorYd = 1; - _scalerProc = PocketPCPortrait; - _modeFlags = 0; + if (getScreenWidth() != 320) { + _scaleFactorXm = 3; + _scaleFactorXd = 4; + _scaleFactorYm = 1; + _scaleFactorYd = 1; + _scalerProc = PocketPCPortrait; + _modeFlags = 0; + } else { + _scaleFactorXm = 1; + _scaleFactorXd = 1; + _scaleFactorYm = 1; + _scaleFactorYd = 1; + _scalerProc = Normal1x; + _modeFlags = 0; + } } else if ( _orientationLandscape && (_screenWidth == 320 || !_screenWidth)) { Common::String gameid(ConfMan.get("gameid")); // consider removing this check and start honoring the _adjustAspectRatio flag if (!_panelVisible && !_hasSmartphoneResolution && !_overlayVisible && !(strncmp(gameid.c_str(), "zak", 3) == 0)) { -- cgit v1.2.3