annotate engine/core/controller/enginesettings.cpp @ 653:01acc9fc35ea

* Moved getCurrentScreenMode() to the renderbackend as renderbackend is what initializes the screen. * Updated the Color masks to follow the integer standards * Added some new SDL modes (HW Surface and double buffer) to check for in DeviceCaps. * RenderBackend now saves the actual flags used to initialize the screen.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 15 Oct 2010 18:54:34 +0000
parents 51bbda7676f0
children e3140f01749d
rev   line source
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
1 /***************************************************************************
632
a7909cdcdc85 * A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 621
diff changeset
2 * Copyright (C) 2005-2010 by the FIFE team *
a7909cdcdc85 * A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 621
diff changeset
3 * http://www.fifengine.net *
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
4 * This file is part of FIFE. *
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
5 * *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
6 * FIFE is free software; you can redistribute it and/or *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
7 * modify it under the terms of the GNU Lesser General Public *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
8 * License as published by the Free Software Foundation; either *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
9 * version 2.1 of the License, or (at your option) any later version. *
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
10 * *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
11 * This library is distributed in the hope that it will be useful, *
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
14 * Lesser General Public License for more details. *
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
15 * *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
16 * You should have received a copy of the GNU Lesser General Public *
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
17 * License along with this library; if not, write to the *
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
18 * Free Software Foundation, Inc., *
46
90005975cdbb * Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 0
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
20 ***************************************************************************/
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
21
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
22 // Standard C++ library includes
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
23 #include <algorithm>
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
24 #include <string>
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
25
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
26 // 3rd party library includes
112
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
27 #include <SDL.h>
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
28
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
29 // FIFE includes
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
30 // These includes are split up in two parts, separated by one empty line
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
31 // First block: files included from the FIFE root src directory
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
32 // Second block: files included from the same folder
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
33 #include "util/base/exception.h"
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
34
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
35 #include "enginesettings.h"
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
36
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
37 namespace FIFE {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
38 const float MAXIMUM_VOLUME = 10.0;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
39
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
40 EngineSettings::EngineSettings():
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
41 m_bitsperpixel(0),
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
42 m_fullscreen(false),
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
43 m_initialvolume(MAXIMUM_VOLUME / 2),
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
44 m_renderbackend("SDL"),
444
79678719d569 * Fixed the sld typo. fixes[ticket:463]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 425
diff changeset
45 m_sdlremovefakealpha(false),
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
46 m_screenwidth(800),
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
47 m_screenheight(600),
61
18c2a21ac0ad allow clients to set a custom window title and icon
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
48 m_windowtitle("FIFE"),
18c2a21ac0ad allow clients to set a custom window title and icon
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
49 m_windowicon(""),
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
50 m_defaultfontpath(""),
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
51 m_defaultfontsize(8),
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
52 m_defaultfontglyphs(""),
640
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
53 m_iscolorkeyenabled(false){
425
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
54 m_colorkey.r = 255;
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
55 m_colorkey.g = 0;
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
56 m_colorkey.b = 255;
640
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
57
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
58 #if defined( __unix__ )
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
59 m_videodriver = "x11";
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
60 #elif defined( WIN32 )
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
61 m_videodriver = "windib";
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
62 #elif defined( __APPLE_CC__ )
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
63 m_videodriver = "x11";
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
64 #else
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
65 m_videodriver = "";
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
66 #endif
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
67
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
68 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
69
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
70 EngineSettings::~EngineSettings() {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
71 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
72
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
73 void EngineSettings::validate() const {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
74 if (m_defaultfontpath == "") {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
75 throw NotSet("Path for default font is not set");
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
76 }
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
77 std::string::size_type loc = m_defaultfontpath.find(".ttf", 0);
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
78 if ((loc == std::string::npos) && (m_defaultfontglyphs == "")) {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
79 throw NotSet("Glyphs for default font are not set");
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
80 }
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
81 }
112
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
82
632
a7909cdcdc85 * A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 621
diff changeset
83 std::vector<std::pair<uint16_t, uint16_t> > EngineSettings::getPossibleResolutions() const {
112
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
84 SDL_Rect **modes = SDL_ListModes(NULL, ((getRenderBackend() != "SDL") ? (SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL) : 0) | (isFullScreen() ? SDL_FULLSCREEN : 0));
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
85 if(modes == (SDL_Rect **)0)
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
86 throw NotFound("No VideoMode Found");
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
87
632
a7909cdcdc85 * A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 621
diff changeset
88 std::vector<std::pair<uint16_t, uint16_t> > result;
112
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
89 if(modes != (SDL_Rect **)-1)
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
90 for(unsigned int i = 0; modes[i]; ++i)
632
a7909cdcdc85 * A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 621
diff changeset
91 result.push_back(std::pair<uint16_t, uint16_t>(modes[i]->w, modes[i]->h));
112
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
92 return result;
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
93 }
98541d3b9220 * add some std types to swig wrapper (fife.i.templ)
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 61
diff changeset
94
650
51bbda7676f0 * Fixed some more integer definitions
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 640
diff changeset
95 void EngineSettings::setBitsPerPixel(uint16_t bitsperpixel) {
51bbda7676f0 * Fixed some more integer definitions
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 640
diff changeset
96 std::vector<uint16_t> pv = getPossibleBitsPerPixel();
51bbda7676f0 * Fixed some more integer definitions
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 640
diff changeset
97 std::vector<uint16_t>::iterator i = std::find(pv.begin(), pv.end(), bitsperpixel);
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
98 if (i != pv.end()) {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
99 m_bitsperpixel = bitsperpixel;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
100 return;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
101 }
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
102 throw NotSupported("Given bits per pixel value is not supported");
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
103 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
104
650
51bbda7676f0 * Fixed some more integer definitions
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 640
diff changeset
105 std::vector<uint16_t> EngineSettings::getPossibleBitsPerPixel() const {
51bbda7676f0 * Fixed some more integer definitions
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 640
diff changeset
106 std::vector<uint16_t> tmp;
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
107 tmp.push_back(0);
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
108 tmp.push_back(16);
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
109 tmp.push_back(24);
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
110 tmp.push_back(32);
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
111 return tmp;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
112 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
113
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
114 void EngineSettings::setInitialVolume(float volume) {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
115 if (volume > getMaxVolume()) {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
116 throw NotSupported("Given volume exceeds maximum volume");
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
117 }
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
118 if (volume < 0) {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
119 throw NotSupported("Given volume is below 0");
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
120 }
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
121 m_initialvolume = volume;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
122 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
123
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
124 float EngineSettings::getMaxVolume() const {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
125 return MAXIMUM_VOLUME;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
126 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
127
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
128 void EngineSettings::setRenderBackend(const std::string& renderbackend) {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
129 std::vector<std::string> pv = getPossibleRenderBackends();
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
130 std::vector<std::string>::iterator i = std::find(pv.begin(), pv.end(), renderbackend);
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
131 if (i != pv.end()) {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
132 m_renderbackend = renderbackend;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
133 return;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
134 }
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
135 throw NotSupported("Given render backend is not supported");
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
136 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
137
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
138 std::vector<std::string> EngineSettings::getPossibleRenderBackends() {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
139 std::vector<std::string> tmp;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
140 tmp.push_back("SDL");
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
141 tmp.push_back("OpenGL");
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
142 return tmp;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
143 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
144
444
79678719d569 * Fixed the sld typo. fixes[ticket:463]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 425
diff changeset
145 void EngineSettings::setSDLRemoveFakeAlpha(bool sdlremovefakealpha) {
79678719d569 * Fixed the sld typo. fixes[ticket:463]
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 425
diff changeset
146 m_sdlremovefakealpha = sdlremovefakealpha;
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
147 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
148
632
a7909cdcdc85 * A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 621
diff changeset
149 void EngineSettings::setScreenWidth(uint16_t screenwidth) {
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
150 m_screenwidth = screenwidth;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
151 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
152
632
a7909cdcdc85 * A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 621
diff changeset
153 void EngineSettings::setScreenHeight(uint16_t screenheight) {
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
154 m_screenheight = screenheight;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
155 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
156
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
157 void EngineSettings::setDefaultFontPath(const std::string& defaultfontpath) {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
158 m_defaultfontpath = defaultfontpath;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
159 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
160
632
a7909cdcdc85 * A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 621
diff changeset
161 void EngineSettings::setDefaultFontSize(uint16_t defaultfontsize) {
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
162 m_defaultfontsize = defaultfontsize;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
163 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
164
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
165 void EngineSettings::setDefaultFontGlyphs(const std::string& defaultfontglyphs) {
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
166 m_defaultfontglyphs = defaultfontglyphs;
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
167 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
168
61
18c2a21ac0ad allow clients to set a custom window title and icon
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
169 void EngineSettings::setWindowTitle(const std::string& title) {
18c2a21ac0ad allow clients to set a custom window title and icon
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
170 m_windowtitle = title;
18c2a21ac0ad allow clients to set a custom window title and icon
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
171 }
621
356634098bd9 * Removed the image chunking size variable from engine settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 444
diff changeset
172
61
18c2a21ac0ad allow clients to set a custom window title and icon
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
173 void EngineSettings::setWindowIcon(const std::string& icon) {
18c2a21ac0ad allow clients to set a custom window title and icon
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
174 m_windowicon = icon;
18c2a21ac0ad allow clients to set a custom window title and icon
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 46
diff changeset
175 }
425
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
176
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
177 void EngineSettings::setColorKeyEnabled(bool colorkeyenable) {
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
178 m_iscolorkeyenabled = colorkeyenable;
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
179 }
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
180
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
181 bool EngineSettings::isColorKeyEnabled() const {
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
182 return m_iscolorkeyenabled;
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
183 }
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
184
632
a7909cdcdc85 * A little data type cleanup in the FIFE::EngineSettings class
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 621
diff changeset
185 void EngineSettings::setColorKey(uint8_t r, uint8_t g, uint8_t b) {
425
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
186 m_colorkey.r = r;
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
187 m_colorkey.g = g;
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
188 m_colorkey.b = b;
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
189 }
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
190
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
191 const SDL_Color& EngineSettings::getColorKey() const {
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
192 return m_colorkey;
ad7969d9460b A client can now specify a global color key to be used with all images. The default color key is (255,0,255) in RGB format. Also the client can enable/disable the color key feature by using the setColorKeyEnabled function in the EngineSettings class. By default the color key feature is disabled. fixes[t:451]
vtchill@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 112
diff changeset
193 }
640
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
194
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
195 void EngineSettings::setVideoDriver(const std::string& driver) {
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
196 m_videodriver = driver;
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
197 }
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
198
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
199 const std::string& EngineSettings::getVideoDriver() const {
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
200 return m_videodriver;
855ad500f991 * Added the ability to set/get the video driver used using the settings interface. Note that the default driver for the OS will be used unless explicitly specified.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 632
diff changeset
201 }
0
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
202 }
4a0efb7baf70 * Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
203