Changeset 4554 in orxonox.OLD for orxonox/trunk/src/subprojects/particles
- Timestamp:
- Jun 8, 2005, 1:36:16 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/subprojects/particles/particle_fun.cc
r4392 r4554 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 84 84 case SDL_KEYDOWN: 85 85 switch (event->key.keysym.sym) 86 87 88 89 90 91 86 { 87 case SDLK_i: 88 ParticleEngine::getInstance()->debug(); 89 PhysicsEngine::getInstance()->debug(); 90 break; 91 } 92 92 } 93 93 } … … 122 122 { 123 123 if (!strcmp(name, "EmissionRate")) 124 125 126 127 124 { 125 tmpEmit->setEmissionRate(atof(value)); 126 PRINT(4)("EmissionRate set to %f\n", atof(value)); 127 } 128 128 else if (!strcmp(name, "Velocity")) 129 130 131 132 129 { 130 tmpEmit->setEmissionVelocity(atof(value)); 131 PRINT(4)("Velocity set to %f\n", atof(value)); 132 } 133 133 else if(!strcmp(name, "SpreadAngle")) 134 135 136 137 134 { 135 tmpEmit->setSpread(atof(value), 0); 136 PRINT(4)("SpreadAngle set to %f\n", atof(value)); 137 } 138 138 else if(!strcmp(name, "EmitterType")) 139 140 141 142 143 144 145 146 147 139 { 140 if (!strcmp(value, "EMITTER_DOT")) 141 tmpEmit->setType(EMITTER_DOT); 142 else if (!strcmp(value, "EMITTER_PLANE")) 143 tmpEmit->setType(EMITTER_PLANE); 144 else if (!strcmp(value, "EMITTER_CUBE")) 145 tmpEmit->setType(EMITTER_CUBE); 146 PRINT(4)("EmitterType set to %s\n", value); 147 } 148 148 else if(!strcmp(name, "EmitterSize")) 149 150 151 152 149 { 150 tmpEmit->setSize(atof(value)); 151 PRINT(4)("EmitterSize set to %f\n", atof(value)); 152 } 153 153 } 154 154 delete value; … … 166 166 { 167 167 if (!strcmp(name, "StartRadius")) 168 169 170 171 168 { 169 tmpSys->setRadius(atof(value), tmpSys->getEndRadius()); 170 PRINT(4)("ParticleStartRadius set to %f\n", atof(value)); 171 } 172 172 else if (!strcmp(name, "EndRadius")) 173 174 175 176 173 { 174 tmpSys->setRadius( tmpSys->getStartRadius(), atof(value)); 175 PRINT(4)("ParticleEndRadius set to %f\n", atof(value)); 176 } 177 177 178 178 else if (!strcmp(name, "LifeSpan")) 179 180 181 182 179 { 180 tmpSys->setLifeSpan(atof(value)); 181 PRINT(4)("ParticleLifeSpan set to %f\n", atof(value)); 182 } 183 183 184 184 else if (!strcmp(name, "Mass")) 185 186 187 188 185 { 186 tmpSys->setMass(atof(value)); 187 PRINT(4)("ParticleMass set to %f\n", atof(value)); 188 } 189 189 190 190 else if (!strcmp(name, "ConserveFactor")) 191 192 193 194 191 { 192 tmpSys->setConserve(atof(value)); 193 PRINT(4)("ParticleConserveFactor set to %f\n", atof(value)); 194 } 195 195 196 196 else if (!strcmp(name, "ParticleType")) 197 198 199 200 201 202 203 204 205 206 197 { 198 if (!strcmp(value, "PARTICLE_DOT")) 199 tmpSys->setType(PARTICLE_DOT); 200 else if (!strcmp(value, "PARTICLE_SPARK")) 201 tmpSys->setType(PARTICLE_SPARK); 202 else if (!strcmp(value, "PARTICLE_SPRITE")) 203 tmpSys->setType(PARTICLE_SPRITE); 204 205 PRINT(4)("ParticleType set to %s\n", value); 206 } 207 207 208 208 else if (!strcmp(name, "InheritSpeed")) 209 210 211 212 209 { 210 tmpSys->setInheritSpeed(atof(value)); 211 PRINT(4)("ParticleInheritSpeed set to %f\n", atof(value)); 212 } 213 213 else if (!strcmp(name, "RandomColor")) 214 215 tmpSys->setColor((float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, 1, 216 (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, .5, 217 218 214 { 215 tmpSys->setColor((float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, 1, 216 (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, .5, 217 (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, 0); 218 } 219 219 } 220 220 delete value; … … 248 248 { 249 249 Window* guiMainWindow = NULL; 250 250 251 251 initGUI(0, NULL); 252 252 253 253 guiMainWindow = new Window("ParticlesFUN"); 254 254 { … … 257 257 Frame* emitterFrame = new Frame("emitter-settings"); 258 258 { 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 259 Box* emitterBox = new Box('v'); 260 { 261 emitterBox->fill(new Label("EmissionRate")); 262 Slider* EmissionRate = new Slider("EmissionRate", 0, 1000); 263 EmissionRate->connectSignal("value_changed", (void*)EmissionRate, emitterChange ); 264 EmissionRate->setValue(PINIT_EMISSION_RATE); 265 EmissionRate->redraw(); 266 emitterBox->fill(EmissionRate); 267 268 emitterBox->fill(new Label("Velocity")); 269 Slider* velocity = new Slider("Velocity", 0, 20); 270 velocity->setExactness(2); 271 velocity->connectSignal("value_changed", (void*)velocity, emitterChange ); 272 velocity->setValue(PINIT_EMISSION_VELOCITY); 273 velocity->redraw(); 274 emitterBox->fill(velocity); 275 276 emitterBox->fill(new Label("SpreadAngle")); 277 Slider* SpreadAngle = new Slider("SpreadAngle", 0, M_PI); 278 SpreadAngle->setExactness(3); 279 SpreadAngle->connectSignal("value_changed", (void*)SpreadAngle, emitterChange ); 280 SpreadAngle->setValue(PINIT_SPREAD_ANGLE); 281 SpreadAngle->redraw(); 282 emitterBox->fill(SpreadAngle); 283 284 emitterBox->fill(new Label("EmitterType")); 285 Menu* EmitterType = new Menu("EmitterType"); 286 EmitterType->addItem("EMITTER_DOT"); 287 EmitterType->addItem("EMITTER_PLANE"); 288 EmitterType->addItem("EMITTER_CUBE"); 289 EmitterType->connectSignal("changed", (void*)EmitterType, emitterChange ); 290 EmitterType->load("EMITTER_DOT"); 291 emitterBox->fill(EmitterType); 292 293 emitterBox->fill(new Label("EmitterSize")); 294 Slider* EmitterSize = new Slider("EmitterSize", 0, 100); 295 EmitterSize->setExactness(1); 296 EmitterSize->connectSignal("value_changed", (void*)EmitterSize, emitterChange ); 297 EmitterSize->setValue(PINIT_EMITTER_SIZE); 298 EmitterSize->redraw(); 299 emitterBox->fill(EmitterSize); 300 } 301 emitterFrame->fill(emitterBox); 302 302 } 303 303 windowBox->fill(emitterFrame); 304 304 305 305 Frame* systemFrame = new Frame("system-settings"); 306 306 { 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 ParticleType->connectSignal("changed", (void*)ParticleType, systemChange ); 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 307 Box* systemBox = new Box('v'); 308 { 309 systemBox->fill(new Label("StartRadius")); 310 Slider* StartRadius = new Slider("StartRadius", 0, 10); 311 StartRadius->setExactness(3); 312 StartRadius->connectSignal("value_changed", (void*)StartRadius, systemChange ); 313 StartRadius->setValue(PINIT_START_RADIUS); 314 StartRadius->redraw(); 315 systemBox->fill(StartRadius); 316 317 systemBox->fill(new Label("EndRadius")); 318 Slider* EndRadius = new Slider("EndRadius", 0, 10); 319 EndRadius->setExactness(3); 320 EndRadius->connectSignal("value_changed", (void*)EndRadius, systemChange ); 321 EndRadius->setValue(PINIT_END_RADIUS); 322 EndRadius->redraw(); 323 systemBox->fill(EndRadius); 324 325 systemBox->fill(new Label("ParticleMass")); 326 Slider* Mass = new Slider("Mass", 0, 10); 327 Mass->setExactness(2); 328 Mass->connectSignal("value_changed", (void*)Mass, systemChange ); 329 Mass->setValue(PINIT_PARTICLE_MASS); 330 Mass->redraw(); 331 systemBox->fill(Mass); 332 333 334 systemBox->fill(new Label("LifeSpan")); 335 Slider* LifeSpan = new Slider("LifeSpan", 0, 10); 336 LifeSpan->setExactness(3); 337 LifeSpan->connectSignal("value_changed", (void*)LifeSpan, systemChange ); 338 LifeSpan->setValue(PINIT_LIFESPAN); 339 LifeSpan->redraw(); 340 systemBox->fill(LifeSpan); 341 342 systemBox->fill(new Label("ConserveFactor")); 343 Slider* ConserveFactor = new Slider("ConserveFactor", 0, 1); 344 ConserveFactor->setExactness(3); 345 ConserveFactor->connectSignal("value_changed", (void*)ConserveFactor, systemChange ); 346 ConserveFactor->setValue(PINIT_CONSERVE_FACTOR); 347 ConserveFactor->redraw(); 348 systemBox->fill(ConserveFactor); 349 350 systemBox->fill(new Label("ParticleType")); 351 Menu* ParticleType = new Menu("ParticleType"); 352 ParticleType->addItem("PARTICLE_DOT"); 353 ParticleType->addItem("PARTICLE_SPARK"); 354 ParticleType->addItem("PARTICLE_SPRITE"); 355 ParticleType->connectSignal("changed", (void*)ParticleType, systemChange ); 356 ParticleType->load("PARTICLE_SPRITE"); 357 systemBox->fill(ParticleType); 358 359 systemBox->fill(new Label("InheritSpeed")); 360 Slider* InheritSpeed = new Slider("InheritSpeed", 0, 1); 361 InheritSpeed->setExactness(3); 362 InheritSpeed->connectSignal("value_changed", (void*)InheritSpeed, systemChange ); 363 systemBox->fill(InheritSpeed); 364 365 Button* RandomColor = new Button("RandomColor"); 366 RandomColor->connectSignal("released", (void*)RandomColor, systemChange); 367 systemBox->fill(RandomColor); 368 369 } 370 systemFrame->fill(systemBox); 371 371 } 372 372 windowBox->fill(systemFrame); … … 374 374 Frame* fieldsFrame = new Frame("Field-Settings"); 375 375 { 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 376 Box* fieldsBox = new Box('v'); 377 { 378 fieldsBox->fill(new Label("Gravity")); 379 Slider* Gravity = new Slider("Gravity", 0, 10); 380 Gravity->setExactness(1); 381 Gravity->connectSignal("value_changed", (void*)Gravity, fieldsChange ); 382 Gravity->setValue(0); 383 Gravity->redraw(); 384 fieldsBox->fill(Gravity); 385 386 387 fieldsBox->fill(new Label("Twirl")); 388 Slider* Twirl = new Slider("Twirl", 0, 10); 389 Twirl->setExactness(1); 390 Twirl->connectSignal("value_changed", (void*)Twirl, fieldsChange ); 391 Twirl->setValue(0); 392 Twirl->redraw(); 393 fieldsBox->fill(Twirl); 394 395 396 fieldsBox->fill(new Label("PointGravity")); 397 Slider* PointGravity = new Slider("PointGravity", 0, 10); 398 PointGravity->setExactness(1); 399 PointGravity->connectSignal("value_changed", (void*)PointGravity, fieldsChange ); 400 PointGravity->setValue(0); 401 PointGravity->redraw(); 402 fieldsBox->fill(PointGravity); 403 404 } 405 fieldsFrame->fill(fieldsBox); 406 406 } 407 407 windowBox->fill(fieldsFrame); 408 408 409 409 Button* quitButton = new Button("quit"); 410 410 411 411 quitButton->connectSignal("clicked", NULL, quitGui); 412 412 // Window::mainWindow->connectSignal("remove", this, GuiExec::quitGui); 413 413 Window::mainWindow->connectSignal("destroy", NULL, quitGui); 414 414 windowBox->fill(quitButton); 415 415 416 416 } 417 417 guiMainWindow->fill(windowBox);
Note: See TracChangeset
for help on using the changeset viewer.