33 #include "util/base/exception.h"
34 #include "util/log/logger.h"
36 #include "enginesettings.h"
39 static Logger _log(LM_CONTROLLER);
41 const float MAXIMUM_VOLUME = 10.0;
46 m_initialvolume(MAXIMUM_VOLUME / 2),
47 m_renderbackend(
"SDL"),
48 m_sdlremovefakealpha(false),
49 m_oglcompressimages(false),
50 m_ogluseframebuffer(true),
54 m_windowtitle(
"FIFE"),
56 m_defaultfontpath(
"fonts/FreeSans.ttf"),
58 m_defaultfontglyphs(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\\\""),
59 m_iscolorkeyenabled(false),
61 m_isframelimit(false),
63 m_mousesensitivity(0.0),
64 m_mouseacceleration(false) {
69 #if defined( __unix__ )
70 m_videodriver =
"x11";
71 #elif defined( WIN32 )
72 m_videodriver =
"windib";
73 #elif defined( __APPLE_CC__ )
74 m_videodriver =
"x11";
86 std::vector<uint8_t>::iterator i = std::find(pv.begin(), pv.end(), bitsperpixel);
88 m_bitsperpixel = bitsperpixel;
92 FL_WARN(_log,
LMsg(
"EngineSettings::setBitsPerPixel() - ")
93 <<
" Tried to set screen bpp to an unsupporded value of " << bitsperpixel <<
94 ". Setting bpp to use the default value of 0 (the current screen bpp)");
100 std::vector<uint8_t> tmp;
110 FL_WARN(_log,
LMsg(
"EngineSettings::setInitialVolume() - ")
111 <<
" Tried to set initial volume to an unsupporded value of " << volume <<
112 ". Setting volume to the default value of 5 (minumum is 0, maximum is 10)");
114 m_initialvolume = 5.0;
118 m_initialvolume = volume;
122 return MAXIMUM_VOLUME;
127 std::vector<std::string>::iterator i = std::find(pv.begin(), pv.end(), renderbackend);
129 m_renderbackend = renderbackend;
132 FL_WARN(_log,
LMsg(
"EngineSettings::setRenderBackend() - ")
133 << renderbackend <<
" is not a valid render backend " <<
134 ". Setting the render backend to the default value of \"SDL\".");
136 m_renderbackend =
"SDL";
140 std::vector<std::string> tmp;
141 tmp.push_back(
"SDL");
142 tmp.push_back(
"OpenGL");
143 tmp.push_back(
"OpenGLe");
148 m_sdlremovefakealpha = sdlremovefakealpha;
152 m_oglcompressimages = oglcompressimages;
156 m_ogluseframebuffer = ogluseframebuffer;
160 m_oglusenpot = oglusenpot;
164 m_screenwidth = screenwidth;
168 m_screenheight = screenheight;
172 m_defaultfontpath = defaultfontpath;
176 m_defaultfontsize = defaultfontsize;
180 m_defaultfontglyphs = defaultfontglyphs;
184 m_windowtitle = title;
192 m_iscolorkeyenabled = colorkeyenable;
196 return m_iscolorkeyenabled;
209 void EngineSettings::setVideoDriver(
const std::string& driver) {
211 m_videodriver = driver;
214 const std::string& EngineSettings::getVideoDriver()
const {
215 return m_videodriver;
218 if (lighting <= 2 && lighting >=0) {
219 m_lighting = lighting;
223 FL_WARN(_log,
LMsg(
"EngineSettings::setLightingModel() - ")
224 << lighting <<
" is not a valid lighting model." <<
225 ". Setting the lighting model to the default value of 0 (off)");
231 m_isframelimit = limited;
235 return m_isframelimit;
239 m_framelimit = framelimit;
247 m_mousesensitivity = sens;
251 return m_mousesensitivity;
255 m_mouseacceleration = acceleration;
259 return m_mouseacceleration;