Mercurial > fife-parpg
diff engine/core/video/opengl/renderbackendopengl.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 | 01acc9fc35ea |
line wrap: on
line diff
--- a/engine/core/video/opengl/renderbackendopengl.cpp Thu Oct 07 19:39:58 2010 +0000 +++ b/engine/core/video/opengl/renderbackendopengl.cpp Fri Oct 08 21:22:02 2010 +0000 @@ -28,6 +28,8 @@ // FIFE includes #include "util/base/exception.h" +#include "util/log/logger.h" +#include "video/devicecaps.h" #include "fife_opengl.h" #include "glimage.h" @@ -35,6 +37,7 @@ #include "SDL_image.h" namespace FIFE { + static Logger _log(LM_VIDEO); RenderBackendOpenGL::RenderBackendOpenGL(const SDL_Color& colorkey) : RenderBackend(colorkey) { // Get the pixelformat we want. @@ -72,15 +75,16 @@ glClear(GL_COLOR_BUFFER_BIT); } - Image* RenderBackendOpenGL::createMainScreen(unsigned int width, unsigned int height, unsigned char bitsPerPixel, bool fs, const std::string& title, const std::string& icon) { + Image* RenderBackendOpenGL::createMainScreen(const ScreenMode& mode, const std::string& title, const std::string& icon){ + unsigned int width = mode.getWidth(); + unsigned int height = mode.getHeight(); + unsigned char bitsPerPixel = mode.getBPP(); + bool fs = mode.isFullScreen(); + Uint32 flags = mode.getSDLFlags(); + delete m_screen; m_screen = 0; - Uint32 flags = SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL; - if ( fs ) { - flags |= SDL_FULLSCREEN; - } - if(icon != "") { SDL_Surface *img = IMG_Load(icon.c_str()); if(img != NULL) { @@ -115,6 +119,10 @@ screen = SDL_SetVideoMode(width, height, bitsPerPixel, flags); } + FL_LOG(_log, LMsg("RenderBackendOpenGL") + << "Videomode " << width << "x" << height + << " at " << int(bitsPerPixel) << " bpp"); + SDL_WM_SetCaption(title.c_str(), 0); if (!screen) {