comparison engine/core/controller/enginesettings.cpp @ 621:356634098bd9

* Removed the image chunking size variable from engine settings. * Replaced the existing define of PI and added some math related static const variables
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 01 Oct 2010 14:09:47 +0000
parents 79678719d569
children a7909cdcdc85
comparison
equal deleted inserted replaced
620:853d25234671 621:356634098bd9
48 m_windowtitle("FIFE"), 48 m_windowtitle("FIFE"),
49 m_windowicon(""), 49 m_windowicon(""),
50 m_defaultfontpath(""), 50 m_defaultfontpath(""),
51 m_defaultfontsize(8), 51 m_defaultfontsize(8),
52 m_defaultfontglyphs(""), 52 m_defaultfontglyphs(""),
53 m_image_chunking_size(256),
54 m_iscolorkeyenabled(false) { 53 m_iscolorkeyenabled(false) {
55 m_colorkey.r = 255; 54 m_colorkey.r = 255;
56 m_colorkey.g = 0; 55 m_colorkey.g = 0;
57 m_colorkey.b = 255; 56 m_colorkey.b = 255;
58 } 57 }
59 58
60 EngineSettings::~EngineSettings() { 59 EngineSettings::~EngineSettings() {
61 } 60 }
62 61
63 void EngineSettings::validate() const { 62 void EngineSettings::validate() const {
64 if (m_defaultfontpath == "") { 63 if (m_defaultfontpath == "") {
65 throw NotSet("Path for default font is not set"); 64 throw NotSet("Path for default font is not set");
66 } 65 }
67 std::string::size_type loc = m_defaultfontpath.find(".ttf", 0); 66 std::string::size_type loc = m_defaultfontpath.find(".ttf", 0);
89 m_bitsperpixel = bitsperpixel; 88 m_bitsperpixel = bitsperpixel;
90 return; 89 return;
91 } 90 }
92 throw NotSupported("Given bits per pixel value is not supported"); 91 throw NotSupported("Given bits per pixel value is not supported");
93 } 92 }
94 93
95 std::vector<unsigned int> EngineSettings::getPossibleBitsPerPixel() const { 94 std::vector<unsigned int> EngineSettings::getPossibleBitsPerPixel() const {
96 std::vector<unsigned int> tmp; 95 std::vector<unsigned int> tmp;
97 tmp.push_back(0); 96 tmp.push_back(0);
98 tmp.push_back(16); 97 tmp.push_back(16);
99 tmp.push_back(24); 98 tmp.push_back(24);
100 tmp.push_back(32); 99 tmp.push_back(32);
101 return tmp; 100 return tmp;
102 } 101 }
103 102
104 void EngineSettings::setInitialVolume(float volume) { 103 void EngineSettings::setInitialVolume(float volume) {
105 if (volume > getMaxVolume()) { 104 if (volume > getMaxVolume()) {
106 throw NotSupported("Given volume exceeds maximum volume"); 105 throw NotSupported("Given volume exceeds maximum volume");
107 } 106 }
108 if (volume < 0) { 107 if (volume < 0) {
109 throw NotSupported("Given volume is below 0"); 108 throw NotSupported("Given volume is below 0");
110 } 109 }
111 m_initialvolume = volume; 110 m_initialvolume = volume;
112 } 111 }
113 112
114 float EngineSettings::getMaxVolume() const { 113 float EngineSettings::getMaxVolume() const {
115 return MAXIMUM_VOLUME; 114 return MAXIMUM_VOLUME;
116 } 115 }
117 116
118 void EngineSettings::setRenderBackend(const std::string& renderbackend) { 117 void EngineSettings::setRenderBackend(const std::string& renderbackend) {
119 std::vector<std::string> pv = getPossibleRenderBackends(); 118 std::vector<std::string> pv = getPossibleRenderBackends();
120 std::vector<std::string>::iterator i = std::find(pv.begin(), pv.end(), renderbackend); 119 std::vector<std::string>::iterator i = std::find(pv.begin(), pv.end(), renderbackend);
121 if (i != pv.end()) { 120 if (i != pv.end()) {
122 m_renderbackend = renderbackend; 121 m_renderbackend = renderbackend;
123 return; 122 return;
124 } 123 }
125 throw NotSupported("Given render backend is not supported"); 124 throw NotSupported("Given render backend is not supported");
126 } 125 }
127 126
128 std::vector<std::string> EngineSettings::getPossibleRenderBackends() { 127 std::vector<std::string> EngineSettings::getPossibleRenderBackends() {
129 std::vector<std::string> tmp; 128 std::vector<std::string> tmp;
130 tmp.push_back("SDL"); 129 tmp.push_back("SDL");
131 tmp.push_back("OpenGL"); 130 tmp.push_back("OpenGL");
132 return tmp; 131 return tmp;
133 } 132 }
134 133
135 void EngineSettings::setSDLRemoveFakeAlpha(bool sdlremovefakealpha) { 134 void EngineSettings::setSDLRemoveFakeAlpha(bool sdlremovefakealpha) {
136 m_sdlremovefakealpha = sdlremovefakealpha; 135 m_sdlremovefakealpha = sdlremovefakealpha;
137 } 136 }
138 137
139 void EngineSettings::setScreenWidth(unsigned int screenwidth) { 138 void EngineSettings::setScreenWidth(unsigned int screenwidth) {
140 m_screenwidth = screenwidth; 139 m_screenwidth = screenwidth;
141 } 140 }
142 141
143 void EngineSettings::setScreenHeight(unsigned int screenheight) { 142 void EngineSettings::setScreenHeight(unsigned int screenheight) {
144 m_screenheight = screenheight; 143 m_screenheight = screenheight;
145 } 144 }
146 145
147 void EngineSettings::setDefaultFontPath(const std::string& defaultfontpath) { 146 void EngineSettings::setDefaultFontPath(const std::string& defaultfontpath) {
148 m_defaultfontpath = defaultfontpath; 147 m_defaultfontpath = defaultfontpath;
149 } 148 }
150 149
151 void EngineSettings::setDefaultFontSize(const unsigned int defaultfontsize) { 150 void EngineSettings::setDefaultFontSize(const unsigned int defaultfontsize) {
152 m_defaultfontsize = defaultfontsize; 151 m_defaultfontsize = defaultfontsize;
153 } 152 }
154 153
155 void EngineSettings::setDefaultFontGlyphs(const std::string& defaultfontglyphs) { 154 void EngineSettings::setDefaultFontGlyphs(const std::string& defaultfontglyphs) {
156 m_defaultfontglyphs = defaultfontglyphs; 155 m_defaultfontglyphs = defaultfontglyphs;
157 } 156 }
158 157
159 void EngineSettings::setWindowTitle(const std::string& title) { 158 void EngineSettings::setWindowTitle(const std::string& title) {
160 m_windowtitle = title; 159 m_windowtitle = title;
161 } 160 }
162 161
163 void EngineSettings::setWindowIcon(const std::string& icon) { 162 void EngineSettings::setWindowIcon(const std::string& icon) {
164 m_windowicon = icon; 163 m_windowicon = icon;
165 } 164 }
166 165
167 void EngineSettings::setColorKeyEnabled(bool colorkeyenable) { 166 void EngineSettings::setColorKeyEnabled(bool colorkeyenable) {