Пример #1
0
bool 
IntroState::apply(const CEGUI::EventArgs &e){
  
  CEGUI::Slider* slider = static_cast<CEGUI::Slider*>(static_cast<const CEGUI::WindowEventArgs&>(e).window->getRootWindow()->getChild("background_options")->getChild("SliderSpeed"));
  float aux=slider->getCurrentValue();
  
  CEGUI::ToggleButton* cb = static_cast<CEGUI::ToggleButton*>(static_cast<const CEGUI::WindowEventArgs&>(e).window->getRootWindow()->getChild("background_options")->getChild("CBAutoReload"));

  ofstream archivo;  // objeto de la clase ofstream
  archivo.open("data/Config.txt");
  archivo<<"MouseSpeed = "+Ogre::StringConverter::toString((int)aux)<< endl;
  archivo<<"AutoReaload = "+Ogre::StringConverter::toString(cb->isSelected())<< endl;
  archivo.close();

  //Cambio de resolucion-----------
  if(_fullscreen){
    _root->getAutoCreatedWindow()->resize(1920,1200);
    renderer->setDisplaySize(CEGUI::Sizef(1920,1200));
    _root->getAutoCreatedWindow()->setFullscreen(true,1920,1200);
  }else{
    _root->getAutoCreatedWindow()->resize(_resWidth,_resHeigt);
    renderer->setDisplaySize(CEGUI::Sizef(_resWidth,_resHeigt));
    _root->getAutoCreatedWindow()->setFullscreen(false,_resWidth,_resHeigt);
  }
  
  //-------------------------------
  return true;
}
void luaApplySoundSettings(CEGUI::Window* settingsWindow)
{
    CEGUI::Slider* slider;
    std::string command;

    slider = (CEGUI::Slider*)settingsWindow->getChildRecursive("Settings/Main/Volume");
    int soundvol = int(slider->getCurrentValue()*255);
    command = "soundvol " + Utility::toString(soundvol);
    execute(command.c_str());

    slider = (CEGUI::Slider*)settingsWindow->getChildRecursive("Settings/Main/MusicVolume");
    int musicvol = int(slider->getCurrentValue()*255);
    command = "musicvol " + Utility::toString(musicvol);
    execute(command.c_str());

//printf("luaApplySoundSettings: %d,%d\r\n", soundvol, musicvol);
}
Пример #3
0
bool OgreSample13App::handleSliders(const CEGUI::EventArgs & args)
{
	CEGUI::Slider * cb = static_cast<CEGUI::Slider *>(static_cast<const CEGUI::WindowEventArgs&>(args).window);
	if (cb->getName() == CEGUI::String("OgreSample13/slider1"))
	{
		destroyCurrentGeomOpt();
		mNumMeshes = cb->getCurrentValue() * 1000.0f;
		CEGUI::WindowManager::getSingleton().getWindow("OgreSample13/num1")->setText(CEGUI::PropertyHelper::intToString(mNumMeshes));
		createCurrentGeomOpt();
	}
	else
	{
		mBurnAmount = cb->getCurrentValue() * 16.67;
		CEGUI::WindowManager::getSingleton().getWindow("OgreSample13/num2")->setText(CEGUI::PropertyHelper::floatToString(mBurnAmount));
	}

	return true;
}
Пример #4
0
bool 
IntroState::onSliderValueChanged(const CEGUI::EventArgs &e){

  CEGUI::Slider* slider = static_cast<CEGUI::Slider*>(static_cast<const CEGUI::WindowEventArgs&>(e).window->getRootWindow()->getChild("background_options")->getChild("SliderSpeed"));
  float aux=slider->getCurrentValue();
  CEGUI::Window* sbText =static_cast<CEGUI::Slider*>(static_cast<const CEGUI::WindowEventArgs&>(e).window->getRootWindow()->getChild("background_options")->getChild("textSliderSpeed"));
  if(aux<5.0){
    aux=5.0;
  }
  sbText->setText("[font='DickVanDyke']"+Ogre::StringConverter::toString( (int)aux ));
  return true;
}
Пример #5
0
  bool SettingSlider::onSliderChanged(const CEGUI::EventArgs& e)
  {
    CEGUI::Slider* slider = getSliderW();
    float val = slider->getCurrentValue();
    val = ScaleMinMax(val, getMinimumValue(), slider->getMaxValue());
    CEGUI::Window* value = getValueW();   

    for (size_t i = 0; i < settings.GetSize(); i++)
    {
      csRef<Setting> setting = settings.Get(i);
      if (setting->IsValid())
      {
        setting->SetFromOther(val);
        value->setText(setting->GetAsString());
      }
    }

    return true;
  }