Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4323 in orxonox.OLD for orxonox/branches


Ignore:
Timestamp:
May 27, 2005, 1:53:40 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/physics: gui works with a slider :)

Location:
orxonox/branches/physics/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/lib/gui/gui/gui_gtk.h

    r4319 r4323  
    6161
    6262  virtual void setTitle(const char* title);  //!< An abstract Function, that sets the title of Widgets.
     63  virtual const char* getTitle(void) const { return this->title; };
    6364
    6465  Widget* findWidgetByName(char* name, unsigned int depth);
  • orxonox/branches/physics/src/subprojects/particles/framework.cc

    r4317 r4323  
    358358}
    359359
     360int 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  delete valueC;
     367
     368  printf("%s, %f\n", name, value);
     369
     370  ParticleEmitter* tmpEmit = ParticleEngine::getInstance()->getEmitterByNumber(1);
     371  if (tmpEmit)
     372    {
     373      if (!strcmp(name, "EmissionRate"))
     374      {
     375        tmpEmit->setEmissionRate(value);
     376        PRINT(3)("emissionRate set to %f\n", tmpEmit->getEmissionRate());
     377      }
     378    }
     379 
     380
     381}
     382
    360383
    361384void* Framework::initGui(void* argv)
     
    369392    Box* windowBox = new Box('v');
    370393    {
     394      Slider* emissionRate = new Slider("EmissionRate", 0, 1000);
     395      emissionRate->connectSignal("value_changed", (void*)emissionRate, changeOption );
     396      windowBox->fill(emissionRate);
     397
    371398      Button* quitButton = new Button("quit");
     399
     400
    372401      windowBox->fill(quitButton);
    373402    }
Note: See TracChangeset for help on using the changeset viewer.