# HG changeset patch # User prock@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1286307774 0 # Node ID a7909cdcdc8557a06c074586a17d435f9ad0625c # Parent f3457443c95f7f7e247c4ab63ae7b0041cb37e84 * A little data type cleanup in the FIFE::EngineSettings class * Added some standard integer definitions diff -r f3457443c95f -r a7909cdcdc85 engine/core/controller/engine.i --- 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 getPossibleBitsPerPixel() const; - std::vector > getPossibleResolutions() const; + void setBitsPerPixel(uint8_t bitsperpixel); + uint8_t getBitsPerPixel() const; + std::vector getPossibleBitsPerPixel() const; + std::vector > getPossibleResolutions() const; void setFullScreen(bool fullscreen); bool isFullScreen() const; void setInitialVolume(float volume); @@ -58,14 +58,14 @@ std::vector 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: diff -r f3457443c95f -r a7909cdcdc85 engine/core/controller/enginesettings.cpp --- 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 > EngineSettings::getPossibleResolutions() const { + std::vector > 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 > result; + std::vector > result; if(modes != (SDL_Rect **)-1) for(unsigned int i = 0; modes[i]; ++i) - result.push_back(std::pair(modes[i]->w, modes[i]->h)); + result.push_back(std::pair(modes[i]->w, modes[i]->h)); return result; } - void EngineSettings::setBitsPerPixel(unsigned int bitsperpixel) { - std::vector pv = getPossibleBitsPerPixel(); - std::vector::iterator i = std::find(pv.begin(), pv.end(), bitsperpixel); + void EngineSettings::setBitsPerPixel(uint8_t bitsperpixel) { + std::vector pv = getPossibleBitsPerPixel(); + std::vector::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 EngineSettings::getPossibleBitsPerPixel() const { - std::vector tmp; + std::vector EngineSettings::getPossibleBitsPerPixel() const { + std::vector 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; diff -r f3457443c95f -r a7909cdcdc85 engine/core/controller/enginesettings.h --- 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 getPossibleBitsPerPixel() const; + std::vector getPossibleBitsPerPixel() const; /** Gets all possible screen resolutions */ - std::vector > getPossibleResolutions() const; + std::vector > 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; diff -r f3457443c95f -r a7909cdcdc85 engine/core/gui/base/gui_font.i --- 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 diff -r f3457443c95f -r a7909cdcdc85 engine/core/util/base/fife_stdint.h --- 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 * diff -r f3457443c95f -r a7909cdcdc85 engine/core/vfs/vfs.i --- 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; } -typedef unsigned char uint8_t; namespace std { %template(vectoru) vector; }; diff -r f3457443c95f -r a7909cdcdc85 engine/swigwrappers/python/fife.i.templ --- 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; %template(UintVector) vector;