Mercurial > fife-parpg
changeset 632:a7909cdcdc85
* A little data type cleanup in the FIFE::EngineSettings class
* Added some standard integer definitions
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 05 Oct 2010 19:42:54 +0000 |
parents | f3457443c95f |
children | 46b95d06c8c2 |
files | engine/core/controller/engine.i engine/core/controller/enginesettings.cpp engine/core/controller/enginesettings.h engine/core/gui/base/gui_font.i engine/core/util/base/fife_stdint.h engine/core/vfs/vfs.i engine/swigwrappers/python/fife.i.templ |
diffstat | 7 files changed, 71 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/core/controller/engine.i Tue Oct 05 15:44:16 2010 +0000 +++ b/engine/core/controller/engine.i Tue Oct 05 19:42:54 2010 +0000 @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * + * Copyright (C) 2005-2010 by the FIFE team * + * http://www.fifengine.net * * This file is part of FIFE. * * * * FIFE is free software; you can redistribute it and/or * @@ -44,10 +44,10 @@ public: ~EngineSettings(); void validate() const; - 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 setBitsPerPixel(uint8_t bitsperpixel); + uint8_t getBitsPerPixel() const; + std::vector<uint8_t> getPossibleBitsPerPixel() const; + std::vector<std::pair<uint16_t, uint16_t> > getPossibleResolutions() const; void setFullScreen(bool fullscreen); bool isFullScreen() const; void setInitialVolume(float volume); @@ -58,14 +58,14 @@ std::vector<std::string> getPossibleRenderBackends(); void setSDLRemoveFakeAlpha(bool sdlremovefakealpha); bool isSDLRemoveFakeAlpha(bool sdlremovefakealpha) const; - void setScreenWidth(unsigned int screenwidth); - unsigned int getScreenWidth() const; - void setScreenHeight(unsigned int screenheight); - unsigned int getScreenHeight() const; + void setScreenWidth(uint16_t screenwidth); + uint16_t getScreenWidth() const; + void setScreenHeight(uint16_t screenheight); + uint16_t getScreenHeight() const; void setDefaultFontPath(const std::string& defaultfontpath); std::string getDefaultFontPath() const; - void setDefaultFontSize(const unsigned int defaultfontsize); - unsigned int getDefaultFontSize() const; + void setDefaultFontSize(uint16_t defaultfontsize); + uint16_t getDefaultFontSize() const; void setDefaultFontGlyphs(const std::string& defaultfontglyphs); std::string getDefaultFontGlyphs() const; void setWindowTitle(const std::string& title); @@ -74,7 +74,7 @@ std::string getWindowIcon() const; void setColorKeyEnabled(bool colorkeyenable); bool isColorKeyEnabled() const; - void setColorKey(Uint8 r, Uint8 g, Uint8 b); + void setColorKey(uint8_t r, uint8_t g, uint8_t b); const SDL_Color& getColorKey() const; private:
--- a/engine/core/controller/enginesettings.cpp Tue Oct 05 15:44:16 2010 +0000 +++ b/engine/core/controller/enginesettings.cpp Tue Oct 05 19:42:54 2010 +0000 @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * + * Copyright (C) 2005-2010 by the FIFE team * + * http://www.fifengine.net * * This file is part of FIFE. * * * * FIFE is free software; you can redistribute it and/or * @@ -69,21 +69,21 @@ } } - std::vector<std::pair<unsigned int, unsigned int> > EngineSettings::getPossibleResolutions() const { + std::vector<std::pair<uint16_t, uint16_t> > 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; + std::vector<std::pair<uint16_t, uint16_t> > 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)); + result.push_back(std::pair<uint16_t, uint16_t>(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); + void EngineSettings::setBitsPerPixel(uint8_t bitsperpixel) { + std::vector<uint8_t> pv = getPossibleBitsPerPixel(); + std::vector<uint8_t>::iterator i = std::find(pv.begin(), pv.end(), bitsperpixel); if (i != pv.end()) { m_bitsperpixel = bitsperpixel; return; @@ -91,8 +91,8 @@ throw NotSupported("Given bits per pixel value is not supported"); } - std::vector<unsigned int> EngineSettings::getPossibleBitsPerPixel() const { - std::vector<unsigned int> tmp; + std::vector<uint8_t> EngineSettings::getPossibleBitsPerPixel() const { + std::vector<uint8_t> tmp; tmp.push_back(0); tmp.push_back(16); tmp.push_back(24); @@ -135,11 +135,11 @@ m_sdlremovefakealpha = sdlremovefakealpha; } - void EngineSettings::setScreenWidth(unsigned int screenwidth) { + void EngineSettings::setScreenWidth(uint16_t screenwidth) { m_screenwidth = screenwidth; } - void EngineSettings::setScreenHeight(unsigned int screenheight) { + void EngineSettings::setScreenHeight(uint16_t screenheight) { m_screenheight = screenheight; } @@ -147,7 +147,7 @@ m_defaultfontpath = defaultfontpath; } - void EngineSettings::setDefaultFontSize(const unsigned int defaultfontsize) { + void EngineSettings::setDefaultFontSize(uint16_t defaultfontsize) { m_defaultfontsize = defaultfontsize; } @@ -171,7 +171,7 @@ return m_iscolorkeyenabled; } - void EngineSettings::setColorKey(Uint8 r, Uint8 g, Uint8 b) { + void EngineSettings::setColorKey(uint8_t r, uint8_t g, uint8_t b) { m_colorkey.r = r; m_colorkey.g = g; m_colorkey.b = b;
--- a/engine/core/controller/enginesettings.h Tue Oct 05 15:44:16 2010 +0000 +++ b/engine/core/controller/enginesettings.h Tue Oct 05 19:42:54 2010 +0000 @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * + * Copyright (C) 2005-2010 by the FIFE team * + * http://www.fifengine.net * * This file is part of FIFE. * * * * FIFE is free software; you can redistribute it and/or * @@ -56,7 +56,7 @@ /** Sets bits per pixel * @see getPossibleBitsPerPixel */ - void setBitsPerPixel(unsigned int bitsperpixel); + void setBitsPerPixel(uint8_t bitsperpixel); /** Gets currently set bits per pixel value */ @@ -66,11 +66,11 @@ /** Gets all possible bits per pixel values */ - std::vector<unsigned int> getPossibleBitsPerPixel() const; + std::vector<uint8_t> getPossibleBitsPerPixel() const; /** Gets all possible screen resolutions */ - std::vector<std::pair<unsigned int, unsigned int> > getPossibleResolutions() const; + std::vector<std::pair<uint16_t, uint16_t> > getPossibleResolutions() const; /** Sets fullscreen / windowed mode */ @@ -126,7 +126,7 @@ /** Sets screen width (pixels) */ - void setScreenWidth(unsigned int screenwidth); + void setScreenWidth(uint16_t screenwidth); /** Gets screen width (pixels) */ @@ -136,7 +136,7 @@ /** Sets screen height (pixels) */ - void setScreenHeight(unsigned int screenheight); + void setScreenHeight(uint16_t screenheight); /** Gets screen height (pixels) */ @@ -156,11 +156,11 @@ /** Sets size for default font */ - void setDefaultFontSize(const unsigned int defaultfontsize); + void setDefaultFontSize(uint16_t defaultfontsize); /** Gets size for default font */ - unsigned int getDefaultFontSize() const { + uint16_t getDefaultFontSize() const { return m_defaultfontsize; } @@ -204,26 +204,26 @@ /** Sets the global colorkey to use for images */ - void setColorKey(Uint8 r, Uint8 g, Uint8 b); + void setColorKey(uint8_t r, uint8_t g, uint8_t b); /** Gets the global colorkey setting */ const SDL_Color& getColorKey() const; private: - unsigned int m_bitsperpixel; + uint8_t m_bitsperpixel; bool m_fullscreen; float m_initialvolume; std::string m_renderbackend; bool m_sdlremovefakealpha; - unsigned int m_screenwidth; - unsigned int m_screenheight; + uint16_t m_screenwidth; + uint16_t m_screenheight; std::string m_windowtitle; std::string m_windowicon; std::string m_defaultfontpath; - unsigned int m_defaultfontsize; + uint16_t m_defaultfontsize; std::string m_defaultfontglyphs; bool m_iscolorkeyenabled; SDL_Color m_colorkey;
--- a/engine/core/gui/base/gui_font.i Tue Oct 05 15:44:16 2010 +0000 +++ b/engine/core/gui/base/gui_font.i Tue Oct 05 19:42:54 2010 +0000 @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * + * Copyright (C) 2005-2010 by the FIFE team * + * http://www.fifengine.net * * This file is part of FIFE. * * * * FIFE is free software; you can redistribute it and/or * @@ -28,8 +28,6 @@ %include "video/fonts/fonts.i" -typedef unsigned char Uint8; - namespace gcn { class Graphics; class Font
--- a/engine/core/util/base/fife_stdint.h Tue Oct 05 15:44:16 2010 +0000 +++ b/engine/core/util/base/fife_stdint.h Tue Oct 05 19:42:54 2010 +0000 @@ -1,6 +1,6 @@ /*************************************************************************** * Copyright (C) 2005-2010 by the FIFE team * - * http://www.fifengine.net * + * http://www.fifengine.net * * This file is part of FIFE. * * * * FIFE is free software; you can redistribute it and/or *
--- a/engine/core/vfs/vfs.i Tue Oct 05 15:44:16 2010 +0000 +++ b/engine/core/vfs/vfs.i Tue Oct 05 19:42:54 2010 +0000 @@ -1,6 +1,6 @@ /*************************************************************************** - * Copyright (C) 2005-2008 by the FIFE team * - * http://www.fifengine.de * + * Copyright (C) 2005-2010 by the FIFE team * + * http://www.fifengine.net * * This file is part of FIFE. * * * * FIFE is free software; you can redistribute it and/or * @@ -31,7 +31,6 @@ %template(StringSet) set<std::string>; } -typedef unsigned char uint8_t; namespace std { %template(vectoru) vector<uint8_t>; };
--- a/engine/swigwrappers/python/fife.i.templ Tue Oct 05 15:44:16 2010 +0000 +++ b/engine/swigwrappers/python/fife.i.templ Tue Oct 05 19:42:54 2010 +0000 @@ -24,6 +24,31 @@ %feature("autodoc", "1"); // 0 == no param types, 1 == show param types +/** + * Integer definitions (See swigs stdint.i implementation) + * + */ + +/* Signed. */ +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +#if defined(SWIGWORDSIZE64) +typedef long int int64_t; +#else +typedef long long int int64_t; +#endif + +/* Unsigned. */ +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +#if defined(SWIGWORDSIZE64) +typedef unsigned long int uint64_t; +#else +typedef unsigned long long int uint64_t; +#endif + namespace std { %template(StringVector) vector<std::string>; %template(UintVector) vector<unsigned int>;