Mercurial > fife-parpg
changeset 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 | abfe54ebae15 |
children | 9e3226d1e434 |
files | engine/core/controller/engine.i engine/core/controller/enginesettings.cpp engine/core/controller/enginesettings.h engine/core/model/model.i engine/core/model/structures/layer.i engine/core/model/structures/map.i engine/core/vfs/vfs.i engine/swigwrappers/lua/fife.i.templ engine/swigwrappers/python/fife.i.templ |
diffstat | 9 files changed, 31 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/core/controller/engine.i Sat Jul 26 17:35:02 2008 +0000 +++ b/engine/core/controller/engine.i Sun Jul 27 13:36:03 2008 +0000 @@ -47,6 +47,7 @@ void setBitsPerPixel(unsigned int bitsperpixel); unsigned int getBitsPerPixel() const; std::vector<unsigned int> getPossibleBitsPerPixel() const; + std::vector<std::pair<unsigned int, unsigned int> > getPossibleResolutions() const; void setFullScreen(bool fullscreen); bool isFullScreen() const; void setInitialVolume(float volume);
--- 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);
--- a/engine/core/controller/enginesettings.h Sat Jul 26 17:35:02 2008 +0000 +++ b/engine/core/controller/enginesettings.h Sun Jul 27 13:36:03 2008 +0000 @@ -67,7 +67,11 @@ /** Gets all possible bits per pixel values */ std::vector<unsigned int> getPossibleBitsPerPixel() const; - + + /** Gets all possible screen resolutions + */ + std::vector<std::pair<unsigned int, unsigned int> > getPossibleResolutions() const; + /** Sets fullscreen / windowed mode */ void setFullScreen(bool fullscreen) {
--- a/engine/core/model/model.i Sat Jul 26 17:35:02 2008 +0000 +++ b/engine/core/model/model.i Sun Jul 27 13:36:03 2008 +0000 @@ -24,8 +24,6 @@ #include "model/model.h" %} -%include "std_list.i" - namespace FIFE { class Map; class Object;
--- a/engine/core/model/structures/layer.i Sat Jul 26 17:35:02 2008 +0000 +++ b/engine/core/model/structures/layer.i Sun Jul 27 13:36:03 2008 +0000 @@ -24,8 +24,6 @@ #include "model/structures/layer.h" %} -%include "std_vector.i" - %include "model/metamodel/modelcoords.i" %include "model/metamodel/grids/cellgrids.i" %include "util/structures/utilstructures.i"
--- a/engine/core/model/structures/map.i Sat Jul 26 17:35:02 2008 +0000 +++ b/engine/core/model/structures/map.i Sun Jul 27 13:36:03 2008 +0000 @@ -24,8 +24,6 @@ #include "model/structures/map.h" %} -%include "std_list.i" - %include "util/base/utilbase.i" namespace FIFE {
--- a/engine/core/vfs/vfs.i Sat Jul 26 17:35:02 2008 +0000 +++ b/engine/core/vfs/vfs.i Sun Jul 27 13:36:03 2008 +0000 @@ -26,7 +26,6 @@ %} %include "vfs/raw/rawdata.i" -%include "std_set.i" namespace std{ %template(StringSet) set<std::string>;
--- a/engine/swigwrappers/lua/fife.i.templ Sat Jul 26 17:35:02 2008 +0000 +++ b/engine/swigwrappers/lua/fife.i.templ Sun Jul 27 13:36:03 2008 +0000 @@ -1,7 +1,10 @@ %module fife %include "std_string.i" %include "std_vector.i" +%include "std_pair.i" +%include "std_list.i" +%include "std_set.i" $inclusions -%include swigwrappers/python/intmaps.i.templ \ No newline at end of file +%include swigwrappers/python/intmaps.i.templ
--- a/engine/swigwrappers/python/fife.i.templ Sat Jul 26 17:35:02 2008 +0000 +++ b/engine/swigwrappers/python/fife.i.templ Sun Jul 27 13:36:03 2008 +0000 @@ -1,6 +1,10 @@ %module(directors="1") fife %include "std_string.i" %include "std_vector.i" +%include "std_pair.i" +%include "std_list.i" +%include "std_map.i" +%include "std_set.i" %include "typemaps.i" %include "exception.i" @@ -27,6 +31,9 @@ %template(FloatVector) vector<float>; %template(DoubleVector) vector<double>; %template(BoolVector) vector<bool>; + + %template(UintUintPair) pair<unsigned int, unsigned int>; + %template(UintUintPairVector) vector<std::pair<unsigned int, unsigned int> >; }; %{