1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Benjamin Grauer |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | #include "framework.h" |
---|
17 | |
---|
18 | #include "physics_engine.h" |
---|
19 | #include "particle_engine.h" |
---|
20 | |
---|
21 | #include "gui_gtk.h" |
---|
22 | #include "p_node.h" |
---|
23 | #include "null_parent.h" |
---|
24 | #include "state.h" |
---|
25 | #include "debug.h" |
---|
26 | #include "graphics_engine.h" |
---|
27 | #include "light.h" |
---|
28 | #include "resource_manager.h" |
---|
29 | #include "camera.h" |
---|
30 | |
---|
31 | #include <pthread.h> |
---|
32 | |
---|
33 | int verbose; |
---|
34 | |
---|
35 | void Framework::initModule() |
---|
36 | { |
---|
37 | // Creating a Test Particle System |
---|
38 | ParticleSystem* system = new ParticleSystem(100000, PARTICLE_SPRITE); |
---|
39 | system->setLifeSpan(5); |
---|
40 | system->setConserve(.999); |
---|
41 | system->setRadius(4, 3, 1, 2); |
---|
42 | system->setColor(.5,0,0,.5, 1,1,0,1, 0,0,0,0); |
---|
43 | |
---|
44 | // Creating a Test Particle Emitter |
---|
45 | ParticleEmitter* emitter = new ParticleEmitter(Vector(0 , 1, 0), M_PI_4, 20, .1); |
---|
46 | emitter->setType(EMITTER_DOT ); |
---|
47 | emitter->setSize(0); |
---|
48 | emitter->setRelCoor(Vector(0,0,0)); |
---|
49 | |
---|
50 | // Add the Flow from the Emitter into the System |
---|
51 | ParticleEngine::getInstance()->addConnection(emitter, system); |
---|
52 | } |
---|
53 | |
---|
54 | bool Framework::mainLoop() |
---|
55 | { |
---|
56 | while(true) |
---|
57 | { |
---|
58 | // keyhandler returns false if sdl gets quit by some event |
---|
59 | if (!this->keyHandler()) |
---|
60 | return false; |
---|
61 | |
---|
62 | // tick the scene |
---|
63 | float dt = this->tick(); |
---|
64 | |
---|
65 | // Draw the scene |
---|
66 | this->draw(dt); |
---|
67 | } |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | bool Framework::draw(float dt) |
---|
72 | { |
---|
73 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
---|
74 | glLoadIdentity(); // Reset the view |
---|
75 | |
---|
76 | ParticleEngine::getInstance()->draw(dt); |
---|
77 | |
---|
78 | camera->apply(); |
---|
79 | |
---|
80 | SDL_GL_SwapBuffers(); // Swap the buffers |
---|
81 | } |
---|
82 | |
---|
83 | |
---|
84 | float Framework::tick() |
---|
85 | { |
---|
86 | currFrame = SDL_GetTicks(); |
---|
87 | float dt = (float)(currFrame - lastFrame) / 1000.0; |
---|
88 | lastFrame = currFrame; |
---|
89 | |
---|
90 | ParticleEngine::getInstance()->tick(dt); |
---|
91 | |
---|
92 | NullParent::getInstance()->update(dt); |
---|
93 | return dt; |
---|
94 | } |
---|
95 | |
---|
96 | |
---|
97 | bool Framework::keyHandler() |
---|
98 | { |
---|
99 | // This is the main loop for the entire program and it will run until done==TRUE |
---|
100 | { |
---|
101 | // And poll for events |
---|
102 | SDL_Event event; |
---|
103 | while(SDL_PollEvent(&event)) |
---|
104 | { |
---|
105 | switch (event.type) { |
---|
106 | case SDL_MOUSEMOTION: |
---|
107 | { |
---|
108 | Vector view = camera->getTarget()->getAbsCoor() - camera->getAbsCoor(); |
---|
109 | Vector up = Vector(0, 1, 0); |
---|
110 | up = camera->getAbsDir().apply(up); |
---|
111 | Vector h = up.cross(view); |
---|
112 | Vector v = h.cross(view); |
---|
113 | h.normalize(); |
---|
114 | v.normalize(); |
---|
115 | |
---|
116 | if (mouseDown[1]) |
---|
117 | camera->setRelCoor(camera->getRelCoor()+ h * event.motion.xrel *.05 - v * event.motion.yrel * .05); |
---|
118 | if (mouseDown[3]) |
---|
119 | camera->getTarget()->setRelCoor(camera->getTarget()->getRelCoor()+ h * event.motion.xrel *.05 - v * event.motion.yrel * .05); |
---|
120 | |
---|
121 | } |
---|
122 | break; |
---|
123 | case SDL_MOUSEBUTTONDOWN: |
---|
124 | switch (event.button.button) |
---|
125 | { |
---|
126 | case 4: |
---|
127 | PRINTF(4)("MouseWheel up\n"); |
---|
128 | camera->setRelCoor(camera->getRelCoor() + (camera->getTarget()->getAbsCoor() - camera->getAbsCoor())*.1); |
---|
129 | break; |
---|
130 | case 5: |
---|
131 | PRINTF(4)("MouseWheel down\n"); |
---|
132 | camera->setRelCoor(camera->getRelCoor() - (camera->getTarget()->getAbsCoor() - camera->getAbsCoor())*.1); |
---|
133 | break; |
---|
134 | case 1: |
---|
135 | case 2: |
---|
136 | case 3: |
---|
137 | mouseDown[event.button.button] = true; |
---|
138 | break; |
---|
139 | } |
---|
140 | |
---|
141 | break; |
---|
142 | case SDL_MOUSEBUTTONUP: |
---|
143 | switch (event.button.button) |
---|
144 | { |
---|
145 | case 1: |
---|
146 | case 2: |
---|
147 | case 3: |
---|
148 | mouseDown[event.button.button] = false; |
---|
149 | break; |
---|
150 | } |
---|
151 | break; |
---|
152 | case SDL_VIDEORESIZE: |
---|
153 | GraphicsEngine::getInstance()->resolutionChanged(&event.resize); |
---|
154 | break; |
---|
155 | case SDL_KEYDOWN: |
---|
156 | switch (event.key.keysym.sym) |
---|
157 | { |
---|
158 | case SDLK_x: |
---|
159 | |
---|
160 | break; |
---|
161 | case SDLK_c: |
---|
162 | |
---|
163 | break; |
---|
164 | case SDLK_i: |
---|
165 | ParticleEngine::getInstance()->debug(); |
---|
166 | break; |
---|
167 | case SDLK_a: |
---|
168 | camera->setRelCoor(camera->getRelCoor() + (camera->getTarget()->getAbsCoor() - camera->getAbsCoor())*.1); |
---|
169 | break; |
---|
170 | case SDLK_z: |
---|
171 | camera->setRelCoor(camera->getRelCoor() - (camera->getTarget()->getAbsCoor() - camera->getAbsCoor())*.1); |
---|
172 | break; |
---|
173 | case SDLK_h: |
---|
174 | this->printHelp(); |
---|
175 | break; |
---|
176 | |
---|
177 | case SDLK_1: |
---|
178 | { |
---|
179 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
180 | if (tmpEmit) |
---|
181 | { |
---|
182 | tmpEmit->setEmissionRate(tmpEmit->getEmissionRate() +1.0); |
---|
183 | PRINT(3)("emissionRate set to %f\n", tmpEmit->getEmissionRate()); |
---|
184 | } |
---|
185 | } |
---|
186 | break; |
---|
187 | case SDLK_2: |
---|
188 | { |
---|
189 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
190 | if (tmpEmit) |
---|
191 | { |
---|
192 | tmpEmit->setEmissionRate(tmpEmit->getEmissionRate() -1.0); |
---|
193 | PRINT(3)("emissionRate set to %f\n", tmpEmit->getEmissionRate()); |
---|
194 | } |
---|
195 | } |
---|
196 | break; |
---|
197 | case SDLK_3: |
---|
198 | { |
---|
199 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
200 | if (tmpEmit) |
---|
201 | { |
---|
202 | tmpEmit->setEmissionVelocity(tmpEmit->getEmissionVelocity() -.01); |
---|
203 | PRINT(3)("emissionVelocity set to %f\n", tmpEmit->getEmissionVelocity()); |
---|
204 | } |
---|
205 | } |
---|
206 | break; |
---|
207 | case SDLK_4: |
---|
208 | { |
---|
209 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
210 | if (tmpEmit) |
---|
211 | { |
---|
212 | tmpEmit->setEmissionVelocity(tmpEmit->getEmissionVelocity() + .01); |
---|
213 | PRINT(3)("emissionVelocity set to %f\n", tmpEmit->getEmissionVelocity()); |
---|
214 | } |
---|
215 | } |
---|
216 | break; |
---|
217 | case SDLK_5: |
---|
218 | { |
---|
219 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
220 | if (tmpEmit) |
---|
221 | { |
---|
222 | tmpEmit->setSpread(tmpEmit->getSpread() +.1); |
---|
223 | PRINT(3)("emissionSpreadAngle set to %f\n", tmpEmit->getSpread()); |
---|
224 | } |
---|
225 | } |
---|
226 | break; |
---|
227 | case SDLK_6: |
---|
228 | { |
---|
229 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
230 | if (tmpEmit) |
---|
231 | { |
---|
232 | tmpEmit->setSpread(tmpEmit->getSpread() -.1); |
---|
233 | PRINT(3)("emissionSpreadAngle set to %f\n", tmpEmit->getSpread()); |
---|
234 | } |
---|
235 | } |
---|
236 | break; |
---|
237 | case SDLK_7: |
---|
238 | { |
---|
239 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
240 | if (tmpEmit) |
---|
241 | { |
---|
242 | tmpEmit->setSize(tmpEmit->getSize() - 1.0); |
---|
243 | PRINT(3)("EmitterSize set to %f\n", tmpEmit->getSize()); |
---|
244 | } |
---|
245 | } |
---|
246 | break; |
---|
247 | case SDLK_8: |
---|
248 | { |
---|
249 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
250 | if (tmpEmit) |
---|
251 | { |
---|
252 | tmpEmit->setSize(tmpEmit->getSize() +1.0); |
---|
253 | PRINT(3)("EmitterSize set to %f\n", tmpEmit->getSize()); |
---|
254 | } |
---|
255 | } |
---|
256 | break; |
---|
257 | case SDLK_9: |
---|
258 | { |
---|
259 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
260 | if (tmpEmit) |
---|
261 | { |
---|
262 | if (tmpEmit->getType() == EMITTER_DOT) |
---|
263 | tmpEmit->setType(EMITTER_PLANE); |
---|
264 | else if (tmpEmit->getType() == EMITTER_PLANE) |
---|
265 | tmpEmit->setType(EMITTER_CUBE); |
---|
266 | else if (tmpEmit->getType() == EMITTER_CUBE) |
---|
267 | tmpEmit->setType(EMITTER_DOT); |
---|
268 | PRINT(3)("EmitterType set to %d\n", tmpEmit->getType()); |
---|
269 | } |
---|
270 | } |
---|
271 | break; |
---|
272 | |
---|
273 | } |
---|
274 | break; |
---|
275 | |
---|
276 | // If a quit event was recieved |
---|
277 | case SDL_QUIT: |
---|
278 | // then we're done and we'll end this program |
---|
279 | return false; |
---|
280 | break; |
---|
281 | default: |
---|
282 | break; |
---|
283 | } |
---|
284 | |
---|
285 | } |
---|
286 | |
---|
287 | // Get the state of the keyboard keys |
---|
288 | keys = SDL_GetKeyState(NULL); |
---|
289 | |
---|
290 | // and check if ESCAPE has been pressed. If so then quit |
---|
291 | if(keys[SDLK_ESCAPE]) return false; |
---|
292 | } |
---|
293 | return true; |
---|
294 | } |
---|
295 | |
---|
296 | Framework* Framework::singletonRef = NULL; |
---|
297 | |
---|
298 | Framework* Framework::getInstance(void) |
---|
299 | { |
---|
300 | if (Framework::singletonRef == NULL) |
---|
301 | Framework::singletonRef = new Framework(); |
---|
302 | return Framework::singletonRef; |
---|
303 | } |
---|
304 | |
---|
305 | Framework::Framework() |
---|
306 | { |
---|
307 | this->lastFrame = 0; |
---|
308 | // Create a new OpenGL window with the title "Cone3D Basecode" at |
---|
309 | // 640x480x32, fullscreen and check for errors along the way |
---|
310 | GraphicsEngine::getInstance(); |
---|
311 | |
---|
312 | LightManager::getInstance(); |
---|
313 | glEnable(GL_TEXTURE_2D); |
---|
314 | |
---|
315 | // Build the font from a TGA image font.tga in the data directory |
---|
316 | // Hide the mouse cursor |
---|
317 | SDL_ShowCursor(2); |
---|
318 | |
---|
319 | for (int i = 0; i <MOUSE_BUTTON_COUNT; i++) |
---|
320 | mouseDown[i] = false; |
---|
321 | |
---|
322 | ResourceManager::getInstance()->setDataDir(DATA_DIRECTORY); |
---|
323 | |
---|
324 | |
---|
325 | initModule(); |
---|
326 | |
---|
327 | camera = new Camera(); |
---|
328 | |
---|
329 | State::getInstance()->setCamera(camera, camera->getTarget()); |
---|
330 | |
---|
331 | camera->setAbsCoor(Vector(10, 10, 0)); |
---|
332 | |
---|
333 | } |
---|
334 | |
---|
335 | Framework::~Framework() |
---|
336 | { |
---|
337 | delete GraphicsEngine::getInstance(); |
---|
338 | |
---|
339 | } |
---|
340 | |
---|
341 | |
---|
342 | |
---|
343 | void Framework::printHelp(void) const |
---|
344 | { |
---|
345 | PRINT(0)(" Help for the frameWork\n"); |
---|
346 | PRINT(0)("========================\n"); |
---|
347 | PRINT(0)("h - print thisHelp\n"); |
---|
348 | PRINT(0)("i - state Information\n\n"); |
---|
349 | PRINT(0)("Emitter Properties\n"); |
---|
350 | PRINT(0)("1,2 - increase/decrease emissionRate\n"); |
---|
351 | PRINT(0)("3,4 - increase/decrease emission velocity\n"); |
---|
352 | PRINT(0)("5,6 - increase/decrease spread angle\n"); |
---|
353 | PRINT(0)("7,8 - increase-decrease emitter-size\n"); |
---|
354 | PRINT(0)("9 - swap emitterType\n"); |
---|
355 | PRINT(0)("\n"); |
---|
356 | |
---|
357 | |
---|
358 | } |
---|
359 | |
---|
360 | int changeOption(GtkWidget* nonInterest, void* widget) |
---|
361 | { |
---|
362 | Option* option = (Option*) widget; |
---|
363 | const char* name = option->getTitle(); |
---|
364 | char* valueC = option->save(); |
---|
365 | float value = atof(valueC); |
---|
366 | |
---|
367 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
368 | if (tmpEmit) |
---|
369 | { |
---|
370 | if (!strcmp(name, "EmissionRate")) |
---|
371 | { |
---|
372 | tmpEmit->setEmissionRate(value); |
---|
373 | PRINT(3)("EmissionRate set to %f\n", value); |
---|
374 | } |
---|
375 | else if (!strcmp(name, "Velocity")) |
---|
376 | { |
---|
377 | tmpEmit->setEmissionVelocity(value); |
---|
378 | PRINT(3)("Velocity set to %f\n", value); |
---|
379 | } |
---|
380 | else if(!strcmp(name, "SpreadAngle")) |
---|
381 | { |
---|
382 | tmpEmit->setSpread(value); |
---|
383 | PRINT(3)("SpreadAngle set to %f\n", value); |
---|
384 | } |
---|
385 | else if(!strcmp(name, "EmitterType")) |
---|
386 | { |
---|
387 | if (!strcmp(valueC, "EMITTER_DOT")) |
---|
388 | tmpEmit->setType(EMITTER_DOT); |
---|
389 | else if (!strcmp(valueC, "EMITTER_PLANE")) |
---|
390 | tmpEmit->setType(EMITTER_PLANE); |
---|
391 | else if (!strcmp(valueC, "EMITTER_CUBE")) |
---|
392 | tmpEmit->setType(EMITTER_CUBE); |
---|
393 | PRINT(3)("EmitterType set to %s\n", valueC); |
---|
394 | } |
---|
395 | else if(!strcmp(name, "EmitterSize")) |
---|
396 | { |
---|
397 | tmpEmit->setSize(value); |
---|
398 | PRINT(3)("EmitterSize set to %f\n", value); |
---|
399 | } |
---|
400 | } |
---|
401 | |
---|
402 | ParticleSystem* tmpSys = ParticleEngine::getInstance()->getSystemByNumber(1); |
---|
403 | if (tmpSys) |
---|
404 | { |
---|
405 | if (!strcmp(name, "StartRadius")) |
---|
406 | { |
---|
407 | tmpSys->setRadius(value, tmpSys->getEndRadius()); |
---|
408 | PRINT(3)("ParticleStartRadius set to %f\n", value); |
---|
409 | } |
---|
410 | else if (!strcmp(name, "EndRadius")) |
---|
411 | { |
---|
412 | tmpSys->setRadius( tmpSys->getStartRadius(), value); |
---|
413 | PRINT(3)("ParticleEndRadius set to %f\n", value); |
---|
414 | } |
---|
415 | |
---|
416 | else if (!strcmp(name, "LifeSpan")) |
---|
417 | { |
---|
418 | tmpSys->setLifeSpan(value); |
---|
419 | PRINT(3)("ParticleLifeSpan set to %f\n", value); |
---|
420 | } |
---|
421 | |
---|
422 | else if (!strcmp(name, "ConserveFactor")) |
---|
423 | { |
---|
424 | tmpSys->setConserve(value); |
---|
425 | PRINT(3)("ParticleConserveFactor set to %f\n", value); |
---|
426 | } |
---|
427 | |
---|
428 | else if (!strcmp(name, "ParticleType")) |
---|
429 | { |
---|
430 | if (!strcmp(valueC, "PARTICLE_DOT")) |
---|
431 | tmpSys->setType(PARTICLE_DOT); |
---|
432 | else if (!strcmp(valueC, "PARTICLE_SPARK")) |
---|
433 | tmpSys->setType(PARTICLE_SPARK); |
---|
434 | else if (!strcmp(valueC, "PARTICLE_SPRITE")) |
---|
435 | tmpSys->setType(PARTICLE_SPRITE); |
---|
436 | |
---|
437 | PRINT(3)("ParticleType set to %f\n", valueC); |
---|
438 | } |
---|
439 | |
---|
440 | else if (!strcmp(name, "InheritSpeed")) |
---|
441 | { |
---|
442 | tmpSys->setInheritSpeed(value); |
---|
443 | PRINT(3)("ParticleInheritSpeed set to %f\n", value); |
---|
444 | } |
---|
445 | |
---|
446 | } |
---|
447 | |
---|
448 | delete valueC; |
---|
449 | } |
---|
450 | |
---|
451 | |
---|
452 | void* Framework::initGui(void* argv) |
---|
453 | { |
---|
454 | Window* guiMainWindow = NULL; |
---|
455 | |
---|
456 | initGUI(0, NULL); |
---|
457 | |
---|
458 | guiMainWindow = new Window("ParticlesFUN"); |
---|
459 | { |
---|
460 | Box* windowBox = new Box('v'); |
---|
461 | { |
---|
462 | Frame* emitterFrame = new Frame("emitter-settings"); |
---|
463 | { |
---|
464 | Box* emitterBox = new Box('v'); |
---|
465 | { |
---|
466 | emitterBox->fill(new Label("EmissionRate")); |
---|
467 | Slider* EmissionRate = new Slider("EmissionRate", 0, 1000); |
---|
468 | EmissionRate->connectSignal("value_changed", (void*)EmissionRate, changeOption ); |
---|
469 | emitterBox->fill(EmissionRate); |
---|
470 | |
---|
471 | emitterBox->fill(new Label("Velocity")); |
---|
472 | Slider* velocity = new Slider("Velocity", 0, 2); |
---|
473 | velocity->setExactness(3); |
---|
474 | velocity->connectSignal("value_changed", (void*)velocity, changeOption ); |
---|
475 | emitterBox->fill(velocity); |
---|
476 | |
---|
477 | emitterBox->fill(new Label("SpreadAngle")); |
---|
478 | Slider* SpreadAngle = new Slider("SpreadAngle", 0, M_PI); |
---|
479 | SpreadAngle->setExactness(3); |
---|
480 | SpreadAngle->connectSignal("value_changed", (void*)SpreadAngle, changeOption ); |
---|
481 | emitterBox->fill(SpreadAngle); |
---|
482 | |
---|
483 | emitterBox->fill(new Label("EmitterType")); |
---|
484 | Menu* EmitterType = new Menu("EmitterType"); |
---|
485 | EmitterType->addItem("EMITTER_DOT"); |
---|
486 | EmitterType->addItem("EMITTER_PLANE"); |
---|
487 | EmitterType->addItem("EMITTER_CUBE"); |
---|
488 | EmitterType->connectSignal("changed", (void*)EmitterType, changeOption ); |
---|
489 | emitterBox->fill(EmitterType); |
---|
490 | |
---|
491 | emitterBox->fill(new Label("EmitterSize")); |
---|
492 | Slider* EmitterSize = new Slider("EmitterSize", 0, 100); |
---|
493 | EmitterSize->setExactness(1); |
---|
494 | EmitterSize->connectSignal("value_changed", (void*)EmitterSize, changeOption ); |
---|
495 | emitterBox->fill(EmitterSize); |
---|
496 | } |
---|
497 | emitterFrame->fill(emitterBox); |
---|
498 | } |
---|
499 | windowBox->fill(emitterFrame); |
---|
500 | |
---|
501 | Frame* systemFrame = new Frame("system-settings"); |
---|
502 | { |
---|
503 | Box* systemBox = new Box('v'); |
---|
504 | { |
---|
505 | systemBox->fill(new Label("StartRadius")); |
---|
506 | Slider* StartRadius = new Slider("StartRadius", 0, 10); |
---|
507 | StartRadius->setExactness(3); |
---|
508 | StartRadius->connectSignal("value_changed", (void*)StartRadius, changeOption ); |
---|
509 | systemBox->fill(StartRadius); |
---|
510 | |
---|
511 | systemBox->fill(new Label("EndRadius")); |
---|
512 | Slider* EndRadius = new Slider("EndRadius", 0, 10); |
---|
513 | EndRadius->setExactness(3); |
---|
514 | EndRadius->connectSignal("value_changed", (void*)EndRadius, changeOption ); |
---|
515 | systemBox->fill(EndRadius); |
---|
516 | |
---|
517 | systemBox->fill(new Label("LifeSpan")); |
---|
518 | Slider* LifeSpan = new Slider("LifeSpan", 0, 10); |
---|
519 | LifeSpan->setExactness(3); |
---|
520 | LifeSpan->connectSignal("value_changed", (void*)LifeSpan, changeOption ); |
---|
521 | systemBox->fill(LifeSpan); |
---|
522 | |
---|
523 | systemBox->fill(new Label("ConserveFactor")); |
---|
524 | Slider* ConserveFactor = new Slider("ConserveFactor", 0, 1); |
---|
525 | ConserveFactor->setExactness(3); |
---|
526 | ConserveFactor->connectSignal("value_changed", (void*)ConserveFactor, changeOption ); |
---|
527 | systemBox->fill(ConserveFactor); |
---|
528 | |
---|
529 | systemBox->fill(new Label("ParticleType")); |
---|
530 | Menu* ParticleType = new Menu("ParticleType"); |
---|
531 | ParticleType->addItem("PARTICLE_DOT"); |
---|
532 | ParticleType->addItem("PARTICLE_SPARK"); |
---|
533 | ParticleType->addItem("PARTICLE_SPRITE"); |
---|
534 | ParticleType->connectSignal("changed", (void*)ParticleType, changeOption ); |
---|
535 | systemBox->fill(ParticleType); |
---|
536 | |
---|
537 | systemBox->fill(new Label("InheritSpeed")); |
---|
538 | Slider* InheritSpeed = new Slider("InheritSpeed", 0, 1); |
---|
539 | InheritSpeed->setExactness(3); |
---|
540 | InheritSpeed->connectSignal("value_changed", (void*)InheritSpeed, changeOption ); |
---|
541 | systemBox->fill(InheritSpeed); |
---|
542 | |
---|
543 | |
---|
544 | } |
---|
545 | systemFrame->fill(systemBox); |
---|
546 | } |
---|
547 | windowBox->fill(systemFrame); |
---|
548 | |
---|
549 | Button* quitButton = new Button("quit"); |
---|
550 | |
---|
551 | |
---|
552 | windowBox->fill(quitButton); |
---|
553 | } |
---|
554 | guiMainWindow->fill(windowBox); |
---|
555 | } |
---|
556 | Window::mainWindow->showall(); |
---|
557 | Window::mainWindow->setSize(300, 500); |
---|
558 | mainloopGUI(); |
---|
559 | } |
---|
560 | |
---|
561 | |
---|
562 | |
---|
563 | int main(int argc, char *argv[]) |
---|
564 | { |
---|
565 | verbose = 3; |
---|
566 | pthread_t guiThread; |
---|
567 | |
---|
568 | Framework* framework = Framework::getInstance(); |
---|
569 | |
---|
570 | pthread_create(&guiThread, NULL, Framework::initGui,(void*) argv); |
---|
571 | // framework->initGui(argv); |
---|
572 | |
---|
573 | framework->mainLoop(); |
---|
574 | |
---|
575 | delete framework; |
---|
576 | // Kill the GL & SDL screens |
---|
577 | // And quit |
---|
578 | return 0; |
---|
579 | } |
---|