Mercurial > fife-parpg
diff engine/core/controller/enginesettings.cpp @ 112:98541d3b9220
* add some std types to swig wrapper (fife.i.templ)
* remove the types in interfaces that used them
* add possibility to list video modes to engine settings class
author | spq@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sun, 27 Jul 2008 13:36:03 +0000 |
parents | 18c2a21ac0ad |
children | ad7969d9460b |
line wrap: on
line diff
--- a/engine/core/controller/enginesettings.cpp Sat Jul 26 17:35:02 2008 +0000 +++ b/engine/core/controller/enginesettings.cpp Sun Jul 27 13:36:03 2008 +0000 @@ -24,6 +24,7 @@ #include <string> // 3rd party library includes +#include <SDL.h> // FIFE includes // These includes are split up in two parts, separated by one empty line @@ -64,7 +65,19 @@ throw NotSet("Glyphs for default font are not set"); } } - + + std::vector<std::pair<unsigned int, unsigned int> > EngineSettings::getPossibleResolutions() const { + SDL_Rect **modes = SDL_ListModes(NULL, ((getRenderBackend() != "SDL") ? (SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL) : 0) | (isFullScreen() ? SDL_FULLSCREEN : 0)); + if(modes == (SDL_Rect **)0) + throw NotFound("No VideoMode Found"); + + std::vector<std::pair<unsigned int, unsigned int> > result; + if(modes != (SDL_Rect **)-1) + for(unsigned int i = 0; modes[i]; ++i) + result.push_back(std::pair<unsigned int, unsigned int>(modes[i]->w, modes[i]->h)); + return result; + } + void EngineSettings::setBitsPerPixel(unsigned int bitsperpixel) { std::vector<unsigned int> pv = getPossibleBitsPerPixel(); std::vector<unsigned int>::iterator i = std::find(pv.begin(), pv.end(), bitsperpixel);