comparison engine/core/video/devicecaps.cpp @ 654:5d6b1820b953

* Added the ability to change screen modes on the fly. This works both in OpenGL and SDL modes. * Added IEngineChangeListener so the client can update the cameras viewport if the screen mode has been changed. I chose to do it this way because the engine has no way to know which camera it should update. It will be up to the client to do it. * The cursor surface is now correctly freed when exiting. * Added DeviceCaps::getNearestScreenMode() for the client to request a supported screen mode. closes[t:315]
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 21 Oct 2010 18:50:50 +0000
parents 01acc9fc35ea
children
comparison
equal deleted inserted replaced
653:01acc9fc35ea 654:5d6b1820b953
51 m_bpp = rhs.getBPP(); 51 m_bpp = rhs.getBPP();
52 m_SDLFlags = rhs.getSDLFlags(); 52 m_SDLFlags = rhs.getSDLFlags();
53 } 53 }
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
57 //sort by fullscreen first
58 if (!isFullScreen() && rhs.isFullScreen()){
57 return true; 59 return true;
58 } 60 }
59 61 else if (isFullScreen() && !rhs.isFullScreen()){
60 else if (m_bpp == rhs.getBPP()) { 62 return false;
61 if (m_width == rhs.getWidth() && m_height == rhs.getHeight()){ 63 }
62 if (!(m_SDLFlags & SDL_HWSURFACE) && (rhs.getSDLFlags() & SDL_HWSURFACE)) { 64
63 //I would like return true so that we prefer hardware surfaces but 65 //next by bpp
64 //it really slows the engine down in fullscreen. See the SDL FAQ for an 66 if (m_bpp < rhs.getBPP()){
65 //explanation. 67 return true;
66 return false; 68 }
67 } 69 else if (m_bpp > rhs.getBPP()){
68 } 70 return false;
69 71 }
70 else if (m_width < rhs.getWidth() || m_height < rhs.getHeight()) { 72
71 return true; 73 //then by screen dimentions
72 } 74 if (m_width == rhs.getWidth() && m_height == rhs.getHeight()){
73 } 75 if (!(m_SDLFlags & SDL_HWSURFACE) && (rhs.getSDLFlags() & SDL_HWSURFACE)) {
76 //I would like return true so that we prefer hardware surfaces but
77 //it really slows the engine down in fullscreen. See the SDL FAQ for an
78 //explanation.
79 return false;
80 }
81 }
82
83 else if (m_width < rhs.getWidth() || m_height < rhs.getHeight()) {
84 return true;
85 }
86
74 return false; 87 return false;
75 } 88 }
76 89
77 DeviceCaps::DeviceCaps() : 90 DeviceCaps::DeviceCaps() :
78 m_driverName("Invalid"), 91 m_driverName("Invalid"),