void SliderControl::UpdateConVar() { CGameUIConVarRef* conVar = GetConVarRef(); if( conVar && conVar->IsValid() ) { conVar->SetValue( GetCurrentValue() ); } }
void SliderControl::Reset() { CGameUIConVarRef* conVar = GetConVarRef(); if( conVar && conVar->IsValid() ) { SetCurrentValue( conVar->GetFloat(), true ); } ResetSliderPosAndDefaultMarkers(); }
//----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- COptionsSubKeyboard::COptionsSubKeyboard(vgui::Panel *parent) : EditablePanel(parent, "OptionsSubKeyboard" ) { vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/GameUIScheme.res", "GameUIScheme"); SetScheme(scheme); Q_memset( m_Bindings, 0, sizeof( m_Bindings )); m_nSplitScreenUser = 0; // For joystick buttons, controls which user are binding/unbinding if ( !IsX360() ) { //HACK HACK: Probably the entire gameui needs to have a splitscrene context for which player the settings apply to, but this is only // on the PC... static CGameUIConVarRef in_forceuser( "in_forceuser" ); if ( in_forceuser.IsValid() ) { m_nSplitScreenUser = clamp( in_forceuser.GetInt(), 0, 1 ); } else { m_nSplitScreenUser = MAX( 0, engine->GetActiveSplitScreenPlayerSlot() ); } } // Copy active config Q_strncpy( m_strActiveConfig, cl_active_config.GetString(), MAX_PATH ); m_drpConfig = NULL; // create the key bindings list CreateKeyBindingList(); // Store all current key bindings SaveCurrentBindings(); // Parse default descriptions ParseActionDescriptions(); m_pSetBindingButton = new Button(this, "ChangeKeyButton", ""); m_pClearBindingButton = new Button(this, "ClearKeyButton", ""); LoadControlSettings("Resource/OptionsSubKeyboard.res"); m_pSetBindingButton->SetEnabled(false); m_pClearBindingButton->SetEnabled(false); SetPaintBackgroundEnabled( false ); }
//============================================================================= void ControllerOptions::ResetControlValues( void ) { // labels for button config and stick config CGameUIConVarRef joy_cfg_preset( "joy_cfg_preset" ); int iButtonSetting = clamp( joy_cfg_preset.GetInt(), 0, 3 ); if ( m_pEditButtons ) { m_pEditButtons->SetDropdownSelection( pszButtonSettingsDisplayName[iButtonSetting] ); } CGameUIConVarRef joy_movement_stick("joy_movement_stick"); int iStickSetting = ( joy_movement_stick.GetInt() > 0 ) ? 1 : 0; if ( m_pEditSticks ) { static CGameUIConVarRef s_joy_legacy( "joy_legacy" ); if ( s_joy_legacy.IsValid() && s_joy_legacy.GetBool() ) { iStickSetting += 2; // Go to the legacy version of the default/southpaw string. } m_pEditSticks->SetDropdownSelection( pszStickSettingsDisplayName[iStickSetting] ); } if( m_pVerticalSensitivity ) { m_pVerticalSensitivity->Reset(); } if( m_pHorizontalSensitivity ) { m_pHorizontalSensitivity->Reset(); } if( m_pLookType ) { m_pLookType->SetFlyout( "FlmLookType" ); CGameUIConVarRef joy_inverty("joy_inverty"); int iInvert = ( joy_inverty.GetInt() > 0 ) ? CONTROLLER_LOOK_TYPE_INVERTED : CONTROLLER_LOOK_TYPE_NORMAL; m_pLookType->SetCurrentSelection( pszLookTypes[iInvert] ); FlyoutMenu *pFlyout = m_pLookType->GetCurrentFlyout(); if ( pFlyout ) { pFlyout->SetListener( this ); } } if( m_pDuckMode ) { m_pDuckMode->SetFlyout( "FlmDuckMode" ); CGameUIConVarRef option_duck_method("option_duck_method"); int iDuckMode = ( option_duck_method.GetInt() > 0 ) ? DUCK_MODE_TOGGLE : DUCK_MODE_HOLD; m_pDuckMode->SetCurrentSelection( pszDuckModes[iDuckMode] ); FlyoutMenu *pFlyout = m_pDuckMode->GetCurrentFlyout(); if ( pFlyout ) { pFlyout->SetListener( this ); } } }