1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
|
/***************************************************************************
* Copyright (C) 2005-2019 by the FIFE team *
* http://www.fifengine.net *
* This file is part of FIFE. *
* *
* FIFE is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef FIFE_ENGINESETTINGS_H
#define FIFE_ENGINESETTINGS_H
// Standard C++ library includes
#include <vector>
// 3rd party library includes
// FIFE includes
// These includes are split up in two parts, separated by one empty line
// First block: files included from the FIFE root src directory
// Second block: files included from the same folder
#include "util/base/exception.h"
#include "video/renderbackend.h"
namespace FIFE {
class NotSupported;
/** This class defines the engine settings on engine init
*
*/
class EngineSettings {
public:
/** Constructor
*/
EngineSettings();
/** Destructor
*/
~EngineSettings();
/** Sets bits per pixel
* @see getPossibleBitsPerPixel
*/
void setBitsPerPixel(uint8_t bitsperpixel);
/** Gets currently set bits per pixel value
*/
uint8_t getBitsPerPixel() const {
return m_bitsperpixel;
}
/** Gets all possible bits per pixel values
*/
std::vector<uint8_t> getPossibleBitsPerPixel() const;
/** Sets fullscreen / windowed mode
*/
void setFullScreen(bool fullscreen) {
m_fullscreen = fullscreen;
}
/** True, if set to fullscreen. False = windowed
*/
bool isFullScreen() const {
return m_fullscreen;
}
/** Sets refresh rate
*/
void setRefreshRate(uint16_t rate) {
m_refreshRate = rate;
}
/** Gets the refresh rate
*/
uint16_t getRefreshRate() const {
return m_refreshRate;
}
/** Sets display index, starts with 0
*/
void setDisplay(uint8_t display) {
m_displayIndex = display;
}
/** Gets the display index, starts with 0
*/
uint8_t getDisplay() const {
return m_displayIndex;
}
/** Sets Vsync. Synchronized updates with vertical refresh rate.
*/
void setVSync(bool vsync) {
m_vSync = vsync;
}
/** True, if vsync is enable, otherwise false.
*/
bool isVSync() const {
return m_vSync;
}
/** Sets the used SDL render driver. Values depends on platform
* and is useless for the OpenGL backend.
* If none is set, SDL use the first one that supports the requested flags.
* @see DeviceCaps::getAvailableRenderDrivers()
*/
void setSDLDriver(const std::string& driver) {
m_renderDriver = driver;
}
/** Gets the used SDL render driver.
* Default is a empty string, that indicates SDL chooses the driver.
* @see setSDLDriver()
*/
const std::string& getSDLDriver() const {
return m_renderDriver;
}
/** Sets initial engine sound volume
* @see getInitialMaxVolume
*/
void setInitialVolume(float volume);
/** Gets initial engine sound volume
*/
float getInitialVolume() const {
return m_initialvolume;
}
/** Gets maximum volume that can be set
*/
float getMaxVolume() const;
/** Sets name for renderbackend
* @see getPossibleRenderBackends
*/
void setRenderBackend(const std::string& renderbackend);
/** Gets currently set renderbackend name
*/
const std::string& getRenderBackend() const {
return m_renderbackend;
}
/** Gets currently set renderbackend name
*/
std::string getRenderBackend() {
return m_renderbackend;
}
/** Gets all possible renderbackend names
*/
std::vector<std::string> getPossibleRenderBackends();
/** Sets if fake alpha is removed in SDL renderbackend
*/
void setSDLRemoveFakeAlpha(bool sdlremovefakealpha);
/** Tells if fake alpha is removed in SDL renderbackend
*/
bool isSDLRemoveFakeAlpha() const {
return m_sdlremovefakealpha;
}
/** Sets if images are compress by video driver in OpenGL renderbackend
*/
void setGLCompressImages(bool oglcompressimages);
/** Tells if images are compress by video driver in OpenGL renderbackend
*/
bool isGLCompressImages() const {
return m_oglcompressimages;
}
/** Sets if OpenGL renderbackend should use FramebufferObject (when available)
*/
void setGLUseFramebuffer(bool ogluseframebuffer);
/** Tells if OpenGL renderbackend should use FramebufferObject
*/
bool isGLUseFramebuffer() const {
return m_ogluseframebuffer;
}
/** Sets if OpenGL renderbackend should use NPOT Textures (when available)
*/
void setGLUseNPOT(bool oglusenpot);
/** Tells if OpenGL renderbackend should use NPOT Textures
*/
bool isGLUseNPOT() const {
return m_oglusenpot;
}
/** Sets texture filtering method for OpenGL renderbackend.
*/
void setGLTextureFiltering(TextureFiltering filter);
/** Gets current texture filter which uses OpenGL.
*/
TextureFiltering getGLTextureFiltering() const;
/** Sets if OpenGL renderbackend should use mipmapping.
*/
void setGLUseMipmapping(bool mipmapping);
/** Tells if OpenGL renderbackend should use mipmapping.
*/
bool isGLUseMipmapping() const;
/** Sets if OpenGL renderbackend should render only monochrome.
*/
void setGLUseMonochrome(bool monochrome);
/** Tells if OpenGL renderbackend should render only monochrome.
*/
bool isGLUseMonochrome() const;
/** Sets if OpenGL renderbackend should use depth buffer.
*/
void setGLUseDepthBuffer(bool buffer);
/** Tells if OpenGL renderbackend should use depth buffer.
*/
bool isGLUseDepthBuffer() const;
/** Sets alpha test value for OpenGL renderbackend.
*/
void setGLAlphaTestValue(float alpha);
/** Gets current alpha test value which uses OpenGL.
*/
float getGLAlphaTestValue() const;
/** Sets screen width (pixels)
*/
void setScreenWidth(uint16_t screenwidth);
/** Gets screen width (pixels)
*/
uint16_t getScreenWidth() const {
return m_screenwidth;
}
/** Sets screen height (pixels)
*/
void setScreenHeight(uint16_t screenheight);
/** Gets screen height (pixels)
*/
uint16_t getScreenHeight() const {
return m_screenheight;
}
/** Sets path for default font
*/
void setDefaultFontPath(const std::string& defaultfontpath);
/** Gets current path for default font
*/
const std::string& getDefaultFontPath() const {
return m_defaultfontpath;
}
/** Gets current path for default font
*/
std::string getDefaultFontPath() {
return m_defaultfontpath;
}
/** Sets size for default font
*/
void setDefaultFontSize(uint16_t defaultfontsize);
/** Gets size for default font
*/
uint16_t getDefaultFontSize() const {
return m_defaultfontsize;
}
/** Sets glyphs for default font
*/
void setDefaultFontGlyphs(const std::string& defaultfontglyphs);
/** Gets current glyphs for default font
*/
const std::string& getDefaultFontGlyphs() const {
return m_defaultfontglyphs;
}
/** Gets current glyphs for default font
*/
std::string getDefaultFontGlyphs() {
return m_defaultfontglyphs;
}
/** Sets the title of the window
*/
void setWindowTitle(const std::string& title);
/** Gets the current window title
*/
const std::string& getWindowTitle() const {
return m_windowtitle;
}
/** Gets the current window title
*/
std::string getWindowTitle() {
return m_windowtitle;
}
/** Sets the icon that appears in the window title bar
*/
void setWindowIcon(const std::string& icon);
/** Gets the icon in the window title bar
*/
const std::string& getWindowIcon() const {
return m_windowicon;
}
/** Gets the icon in the window title bar
*/
std::string getWindowIcon() {
return m_windowicon;
}
/** Sets whether to use the colorkey feature
*/
void setColorKeyEnabled(bool colorkeyenable);
/** Gets whether the colorkey feature is in use
*/
bool isColorKeyEnabled() const;
/** Sets the global colorkey to use for images
*/
void setColorKey(uint8_t r, uint8_t g, uint8_t b);
/** Gets the global colorkey setting
*/
const SDL_Color& getColorKey() const;
/** Sets the video driver. Values depends on platform.
* If none is set, SDL chooses it.
* @see DeviceCaps::getAvailableVideoDrivers()
*/
void setVideoDriver(const std::string& driver);
/** Gets the video driver.
* Default is a empty string.
* @see setVideoDriver()
*/
const std::string& getVideoDriver() const;
/** Sets the light model
*/
void setLightingModel(uint32_t lighting);
/** Gets the currently set light model
*/
uint32_t getLightingModel() const {
return m_lighting;
}
/** Sets whether to use the frame limiter
*/
void setFrameLimitEnabled(bool limited);
/** Gets whether the frame limiter is in use
*/
bool isFrameLimitEnabled() const;
/** Sets the frame limit
*/
void setFrameLimit(uint16_t framelimit);
/** Gets the frame limit
*/
uint16_t getFrameLimit() const;
/** Sets mouse sensitivity
*/
void setMouseSensitivity(float sens);
/** Gets mouse sensitivity
*/
float getMouseSensitivity() const;
/** Sets mouse acceleration
* if mouse acceleration is enabled,
* then the mouse sensitivity is used as speed max.
*/
void setMouseAccelerationEnabled(bool acceleration);
/** Returns if mouse acceleration is enabled or not.
*
* @return True if mouse acceleration is enabled, false if not.
*/
bool isMouseAccelerationEnabled() const;
/** Enables or disables native image cursor.
* @see Cursor::setNativeImageCursorEnabled()
*/
void setNativeImageCursorEnabled(bool nativeimagecursor);
/** Returns whether cursors set to an image or an animation are drawn natively.
* @see Cursor::setNativeImageCursorEnabled()
*/
bool isNativeImageCursorEnabled() const;
/** Enables or disables joystick and gamepad support.
*/
void setJoystickSupport(bool support);
/** Returns whether joystick and gamepad support is enabled or not.
*/
bool isJoystickSupport() const;
private:
uint8_t m_bitsperpixel;
bool m_fullscreen;
uint16_t m_refreshRate;
uint8_t m_displayIndex;
bool m_vSync;
std::string m_renderDriver;
float m_initialvolume;
std::string m_renderbackend;
bool m_sdlremovefakealpha;
bool m_oglcompressimages;
bool m_ogluseframebuffer;
bool m_oglusenpot;
bool m_oglMipmapping;
bool m_oglMonochrome;
TextureFiltering m_oglTextureFilter;
bool m_oglDepthBuffer;
float m_alphaTestValue;
uint16_t m_screenwidth;
uint16_t m_screenheight;
std::string m_windowtitle;
std::string m_windowicon;
std::string m_defaultfontpath;
uint16_t m_defaultfontsize;
std::string m_defaultfontglyphs;
bool m_iscolorkeyenabled;
SDL_Color m_colorkey;
std::string m_videodriver;
uint32_t m_lighting;
bool m_isframelimit;
uint16_t m_framelimit;
float m_mousesensitivity;
bool m_mouseacceleration;
bool m_nativeimagecursor;
bool m_joystickSupport;
};
}//FIFE
#endif
|