[4554] | 1 | /* |
---|
[4333] | 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 | this file extends the framework file, so it renders what i want. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | #include "framework.h" |
---|
| 19 | |
---|
| 20 | #include "physics_engine.h" |
---|
| 21 | #include "particle_engine.h" |
---|
[4378] | 22 | #include "fields.h" |
---|
[4381] | 23 | #include "stdlibincl.h" |
---|
[4649] | 24 | #include "graphics_engine.h" |
---|
[4667] | 25 | #include "light.h" |
---|
[4333] | 26 | |
---|
[4666] | 27 | #include <dirent.h> |
---|
| 28 | |
---|
[4351] | 29 | #define PINIT_EMISSION_RATE 50 |
---|
| 30 | #define PINIT_EMISSION_VELOCITY 5.0 |
---|
[4692] | 31 | #define PINIT_EMISSION_MOMENTUM 1.0 |
---|
[4351] | 32 | #define PINIT_SPREAD_ANGLE 0.1 |
---|
| 33 | #define PINIT_EMITTER_TYPE EMITTER_DOT |
---|
| 34 | #define PINIT_EMITTER_SIZE 1.0 |
---|
| 35 | #define PINIT_START_RADIUS 5.0 |
---|
| 36 | #define PINIT_END_RADIUS 0.0 |
---|
| 37 | #define PINIT_LIFESPAN 1.0 |
---|
| 38 | #define PINIT_CONSERVE_FACTOR 1.0 |
---|
| 39 | #define PINIT_PARTICLE_TYPE PARTICLE_SPRITE |
---|
| 40 | #define PINIT_INHERIT_SPEED 0.0 |
---|
[4378] | 41 | #define PINIT_PARTICLE_MASS 1.0 |
---|
[4666] | 42 | #define PINIT_MODEL_DIRECTORY "models/" |
---|
[4333] | 43 | |
---|
[4379] | 44 | |
---|
| 45 | Field* twirl; |
---|
| 46 | Field* gravity; |
---|
| 47 | Field* pointGravity; |
---|
| 48 | |
---|
[4343] | 49 | void Framework::moduleInit(int argc, char** argv) |
---|
[4333] | 50 | { |
---|
[4649] | 51 | GraphicsEngine::getInstance()->setWindowName("ParticlesFun", "particles"); |
---|
| 52 | |
---|
[4356] | 53 | verbose = 5; |
---|
[4378] | 54 | ParticleEngine::getInstance(); |
---|
| 55 | PhysicsEngine::getInstance(); |
---|
[4356] | 56 | |
---|
[4378] | 57 | |
---|
[4333] | 58 | // Creating a Test Particle System |
---|
[4639] | 59 | |
---|
[4351] | 60 | ParticleSystem* system = new ParticleSystem(100000, PINIT_PARTICLE_TYPE); |
---|
[4637] | 61 | system->setRadius(0, PINIT_START_RADIUS, 0 ); |
---|
| 62 | system->setRadius(1, PINIT_END_RADIUS, 0 ); |
---|
[4351] | 63 | system->setLifeSpan(PINIT_LIFESPAN); |
---|
[4555] | 64 | |
---|
[4351] | 65 | system->setConserve(PINIT_CONSERVE_FACTOR); |
---|
[4639] | 66 | //system->setMass(5,3,6); |
---|
[4333] | 67 | |
---|
| 68 | // Creating a Test Particle Emitter |
---|
| 69 | ParticleEmitter* emitter = new ParticleEmitter(Vector(0 , 1, 0)); |
---|
[4351] | 70 | emitter->setEmissionRate(PINIT_EMISSION_RATE); |
---|
| 71 | emitter->setEmissionVelocity(PINIT_EMISSION_VELOCITY ,0); |
---|
| 72 | emitter->setSpread(PINIT_SPREAD_ANGLE ,0); |
---|
| 73 | emitter->setType(PINIT_EMITTER_TYPE); |
---|
| 74 | emitter->setSize(PINIT_EMITTER_SIZE); |
---|
[4379] | 75 | emitter->setAbsCoor(Vector(3,0,0)); |
---|
[4333] | 76 | // Add the Flow from the Emitter into the System |
---|
| 77 | ParticleEngine::getInstance()->addConnection(emitter, system); |
---|
[4378] | 78 | |
---|
| 79 | |
---|
[4379] | 80 | twirl = new Twirl(); |
---|
[4383] | 81 | twirl->setMagnitude(0); |
---|
[4379] | 82 | gravity = new Gravity(); |
---|
[4383] | 83 | gravity->setMagnitude(0); |
---|
[4379] | 84 | pointGravity = new PointGravity(); |
---|
[4383] | 85 | pointGravity->setMagnitude(0); |
---|
| 86 | |
---|
| 87 | new PhysicsConnection(system, gravity); |
---|
| 88 | new PhysicsConnection(system, twirl); |
---|
| 89 | new PhysicsConnection(system, pointGravity); |
---|
[4667] | 90 | |
---|
[4741] | 91 | (new Light)->setAbsCoor(10, 10, 10); |
---|
[4667] | 92 | |
---|
[4333] | 93 | } |
---|
| 94 | |
---|
[4334] | 95 | void Framework::moduleEventHandler(SDL_Event* event) |
---|
| 96 | { |
---|
| 97 | switch (event->type) |
---|
| 98 | { |
---|
| 99 | case SDL_KEYDOWN: |
---|
| 100 | switch (event->key.keysym.sym) |
---|
[4554] | 101 | { |
---|
| 102 | case SDLK_i: |
---|
| 103 | ParticleEngine::getInstance()->debug(); |
---|
| 104 | PhysicsEngine::getInstance()->debug(); |
---|
| 105 | break; |
---|
| 106 | } |
---|
[4334] | 107 | } |
---|
[4333] | 108 | } |
---|
| 109 | |
---|
| 110 | void Framework::moduleTick(float dt) |
---|
| 111 | { |
---|
[4378] | 112 | PhysicsEngine::getInstance()->tick(dt); |
---|
[4333] | 113 | ParticleEngine::getInstance()->tick(dt); |
---|
| 114 | } |
---|
| 115 | |
---|
[4349] | 116 | void Framework::moduleDraw() const |
---|
[4334] | 117 | { |
---|
[4349] | 118 | ParticleEngine::getInstance()->draw(); |
---|
[4334] | 119 | } |
---|
[4333] | 120 | |
---|
[4334] | 121 | |
---|
[4333] | 122 | void Framework::moduleHelp(void) const |
---|
| 123 | { |
---|
| 124 | PRINT(0)("\n"); |
---|
[4336] | 125 | PRINT(0)("i - Particle-state Information\n\n"); |
---|
| 126 | PRINT(0)("\n"); |
---|
[4333] | 127 | } |
---|
| 128 | |
---|
| 129 | int emitterChange(GtkWidget* nonInterest, void* widget) |
---|
| 130 | { |
---|
| 131 | Option* option = (Option*) widget; |
---|
| 132 | const char* name = option->getTitle(); |
---|
[4336] | 133 | char* value = option->save(); |
---|
[4333] | 134 | |
---|
| 135 | ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1); |
---|
| 136 | if (tmpEmit) |
---|
| 137 | { |
---|
| 138 | if (!strcmp(name, "EmissionRate")) |
---|
[4554] | 139 | { |
---|
| 140 | tmpEmit->setEmissionRate(atof(value)); |
---|
| 141 | PRINT(4)("EmissionRate set to %f\n", atof(value)); |
---|
| 142 | } |
---|
[4333] | 143 | else if (!strcmp(name, "Velocity")) |
---|
[4554] | 144 | { |
---|
| 145 | tmpEmit->setEmissionVelocity(atof(value)); |
---|
| 146 | PRINT(4)("Velocity set to %f\n", atof(value)); |
---|
| 147 | } |
---|
[4692] | 148 | else if (!strcmp(name, "Momentum")) |
---|
| 149 | { |
---|
| 150 | tmpEmit->setEmissionMomentum(atof(value)); |
---|
| 151 | PRINT(4)("Momentum set to %f\n", atof(value)); |
---|
| 152 | } |
---|
[4333] | 153 | else if(!strcmp(name, "SpreadAngle")) |
---|
[4554] | 154 | { |
---|
| 155 | tmpEmit->setSpread(atof(value), 0); |
---|
| 156 | PRINT(4)("SpreadAngle set to %f\n", atof(value)); |
---|
| 157 | } |
---|
[4333] | 158 | else if(!strcmp(name, "EmitterType")) |
---|
[4554] | 159 | { |
---|
| 160 | if (!strcmp(value, "EMITTER_DOT")) |
---|
| 161 | tmpEmit->setType(EMITTER_DOT); |
---|
| 162 | else if (!strcmp(value, "EMITTER_PLANE")) |
---|
| 163 | tmpEmit->setType(EMITTER_PLANE); |
---|
| 164 | else if (!strcmp(value, "EMITTER_CUBE")) |
---|
| 165 | tmpEmit->setType(EMITTER_CUBE); |
---|
| 166 | PRINT(4)("EmitterType set to %s\n", value); |
---|
| 167 | } |
---|
[4333] | 168 | else if(!strcmp(name, "EmitterSize")) |
---|
[4554] | 169 | { |
---|
| 170 | tmpEmit->setSize(atof(value)); |
---|
| 171 | PRINT(4)("EmitterSize set to %f\n", atof(value)); |
---|
| 172 | } |
---|
[4637] | 173 | else if (!strcmp(name, "InheritSpeed")) |
---|
| 174 | { |
---|
| 175 | tmpEmit->setInheritSpeed(atof(value)); |
---|
| 176 | PRINT(4)("ParticleInheritSpeed set to %f\n", atof(value)); |
---|
| 177 | } |
---|
[4333] | 178 | } |
---|
[4336] | 179 | delete value; |
---|
[4333] | 180 | } |
---|
| 181 | |
---|
| 182 | |
---|
| 183 | int systemChange(GtkWidget* nonInterest, void* widget) |
---|
| 184 | { |
---|
| 185 | Option* option = (Option*) widget; |
---|
| 186 | const char* name = option->getTitle(); |
---|
[4336] | 187 | char* value = option->save(); |
---|
[4333] | 188 | |
---|
| 189 | ParticleSystem* tmpSys = ParticleEngine::getInstance()->getSystemByNumber(1); |
---|
| 190 | if (tmpSys) |
---|
| 191 | { |
---|
| 192 | if (!strcmp(name, "StartRadius")) |
---|
[4554] | 193 | { |
---|
[4637] | 194 | tmpSys->setRadius(0, atof(value)); |
---|
[4554] | 195 | PRINT(4)("ParticleStartRadius set to %f\n", atof(value)); |
---|
| 196 | } |
---|
[4333] | 197 | else if (!strcmp(name, "EndRadius")) |
---|
[4554] | 198 | { |
---|
[4637] | 199 | tmpSys->setRadius( 1, atof(value)); |
---|
[4554] | 200 | PRINT(4)("ParticleEndRadius set to %f\n", atof(value)); |
---|
| 201 | } |
---|
[4333] | 202 | |
---|
| 203 | else if (!strcmp(name, "LifeSpan")) |
---|
[4554] | 204 | { |
---|
| 205 | tmpSys->setLifeSpan(atof(value)); |
---|
| 206 | PRINT(4)("ParticleLifeSpan set to %f\n", atof(value)); |
---|
| 207 | } |
---|
[4333] | 208 | |
---|
[4383] | 209 | else if (!strcmp(name, "Mass")) |
---|
[4554] | 210 | { |
---|
[4637] | 211 | tmpSys->setMass(0, atof(value)); |
---|
[4554] | 212 | PRINT(4)("ParticleMass set to %f\n", atof(value)); |
---|
| 213 | } |
---|
[4383] | 214 | |
---|
[4333] | 215 | else if (!strcmp(name, "ConserveFactor")) |
---|
[4554] | 216 | { |
---|
| 217 | tmpSys->setConserve(atof(value)); |
---|
| 218 | PRINT(4)("ParticleConserveFactor set to %f\n", atof(value)); |
---|
| 219 | } |
---|
[4333] | 220 | |
---|
| 221 | else if (!strcmp(name, "ParticleType")) |
---|
[4554] | 222 | { |
---|
| 223 | if (!strcmp(value, "PARTICLE_DOT")) |
---|
| 224 | tmpSys->setType(PARTICLE_DOT); |
---|
| 225 | else if (!strcmp(value, "PARTICLE_SPARK")) |
---|
| 226 | tmpSys->setType(PARTICLE_SPARK); |
---|
| 227 | else if (!strcmp(value, "PARTICLE_SPRITE")) |
---|
| 228 | tmpSys->setType(PARTICLE_SPRITE); |
---|
[4333] | 229 | |
---|
[4554] | 230 | PRINT(4)("ParticleType set to %s\n", value); |
---|
| 231 | } |
---|
[4666] | 232 | else if(!strcmp(name, "ParticleModel")) |
---|
| 233 | { |
---|
| 234 | char* modelName = new char[strlen(PINIT_MODEL_DIRECTORY) + strlen(value)+1]; |
---|
| 235 | sprintf(modelName, "%s%s", PINIT_MODEL_DIRECTORY, value); |
---|
[4726] | 236 | tmpSys->loadModel(modelName); |
---|
[4666] | 237 | delete modelName; |
---|
| 238 | } |
---|
[4351] | 239 | else if (!strcmp(name, "RandomColor")) |
---|
[4554] | 240 | { |
---|
[4637] | 241 | tmpSys->setColor(0, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, 1); |
---|
| 242 | tmpSys->setColor(.5, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, .5); |
---|
| 243 | tmpSys->setColor(.5, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, 0); |
---|
[4554] | 244 | } |
---|
[4333] | 245 | } |
---|
[4336] | 246 | delete value; |
---|
[4333] | 247 | } |
---|
| 248 | |
---|
[4379] | 249 | int fieldsChange(GtkWidget* nonInterest, void* widget) |
---|
| 250 | { |
---|
| 251 | Option* option = (Option*) widget; |
---|
| 252 | const char* name = option->getTitle(); |
---|
| 253 | char* value = option->save(); |
---|
[4333] | 254 | |
---|
[4379] | 255 | |
---|
[4383] | 256 | if (!strcmp(name, "Gravity")) |
---|
[4379] | 257 | { |
---|
[4383] | 258 | gravity->setMagnitude(atof(value)); |
---|
[4379] | 259 | } |
---|
| 260 | |
---|
[4383] | 261 | else if (!strcmp(name, "Twirl")) |
---|
| 262 | { |
---|
| 263 | twirl->setMagnitude(atof(value)); |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | else if (!strcmp(name, "PointGravity")) |
---|
| 267 | { |
---|
| 268 | pointGravity->setMagnitude(atof(value)); |
---|
| 269 | } |
---|
| 270 | |
---|
[4379] | 271 | } |
---|
| 272 | |
---|
[4343] | 273 | void Framework::moduleInitGui(int argc, char** argv) |
---|
[4333] | 274 | { |
---|
| 275 | Window* guiMainWindow = NULL; |
---|
[4554] | 276 | |
---|
[4333] | 277 | initGUI(0, NULL); |
---|
[4554] | 278 | |
---|
[4333] | 279 | guiMainWindow = new Window("ParticlesFUN"); |
---|
| 280 | { |
---|
[4379] | 281 | Box* windowBox = new Box('h'); |
---|
[4333] | 282 | { |
---|
| 283 | Frame* emitterFrame = new Frame("emitter-settings"); |
---|
| 284 | { |
---|
[4554] | 285 | Box* emitterBox = new Box('v'); |
---|
| 286 | { |
---|
| 287 | emitterBox->fill(new Label("EmissionRate")); |
---|
| 288 | Slider* EmissionRate = new Slider("EmissionRate", 0, 1000); |
---|
| 289 | EmissionRate->connectSignal("value_changed", (void*)EmissionRate, emitterChange ); |
---|
| 290 | EmissionRate->setValue(PINIT_EMISSION_RATE); |
---|
| 291 | EmissionRate->redraw(); |
---|
| 292 | emitterBox->fill(EmissionRate); |
---|
[4333] | 293 | |
---|
[4554] | 294 | emitterBox->fill(new Label("Velocity")); |
---|
| 295 | Slider* velocity = new Slider("Velocity", 0, 20); |
---|
| 296 | velocity->setExactness(2); |
---|
| 297 | velocity->connectSignal("value_changed", (void*)velocity, emitterChange ); |
---|
| 298 | velocity->setValue(PINIT_EMISSION_VELOCITY); |
---|
| 299 | velocity->redraw(); |
---|
| 300 | emitterBox->fill(velocity); |
---|
[4333] | 301 | |
---|
[4692] | 302 | emitterBox->fill(new Label("Momentum")); |
---|
| 303 | Slider* Momentum = new Slider("Momentum", 0, 20); |
---|
| 304 | Momentum->setExactness(2); |
---|
| 305 | Momentum->connectSignal("value_changed", (void*)Momentum, emitterChange ); |
---|
| 306 | Momentum->setValue(PINIT_EMISSION_MOMENTUM); |
---|
| 307 | Momentum->redraw(); |
---|
| 308 | emitterBox->fill(Momentum); |
---|
| 309 | |
---|
[4554] | 310 | emitterBox->fill(new Label("SpreadAngle")); |
---|
| 311 | Slider* SpreadAngle = new Slider("SpreadAngle", 0, M_PI); |
---|
| 312 | SpreadAngle->setExactness(3); |
---|
| 313 | SpreadAngle->connectSignal("value_changed", (void*)SpreadAngle, emitterChange ); |
---|
| 314 | SpreadAngle->setValue(PINIT_SPREAD_ANGLE); |
---|
| 315 | SpreadAngle->redraw(); |
---|
| 316 | emitterBox->fill(SpreadAngle); |
---|
| 317 | |
---|
| 318 | emitterBox->fill(new Label("EmitterType")); |
---|
| 319 | Menu* EmitterType = new Menu("EmitterType"); |
---|
| 320 | EmitterType->addItem("EMITTER_DOT"); |
---|
| 321 | EmitterType->addItem("EMITTER_PLANE"); |
---|
| 322 | EmitterType->addItem("EMITTER_CUBE"); |
---|
| 323 | EmitterType->connectSignal("changed", (void*)EmitterType, emitterChange ); |
---|
| 324 | EmitterType->load("EMITTER_DOT"); |
---|
| 325 | emitterBox->fill(EmitterType); |
---|
| 326 | |
---|
| 327 | emitterBox->fill(new Label("EmitterSize")); |
---|
| 328 | Slider* EmitterSize = new Slider("EmitterSize", 0, 100); |
---|
| 329 | EmitterSize->setExactness(1); |
---|
| 330 | EmitterSize->connectSignal("value_changed", (void*)EmitterSize, emitterChange ); |
---|
| 331 | EmitterSize->setValue(PINIT_EMITTER_SIZE); |
---|
| 332 | EmitterSize->redraw(); |
---|
| 333 | emitterBox->fill(EmitterSize); |
---|
[4637] | 334 | |
---|
| 335 | emitterBox->fill(new Label("InheritSpeed")); |
---|
| 336 | Slider* InheritSpeed = new Slider("InheritSpeed", 0, 1); |
---|
| 337 | InheritSpeed->setExactness(3); |
---|
| 338 | InheritSpeed->connectSignal("value_changed", (void*)InheritSpeed, emitterChange ); |
---|
| 339 | emitterBox->fill(InheritSpeed); |
---|
[4554] | 340 | } |
---|
| 341 | emitterFrame->fill(emitterBox); |
---|
[4333] | 342 | } |
---|
| 343 | windowBox->fill(emitterFrame); |
---|
[4554] | 344 | |
---|
[4333] | 345 | Frame* systemFrame = new Frame("system-settings"); |
---|
| 346 | { |
---|
[4554] | 347 | Box* systemBox = new Box('v'); |
---|
| 348 | { |
---|
| 349 | systemBox->fill(new Label("StartRadius")); |
---|
| 350 | Slider* StartRadius = new Slider("StartRadius", 0, 10); |
---|
| 351 | StartRadius->setExactness(3); |
---|
| 352 | StartRadius->connectSignal("value_changed", (void*)StartRadius, systemChange ); |
---|
| 353 | StartRadius->setValue(PINIT_START_RADIUS); |
---|
| 354 | StartRadius->redraw(); |
---|
| 355 | systemBox->fill(StartRadius); |
---|
[4333] | 356 | |
---|
[4554] | 357 | systemBox->fill(new Label("EndRadius")); |
---|
| 358 | Slider* EndRadius = new Slider("EndRadius", 0, 10); |
---|
| 359 | EndRadius->setExactness(3); |
---|
| 360 | EndRadius->connectSignal("value_changed", (void*)EndRadius, systemChange ); |
---|
| 361 | EndRadius->setValue(PINIT_END_RADIUS); |
---|
| 362 | EndRadius->redraw(); |
---|
| 363 | systemBox->fill(EndRadius); |
---|
[4333] | 364 | |
---|
[4554] | 365 | systemBox->fill(new Label("ParticleMass")); |
---|
| 366 | Slider* Mass = new Slider("Mass", 0, 10); |
---|
| 367 | Mass->setExactness(2); |
---|
| 368 | Mass->connectSignal("value_changed", (void*)Mass, systemChange ); |
---|
| 369 | Mass->setValue(PINIT_PARTICLE_MASS); |
---|
| 370 | Mass->redraw(); |
---|
| 371 | systemBox->fill(Mass); |
---|
[4383] | 372 | |
---|
[4333] | 373 | |
---|
[4554] | 374 | systemBox->fill(new Label("LifeSpan")); |
---|
| 375 | Slider* LifeSpan = new Slider("LifeSpan", 0, 10); |
---|
| 376 | LifeSpan->setExactness(3); |
---|
| 377 | LifeSpan->connectSignal("value_changed", (void*)LifeSpan, systemChange ); |
---|
| 378 | LifeSpan->setValue(PINIT_LIFESPAN); |
---|
| 379 | LifeSpan->redraw(); |
---|
| 380 | systemBox->fill(LifeSpan); |
---|
[4333] | 381 | |
---|
[4554] | 382 | systemBox->fill(new Label("ConserveFactor")); |
---|
| 383 | Slider* ConserveFactor = new Slider("ConserveFactor", 0, 1); |
---|
| 384 | ConserveFactor->setExactness(3); |
---|
| 385 | ConserveFactor->connectSignal("value_changed", (void*)ConserveFactor, systemChange ); |
---|
| 386 | ConserveFactor->setValue(PINIT_CONSERVE_FACTOR); |
---|
| 387 | ConserveFactor->redraw(); |
---|
| 388 | systemBox->fill(ConserveFactor); |
---|
[4333] | 389 | |
---|
[4554] | 390 | systemBox->fill(new Label("ParticleType")); |
---|
| 391 | Menu* ParticleType = new Menu("ParticleType"); |
---|
| 392 | ParticleType->addItem("PARTICLE_DOT"); |
---|
| 393 | ParticleType->addItem("PARTICLE_SPARK"); |
---|
| 394 | ParticleType->addItem("PARTICLE_SPRITE"); |
---|
| 395 | ParticleType->connectSignal("changed", (void*)ParticleType, systemChange ); |
---|
| 396 | ParticleType->load("PARTICLE_SPRITE"); |
---|
| 397 | systemBox->fill(ParticleType); |
---|
| 398 | |
---|
[4666] | 399 | systemBox->fill(new Label("ParticleModel")); |
---|
| 400 | Menu* ParticleModel = new Menu("ParticleModel"); |
---|
| 401 | { |
---|
| 402 | DIR* directory; |
---|
| 403 | directory = opendir(ResourceManager::getFullName(PINIT_MODEL_DIRECTORY)); |
---|
| 404 | dirent* file; |
---|
| 405 | while(file = readdir(directory)) |
---|
| 406 | if(strstr(file->d_name, ".obj")) |
---|
| 407 | ParticleModel->addItem(file->d_name); |
---|
| 408 | } |
---|
| 409 | ParticleModel->connectSignal("changed", (void*)ParticleModel, systemChange ); |
---|
| 410 | systemBox->fill(ParticleModel); |
---|
| 411 | |
---|
| 412 | |
---|
[4554] | 413 | Button* RandomColor = new Button("RandomColor"); |
---|
| 414 | RandomColor->connectSignal("released", (void*)RandomColor, systemChange); |
---|
| 415 | systemBox->fill(RandomColor); |
---|
| 416 | |
---|
| 417 | } |
---|
| 418 | systemFrame->fill(systemBox); |
---|
[4333] | 419 | } |
---|
| 420 | windowBox->fill(systemFrame); |
---|
[4379] | 421 | |
---|
| 422 | Frame* fieldsFrame = new Frame("Field-Settings"); |
---|
| 423 | { |
---|
[4554] | 424 | Box* fieldsBox = new Box('v'); |
---|
| 425 | { |
---|
| 426 | fieldsBox->fill(new Label("Gravity")); |
---|
| 427 | Slider* Gravity = new Slider("Gravity", 0, 10); |
---|
| 428 | Gravity->setExactness(1); |
---|
| 429 | Gravity->connectSignal("value_changed", (void*)Gravity, fieldsChange ); |
---|
| 430 | Gravity->setValue(0); |
---|
| 431 | Gravity->redraw(); |
---|
| 432 | fieldsBox->fill(Gravity); |
---|
[4383] | 433 | |
---|
| 434 | |
---|
[4554] | 435 | fieldsBox->fill(new Label("Twirl")); |
---|
| 436 | Slider* Twirl = new Slider("Twirl", 0, 10); |
---|
| 437 | Twirl->setExactness(1); |
---|
| 438 | Twirl->connectSignal("value_changed", (void*)Twirl, fieldsChange ); |
---|
| 439 | Twirl->setValue(0); |
---|
| 440 | Twirl->redraw(); |
---|
| 441 | fieldsBox->fill(Twirl); |
---|
[4383] | 442 | |
---|
| 443 | |
---|
[4554] | 444 | fieldsBox->fill(new Label("PointGravity")); |
---|
| 445 | Slider* PointGravity = new Slider("PointGravity", 0, 10); |
---|
| 446 | PointGravity->setExactness(1); |
---|
| 447 | PointGravity->connectSignal("value_changed", (void*)PointGravity, fieldsChange ); |
---|
| 448 | PointGravity->setValue(0); |
---|
| 449 | PointGravity->redraw(); |
---|
| 450 | fieldsBox->fill(PointGravity); |
---|
[4383] | 451 | |
---|
[4554] | 452 | } |
---|
| 453 | fieldsFrame->fill(fieldsBox); |
---|
[4379] | 454 | } |
---|
| 455 | windowBox->fill(fieldsFrame); |
---|
[4554] | 456 | |
---|
[4333] | 457 | Button* quitButton = new Button("quit"); |
---|
[4554] | 458 | |
---|
[4333] | 459 | quitButton->connectSignal("clicked", NULL, quitGui); |
---|
| 460 | // Window::mainWindow->connectSignal("remove", this, GuiExec::quitGui); |
---|
| 461 | Window::mainWindow->connectSignal("destroy", NULL, quitGui); |
---|
[4385] | 462 | windowBox->fill(quitButton); |
---|
[4554] | 463 | |
---|
[4333] | 464 | } |
---|
| 465 | guiMainWindow->fill(windowBox); |
---|
| 466 | } |
---|
| 467 | Window::mainWindow->showall(); |
---|
| 468 | Window::mainWindow->setSize(300, 500); |
---|
| 469 | } |
---|