Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 8, 2005, 1:36:16 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some spaces…. :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/subprojects/particles/particle_fun.cc

    r4392 r4554  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    8484    case SDL_KEYDOWN:
    8585      switch (event->key.keysym.sym)
    86         {
    87         case SDLK_i:
    88           ParticleEngine::getInstance()->debug();
    89           PhysicsEngine::getInstance()->debug();
    90           break;
    91         }
     86        {
     87        case SDLK_i:
     88          ParticleEngine::getInstance()->debug();
     89          PhysicsEngine::getInstance()->debug();
     90          break;
     91        }
    9292    }
    9393}
     
    122122    {
    123123      if (!strcmp(name, "EmissionRate"))
    124         {
    125           tmpEmit->setEmissionRate(atof(value));
    126           PRINT(4)("EmissionRate set to %f\n", atof(value));
    127         }
     124        {
     125          tmpEmit->setEmissionRate(atof(value));
     126          PRINT(4)("EmissionRate set to %f\n", atof(value));
     127        }
    128128      else if (!strcmp(name, "Velocity"))
    129         {
    130           tmpEmit->setEmissionVelocity(atof(value));
    131           PRINT(4)("Velocity set to %f\n", atof(value));
    132         }
     129        {
     130          tmpEmit->setEmissionVelocity(atof(value));
     131          PRINT(4)("Velocity set to %f\n", atof(value));
     132        }
    133133      else if(!strcmp(name, "SpreadAngle"))
    134         {
    135           tmpEmit->setSpread(atof(value), 0);
    136           PRINT(4)("SpreadAngle set to %f\n", atof(value));
    137         }
     134        {
     135          tmpEmit->setSpread(atof(value), 0);
     136          PRINT(4)("SpreadAngle set to %f\n", atof(value));
     137        }
    138138      else if(!strcmp(name, "EmitterType"))
    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         }
     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        }
    148148      else if(!strcmp(name, "EmitterSize"))
    149         {
    150           tmpEmit->setSize(atof(value));
    151           PRINT(4)("EmitterSize set to %f\n", atof(value));
    152         }
     149        {
     150          tmpEmit->setSize(atof(value));
     151          PRINT(4)("EmitterSize set to %f\n", atof(value));
     152        }
    153153    }
    154154  delete value;
     
    166166    {
    167167      if (!strcmp(name, "StartRadius"))
    168         {
    169           tmpSys->setRadius(atof(value), tmpSys->getEndRadius());
    170           PRINT(4)("ParticleStartRadius set to %f\n", atof(value));
    171         }
     168        {
     169          tmpSys->setRadius(atof(value), tmpSys->getEndRadius());
     170          PRINT(4)("ParticleStartRadius set to %f\n", atof(value));
     171        }
    172172      else if (!strcmp(name, "EndRadius"))
    173         {
    174           tmpSys->setRadius( tmpSys->getStartRadius(), atof(value));
    175           PRINT(4)("ParticleEndRadius set to %f\n", atof(value));
    176         }
     173        {
     174          tmpSys->setRadius( tmpSys->getStartRadius(), atof(value));
     175          PRINT(4)("ParticleEndRadius set to %f\n", atof(value));
     176        }
    177177
    178178      else if (!strcmp(name, "LifeSpan"))
    179         {
    180           tmpSys->setLifeSpan(atof(value));
    181           PRINT(4)("ParticleLifeSpan set to %f\n", atof(value));
    182         }
     179        {
     180          tmpSys->setLifeSpan(atof(value));
     181          PRINT(4)("ParticleLifeSpan set to %f\n", atof(value));
     182        }
    183183
    184184      else if (!strcmp(name, "Mass"))
    185         {
    186           tmpSys->setMass(atof(value));
    187           PRINT(4)("ParticleMass set to %f\n", atof(value));
    188         }
     185        {
     186          tmpSys->setMass(atof(value));
     187          PRINT(4)("ParticleMass set to %f\n", atof(value));
     188        }
    189189
    190190      else if (!strcmp(name, "ConserveFactor"))
    191         {
    192           tmpSys->setConserve(atof(value));
    193           PRINT(4)("ParticleConserveFactor set to %f\n", atof(value));
    194         }
     191        {
     192          tmpSys->setConserve(atof(value));
     193          PRINT(4)("ParticleConserveFactor set to %f\n", atof(value));
     194        }
    195195
    196196      else if (!strcmp(name, "ParticleType"))
    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         }
     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        }
    207207
    208208      else if (!strcmp(name, "InheritSpeed"))
    209         {
    210           tmpSys->setInheritSpeed(atof(value));
    211           PRINT(4)("ParticleInheritSpeed set to %f\n", atof(value));
    212         }
     209        {
     210          tmpSys->setInheritSpeed(atof(value));
     211          PRINT(4)("ParticleInheritSpeed set to %f\n", atof(value));
     212        }
    213213      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                            (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, (float)rand()/RAND_MAX, 0);
    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        }
    219219    }
    220220  delete value;
     
    248248{
    249249  Window* guiMainWindow = NULL;
    250  
     250
    251251  initGUI(0, NULL);
    252  
     252
    253253  guiMainWindow = new Window("ParticlesFUN");
    254254  {
     
    257257      Frame* emitterFrame = new Frame("emitter-settings");
    258258      {
    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);
     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);
    302302      }
    303303      windowBox->fill(emitterFrame);
    304      
     304
    305305      Frame* systemFrame = new Frame("system-settings");
    306306      {
    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);
     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);
    371371      }
    372372      windowBox->fill(systemFrame);
     
    374374      Frame* fieldsFrame = new Frame("Field-Settings");
    375375      {
    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);
     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);
    406406      }
    407407      windowBox->fill(fieldsFrame);
    408      
     408
    409409      Button* quitButton = new Button("quit");
    410      
     410
    411411      quitButton->connectSignal("clicked", NULL, quitGui);
    412412      //  Window::mainWindow->connectSignal("remove", this, GuiExec::quitGui);
    413413      Window::mainWindow->connectSignal("destroy", NULL, quitGui);
    414414      windowBox->fill(quitButton);
    415      
     415
    416416    }
    417417    guiMainWindow->fill(windowBox);
Note: See TracChangeset for help on using the changeset viewer.