Mercurial > fife-parpg
comparison 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 |
comparison
equal
deleted
inserted
replaced
111:abfe54ebae15 | 112:98541d3b9220 |
---|---|
22 // Standard C++ library includes | 22 // Standard C++ library includes |
23 #include <algorithm> | 23 #include <algorithm> |
24 #include <string> | 24 #include <string> |
25 | 25 |
26 // 3rd party library includes | 26 // 3rd party library includes |
27 #include <SDL.h> | |
27 | 28 |
28 // FIFE includes | 29 // FIFE includes |
29 // These includes are split up in two parts, separated by one empty line | 30 // These includes are split up in two parts, separated by one empty line |
30 // First block: files included from the FIFE root src directory | 31 // First block: files included from the FIFE root src directory |
31 // Second block: files included from the same folder | 32 // Second block: files included from the same folder |
62 std::string::size_type loc = m_defaultfontpath.find(".ttf", 0); | 63 std::string::size_type loc = m_defaultfontpath.find(".ttf", 0); |
63 if ((loc == std::string::npos) && (m_defaultfontglyphs == "")) { | 64 if ((loc == std::string::npos) && (m_defaultfontglyphs == "")) { |
64 throw NotSet("Glyphs for default font are not set"); | 65 throw NotSet("Glyphs for default font are not set"); |
65 } | 66 } |
66 } | 67 } |
67 | 68 |
69 std::vector<std::pair<unsigned int, unsigned int> > EngineSettings::getPossibleResolutions() const { | |
70 SDL_Rect **modes = SDL_ListModes(NULL, ((getRenderBackend() != "SDL") ? (SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL) : 0) | (isFullScreen() ? SDL_FULLSCREEN : 0)); | |
71 if(modes == (SDL_Rect **)0) | |
72 throw NotFound("No VideoMode Found"); | |
73 | |
74 std::vector<std::pair<unsigned int, unsigned int> > result; | |
75 if(modes != (SDL_Rect **)-1) | |
76 for(unsigned int i = 0; modes[i]; ++i) | |
77 result.push_back(std::pair<unsigned int, unsigned int>(modes[i]->w, modes[i]->h)); | |
78 return result; | |
79 } | |
80 | |
68 void EngineSettings::setBitsPerPixel(unsigned int bitsperpixel) { | 81 void EngineSettings::setBitsPerPixel(unsigned int bitsperpixel) { |
69 std::vector<unsigned int> pv = getPossibleBitsPerPixel(); | 82 std::vector<unsigned int> pv = getPossibleBitsPerPixel(); |
70 std::vector<unsigned int>::iterator i = std::find(pv.begin(), pv.end(), bitsperpixel); | 83 std::vector<unsigned int>::iterator i = std::find(pv.begin(), pv.end(), bitsperpixel); |
71 if (i != pv.end()) { | 84 if (i != pv.end()) { |
72 m_bitsperpixel = bitsperpixel; | 85 m_bitsperpixel = bitsperpixel; |