/// Get the button void GameEconomicGameClient::HandlerConfigurationWindowButtonPressed(StringHash eventType, VariantMap& eventData) { /// Get needed resources Renderer* renderer = GetSubsystem<Renderer>(); ResourceCache* cache = GetSubsystem<ResourceCache>(); UI* ui_ = GetSubsystem<UI>(); UIElement * UIRoot = ui_->GetRoot(); GameStateHandlerComponent * gamestatehandlercomponent_ = GetSubsystem<GameStateHandlerComponent>(); /// get the button that was clicked Button* clicked = static_cast<Button*>(eventData[UIMouseClick::P_ELEMENT].GetPtr()); /// Get TheName String ClickedButton(clicked->GetName().ToLower()); /// If exit was clicked if (ClickedButton.Contains("apply")==true) { /// Get parameters Slider * VideoBloomParam1= (Slider *)UIRoot->GetChild("VideoBloomParam1Slider",true); Slider * VideoBloomParam2= (Slider *)UIRoot->GetChild("VideoBloomParam2Slider",true); float VideoBloomParam1Value = VideoBloomParam1->GetValue(); float VideoBloomParam2Value = VideoBloomParam2->GetValue(); /// Set parameter effectRenderPath->SetShaderParameter("BloomMix", Vector2(VideoBloomParam1Value,VideoBloomParam2Value)); return; } /// If exit was clicked if (ClickedButton.Contains("save")==true) { /// Get parameters Slider * VideoBloomParam1= (Slider *)UIRoot->GetChild("VideoBloomParam1Slider",true); Slider * VideoBloomParam2= (Slider *)UIRoot->GetChild("VideoBloomParam2Slider",true); CheckBox * GameForceTabletModeCheckBox = (CheckBox *) UIRoot->GetChild("GameForceTabletModeCheckBox",true); ///Create new config Configuration SaveNewConfig; /// Copy info SaveNewConfig.GameModeForceTablet= GameForceTabletModeCheckBox->IsChecked(); SaveNewConfig.VideoBloomParam1 = VideoBloomParam1->GetValue(); SaveNewConfig.VideoBloomParam2 = VideoBloomParam2->GetValue(); /// Save new config SaveConfiguration(SaveNewConfig); return; } return; }
/** * @brief * Test: Controller */ void Application30::TestController() { // Start System::GetInstance()->GetConsole().Print("Controller 'GameBoy'\n"); System::GetInstance()->GetConsole().Print('\n'); // Create test controller GameBoyController cController; // List all controls System::GetInstance()->GetConsole().Print("Controls:\n"); const List<Control*> &lstControls = cController.GetControls(); for (uint32 i=0; i<lstControls.GetNumOfElements(); i++) { // Get control Control *pControl = lstControls[i]; if (pControl->GetType() == ControlButton) System::GetInstance()->GetConsole().Print("- Button '" + pControl->GetName() + "' [" + pControl->GetDescription() + "]\n"); else if (pControl->GetType() == ControlAxis) System::GetInstance()->GetConsole().Print("- Axis '" + pControl->GetName() + "' [" + pControl->GetDescription() + "]\n"); } System::GetInstance()->GetConsole().Print('\n'); // List buttons System::GetInstance()->GetConsole().Print("Buttons:\n"); const List<Button*> &lstButtons = cController.GetButtons(); for (uint32 i=0; i<lstButtons.GetNumOfElements(); i++) { Button *pButton = lstButtons[i]; System::GetInstance()->GetConsole().Print("- Button '" + pButton->GetName() + "' [" + pButton->GetDescription() + "]\n"); } System::GetInstance()->GetConsole().Print('\n'); // List axes System::GetInstance()->GetConsole().Print("Axes:\n"); const List<Axis*> &lstAxes = cController.GetAxes(); for (uint32 i=0; i<lstAxes.GetNumOfElements(); i++) { Axis *pAxis = lstAxes[i]; System::GetInstance()->GetConsole().Print("- Axis '" + pAxis->GetName() + "' [" + pAxis->GetDescription() + "]\n"); } System::GetInstance()->GetConsole().Print('\n'); // Done System::GetInstance()->GetConsole().Print('\n'); }