FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
enginesettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2017 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_ENGINESETTINGS_H
23 #define FIFE_ENGINESETTINGS_H
24 
25 // Standard C++ library includes
26 #include <vector>
27 
28 // 3rd party library includes
29 
30 // FIFE includes
31 // These includes are split up in two parts, separated by one empty line
32 // First block: files included from the FIFE root src directory
33 // Second block: files included from the same folder
34 #include "util/base/exception.h"
35 #include "video/renderbackend.h"
36 
37 namespace FIFE {
38  class NotSupported;
39 
44  public:
48 
52 
56  void setBitsPerPixel(uint8_t bitsperpixel);
57 
61  return m_bitsperpixel;
62  }
63 
66  std::vector<uint8_t> getPossibleBitsPerPixel() const;
67 
70  void setFullScreen(bool fullscreen) {
71  m_fullscreen = fullscreen;
72  }
73 
76  bool isFullScreen() const {
77  return m_fullscreen;
78  }
79 
82  void setRefreshRate(uint16_t rate) {
83  m_refreshRate = rate;
84  }
85 
89  return m_refreshRate;
90  }
91 
94  void setDisplay(uint8_t display) {
95  m_displayIndex = display;
96  }
97 
100  uint8_t getDisplay() const {
101  return m_displayIndex;
102  }
103 
106  void setVSync(bool vsync) {
107  m_vSync = vsync;
108  }
109 
112  bool isVSync() const {
113  return m_vSync;
114  }
115 
121  void setSDLDriver(const std::string& driver) {
122  m_renderDriver = driver;
123  }
124 
129  const std::string& getSDLDriver() const {
130  return m_renderDriver;
131  }
132 
136  void setInitialVolume(float volume);
137 
140  float getInitialVolume() const {
141  return m_initialvolume;
142  }
143 
146  float getMaxVolume() const;
147 
151  void setRenderBackend(const std::string& renderbackend);
152 
155  const std::string& getRenderBackend() const {
156  return m_renderbackend;
157  }
158 
161  std::string getRenderBackend() {
162  return m_renderbackend;
163  }
164 
167  std::vector<std::string> getPossibleRenderBackends();
168 
171  void setSDLRemoveFakeAlpha(bool sdlremovefakealpha);
172 
175  bool isSDLRemoveFakeAlpha() const {
176  return m_sdlremovefakealpha;
177  }
178 
181  void setGLCompressImages(bool oglcompressimages);
182 
185  bool isGLCompressImages() const {
186  return m_oglcompressimages;
187  }
188 
191  void setGLUseFramebuffer(bool ogluseframebuffer);
192 
195  bool isGLUseFramebuffer() const {
196  return m_ogluseframebuffer;
197  }
198 
201  void setGLUseNPOT(bool oglusenpot);
202 
205  bool isGLUseNPOT() const {
206  return m_oglusenpot;
207  }
208 
212 
216 
219  void setGLUseMipmapping(bool mipmapping);
220 
223  bool isGLUseMipmapping() const;
224 
227  void setGLUseMonochrome(bool monochrome);
228 
231  bool isGLUseMonochrome() const;
232 
235  void setGLUseDepthBuffer(bool buffer);
236 
239  bool isGLUseDepthBuffer() const;
240 
243  void setGLAlphaTestValue(float alpha);
244 
247  float getGLAlphaTestValue() const;
248 
251  void setScreenWidth(uint16_t screenwidth);
252 
256  return m_screenwidth;
257  }
258 
261  void setScreenHeight(uint16_t screenheight);
262 
266  return m_screenheight;
267  }
268 
271  void setDefaultFontPath(const std::string& defaultfontpath);
272 
275  const std::string& getDefaultFontPath() const {
276  return m_defaultfontpath;
277  }
278 
281  std::string getDefaultFontPath() {
282  return m_defaultfontpath;
283  }
284 
287  void setDefaultFontSize(uint16_t defaultfontsize);
288 
292  return m_defaultfontsize;
293  }
294 
297  void setDefaultFontGlyphs(const std::string& defaultfontglyphs);
298 
301  const std::string& getDefaultFontGlyphs() const {
302  return m_defaultfontglyphs;
303  }
304 
307  std::string getDefaultFontGlyphs() {
308  return m_defaultfontglyphs;
309  }
310 
313  void setWindowTitle(const std::string& title);
314 
317  const std::string& getWindowTitle() const {
318  return m_windowtitle;
319  }
320 
323  std::string getWindowTitle() {
324  return m_windowtitle;
325  }
326 
329  void setWindowIcon(const std::string& icon);
330 
333  const std::string& getWindowIcon() const {
334  return m_windowicon;
335  }
336 
339  std::string getWindowIcon() {
340  return m_windowicon;
341  }
342 
345  void setColorKeyEnabled(bool colorkeyenable);
346 
349  bool isColorKeyEnabled() const;
350 
353  void setColorKey(uint8_t r, uint8_t g, uint8_t b);
354 
357  const SDL_Color& getColorKey() const;
358 
363  void setVideoDriver(const std::string& driver);
364 
369  const std::string& getVideoDriver() const;
370 
373  void setLightingModel(uint32_t lighting);
374 
378  return m_lighting;
379  }
380 
383  void setFrameLimitEnabled(bool limited);
384 
387  bool isFrameLimitEnabled() const;
388 
391  void setFrameLimit(uint16_t framelimit);
392 
395  uint16_t getFrameLimit() const;
396 
399  void setMouseSensitivity(float sens);
400 
403  float getMouseSensitivity() const;
404 
409  void setMouseAccelerationEnabled(bool acceleration);
410 
415  bool isMouseAccelerationEnabled() const;
416 
420  void setNativeImageCursorEnabled(bool nativeimagecursor);
421 
425  bool isNativeImageCursorEnabled() const;
426 
429  void setJoystickSupport(bool support);
430 
433  bool isJoystickSupport() const;
434 
435  private:
440  bool m_vSync;
441  std::string m_renderDriver;
443  std::string m_renderbackend;
455  std::string m_windowtitle;
456  std::string m_windowicon;
457 
458 
459  std::string m_defaultfontpath;
461  std::string m_defaultfontglyphs;
463  SDL_Color m_colorkey;
464  std::string m_videodriver;
472  };
473 
474 }//FIFE
475 
476 #endif
477 
bool isGLUseMonochrome() const
Tells if OpenGL renderbackend should render only monochrome.
std::string getDefaultFontGlyphs()
Gets current glyphs for default font.
void setDefaultFontSize(uint16_t defaultfontsize)
Sets size for default font.
This class defines the engine settings on engine init.
float getMaxVolume() const
Gets maximum volume that can be set.
bool isVSync() const
True, if vsync is enable, otherwise false.
std::string getDefaultFontPath()
Gets current path for default font.
bool isColorKeyEnabled() const
Gets whether the colorkey feature is in use.
~EngineSettings()
Destructor.
void setGLUseFramebuffer(bool ogluseframebuffer)
Sets if OpenGL renderbackend should use FramebufferObject (when available)
void setSDLDriver(const std::string &driver)
Sets the used SDL render driver.
void setFrameLimitEnabled(bool limited)
Sets whether to use the frame limiter.
void setInitialVolume(float volume)
Sets initial engine sound volume.
void setSDLRemoveFakeAlpha(bool sdlremovefakealpha)
Sets if fake alpha is removed in SDL renderbackend.
void setDefaultFontGlyphs(const std::string &defaultfontglyphs)
Sets glyphs for default font.
TextureFiltering m_oglTextureFilter
EngineSettings()
Constructor.
void setMouseSensitivity(float sens)
Sets mouse sensitivity.
bool isFrameLimitEnabled() const
Gets whether the frame limiter is in use.
void setGLUseMonochrome(bool monochrome)
Sets if OpenGL renderbackend should render only monochrome.
void setGLTextureFiltering(TextureFiltering filter)
Sets texture filtering method for OpenGL renderbackend.
std::string m_defaultfontglyphs
std::string getWindowIcon()
Gets the icon in the window title bar.
void setFullScreen(bool fullscreen)
Sets fullscreen / windowed mode.
uint16_t getDefaultFontSize() const
Gets size for default font.
uint16_t getScreenHeight() const
Gets screen height (pixels)
void setColorKeyEnabled(bool colorkeyenable)
Sets whether to use the colorkey feature.
const SDL_Color & getColorKey() const
Gets the global colorkey setting.
const std::string & getVideoDriver() const
Gets the video driver.
const std::string & getWindowTitle() const
Gets the current window title.
bool isGLUseNPOT() const
Tells if OpenGL renderbackend should use NPOT Textures.
void setGLCompressImages(bool oglcompressimages)
Sets if images are compress by video driver in OpenGL renderbackend.
uint16_t getScreenWidth() const
Gets screen width (pixels)
void setNativeImageCursorEnabled(bool nativeimagecursor)
Enables or disables native image cursor.
void setWindowTitle(const std::string &title)
Sets the title of the window.
unsigned char uint8_t
Definition: core.h:38
float getMouseSensitivity() const
Gets mouse sensitivity.
bool isGLUseMipmapping() const
Tells if OpenGL renderbackend should use mipmapping.
void setDefaultFontPath(const std::string &defaultfontpath)
Sets path for default font.
void setGLUseDepthBuffer(bool buffer)
Sets if OpenGL renderbackend should use depth buffer.
void setGLUseMipmapping(bool mipmapping)
Sets if OpenGL renderbackend should use mipmapping.
bool isGLCompressImages() const
Tells if images are compress by video driver in OpenGL renderbackend.
TextureFiltering getGLTextureFiltering() const
Gets current texture filter which uses OpenGL.
std::string m_defaultfontpath
uint16_t getRefreshRate() const
Gets the refresh rate.
void setScreenHeight(uint16_t screenheight)
Sets screen height (pixels)
const std::string & getDefaultFontPath() const
Gets current path for default font.
float getInitialVolume() const
Gets initial engine sound volume.
void setFrameLimit(uint16_t framelimit)
Sets the frame limit.
void setGLAlphaTestValue(float alpha)
Sets alpha test value for OpenGL renderbackend.
std::string getWindowTitle()
Gets the current window title.
const std::string & getRenderBackend() const
Gets currently set renderbackend name.
uint8_t getBitsPerPixel() const
Gets currently set bits per pixel value.
void setRenderBackend(const std::string &renderbackend)
Sets name for renderbackend.
unsigned short uint16_t
Definition: core.h:39
void setJoystickSupport(bool support)
Enables or disables joystick and gamepad support.
void setScreenWidth(uint16_t screenwidth)
Sets screen width (pixels)
void setColorKey(uint8_t r, uint8_t g, uint8_t b)
Sets the global colorkey to use for images.
std::vector< uint8_t > getPossibleBitsPerPixel() const
Gets all possible bits per pixel values.
uint8_t getDisplay() const
Gets the display index, starts with 0.
bool isMouseAccelerationEnabled() const
Returns if mouse acceleration is enabled or not.
std::string m_renderDriver
bool isSDLRemoveFakeAlpha() const
Tells if fake alpha is removed in SDL renderbackend.
std::string m_windowtitle
const std::string & getSDLDriver() const
Gets the used SDL render driver.
uint16_t getFrameLimit() const
Gets the frame limit.
float getGLAlphaTestValue() const
Gets current alpha test value which uses OpenGL.
std::string m_windowicon
bool isGLUseFramebuffer() const
Tells if OpenGL renderbackend should use FramebufferObject.
bool isJoystickSupport() const
Returns whether joystick and gamepad support is enabled or not.
void setGLUseNPOT(bool oglusenpot)
Sets if OpenGL renderbackend should use NPOT Textures (when available)
bool isNativeImageCursorEnabled() const
Returns whether cursors set to an image or an animation are drawn natively.
void setVSync(bool vsync)
Sets Vsync.
bool isFullScreen() const
True, if set to fullscreen.
void setBitsPerPixel(uint8_t bitsperpixel)
Sets bits per pixel.
TextureFiltering
Definition: renderbackend.h:99
void setMouseAccelerationEnabled(bool acceleration)
Sets mouse acceleration if mouse acceleration is enabled, then the mouse sensitivity is used as speed...
void setDisplay(uint8_t display)
Sets display index, starts with 0.
void setLightingModel(uint32_t lighting)
Sets the light model.
void setWindowIcon(const std::string &icon)
Sets the icon that appears in the window title bar.
void setRefreshRate(uint16_t rate)
Sets refresh rate.
uint32_t getLightingModel() const
Gets the currently set light model.
void setVideoDriver(const std::string &driver)
Sets the video driver.
std::string m_videodriver
const std::string & getWindowIcon() const
Gets the icon in the window title bar.
unsigned int uint32_t
Definition: core.h:40
bool isGLUseDepthBuffer() const
Tells if OpenGL renderbackend should use depth buffer.
std::string getRenderBackend()
Gets currently set renderbackend name.
const std::string & getDefaultFontGlyphs() const
Gets current glyphs for default font.
std::string m_renderbackend
std::vector< std::string > getPossibleRenderBackends()
Gets all possible renderbackend names.