enginesettings.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005-2008 by the FIFE team                              *
00003  *   http://www.fifengine.de                                               *
00004  *   This file is part of FIFE.                                            *
00005  *                                                                         *
00006  *   FIFE is free software; you can redistribute it and/or                 *
00007  *   modify it under the terms of the GNU Lesser General Public            *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2.1 of the License, or (at your option) any later version.    *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the                 *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
00020  ***************************************************************************/
00021 
00022 #ifndef FIFE_ENGINESETTINGS_H
00023 #define FIFE_ENGINESETTINGS_H
00024 
00025 // Standard C++ library includes
00026 #include <vector>
00027 
00028 // 3rd party library includes
00029 
00030 // FIFE includes
00031 // These includes are split up in two parts, separated by one empty line
00032 // First block: files included from the FIFE root src directory
00033 // Second block: files included from the same folder
00034 #include "util/base/exception.h"
00035 
00036 namespace FIFE {
00037     class NotSupported;
00038 
00042     class EngineSettings {
00043     public:
00046         EngineSettings();
00047         
00050         ~EngineSettings();
00051         
00054         void validate() const;
00055         
00059         void setBitsPerPixel(unsigned int bitsperpixel);
00060         
00063         unsigned int getBitsPerPixel() const { 
00064             return m_bitsperpixel;
00065         }
00066         
00069         std::vector<unsigned int> getPossibleBitsPerPixel() const;
00070 
00073         std::vector<std::pair<unsigned int, unsigned int> > getPossibleResolutions() const;
00074 
00077         void setFullScreen(bool fullscreen) { 
00078             m_fullscreen = fullscreen;
00079         }
00080         
00083         bool isFullScreen() const { 
00084             return m_fullscreen;
00085         }
00086         
00090         void setInitialVolume(float volume);
00091         
00094         float getInitialVolume() const {
00095             return m_initialvolume;
00096         }
00097         
00100         float getMaxVolume() const;
00101         
00105         void setRenderBackend(const std::string& renderbackend);
00106         
00109         const std::string getRenderBackend() const {
00110             return m_renderbackend;
00111         }
00112         
00115         std::vector<std::string> getPossibleRenderBackends();
00116         
00119         void setSDLRemoveFakeAlpha(bool sldremovefakealpha);
00120         
00123         bool isSDLRemoveFakeAlpha(bool sldremovefakealpha) const {
00124             return m_sldremovefakealpha;
00125         }
00126         
00129         void setScreenWidth(unsigned int screenwidth);
00130         
00133         unsigned int getScreenWidth() const {
00134             return m_screenwidth;
00135         }
00136         
00139         void setScreenHeight(unsigned int screenheight);
00140         
00143         unsigned int getScreenHeight() const {
00144             return m_screenheight;
00145         }
00146         
00149         void setDefaultFontPath(const std::string& defaultfontpath);
00150         
00153         std::string getDefaultFontPath() const {
00154             return m_defaultfontpath;
00155         }
00156         
00159         void setDefaultFontSize(const unsigned int defaultfontsize);
00160         
00163         unsigned int getDefaultFontSize() const {
00164             return m_defaultfontsize;
00165         }
00166         
00169         void setDefaultFontGlyphs(const std::string& defaultfontglyphs);
00170         
00173         std::string getDefaultFontGlyphs() const {
00174             return m_defaultfontglyphs;
00175         }
00176     
00179         void setImageChunkingSize(unsigned int size) {
00180             m_image_chunking_size = size;
00181         }
00182     
00185         unsigned int getImageChunkingSize() const {
00186             return m_image_chunking_size;
00187         }
00188 
00191         void setWindowTitle(const std::string& title);
00192 
00195         std::string getWindowTitle() const {
00196             return m_windowtitle;
00197         }
00198     
00201         void setWindowIcon(const std::string& icon);
00202 
00205         std::string getWindowIcon() const {
00206             return m_windowicon;
00207         }
00208 
00211         void setColorKeyEnabled(bool colorkeyenable);
00212 
00215         bool isColorKeyEnabled() const;
00216 
00219         void setColorKey(Uint8 r, Uint8 g, Uint8 b);
00220 
00223         const SDL_Color& getColorKey() const;
00224         
00225     private:
00226         unsigned int m_bitsperpixel;
00227         bool m_fullscreen;
00228         float m_initialvolume;
00229         std::string m_renderbackend;
00230         bool m_sldremovefakealpha;
00231         unsigned int m_screenwidth;
00232         unsigned int m_screenheight;
00233         std::string m_windowtitle;
00234         std::string m_windowicon;
00235         
00236         
00237         std::string m_defaultfontpath;
00238         unsigned int m_defaultfontsize;
00239         std::string m_defaultfontglyphs;
00240         unsigned int m_image_chunking_size;
00241         bool m_iscolorkeyenabled;
00242         SDL_Color m_colorkey;
00243     };
00244 
00245 }//FIFE
00246 
00247 #endif
00248