private void ControllerButtonsChanged(object sender, ButtonStateEventArgs e) { // Buttons 21 - 32 On the combined controller uint buttonIndex = 21; foreach (BBI32Button value in Enum.GetValues(typeof(BBI32Button))) { bool pressed = ButtonBoxController.TestButtonDown(e.ButtonsState, (UInt32)value); ButtonBoxController.SetJoystickButton(pressed, buttonIndex, vJoyTypes.StickAndPedals); buttonIndex++; } }
/// <summary> /// Called when the drop down button is pressed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="buttonStateEventArgs">The <see cref="ButtonStateEventArgs"/> instance containing the event data.</param> private void OnToggleDropDown(object sender, ButtonStateEventArgs buttonStateEventArgs) { var state = buttonStateEventArgs.ButtonState; if (state == ButtonState.On) { // Display the drop down list this.DropDownList.Config.PositionY = this.Config.Height; // DropDownList.State.DrawPosition = new DVector2(State.DrawPosition.X, State.DrawPosition.Y + State.Height); this.Manager.AddForegroundControl(this.DropDownList); this.dropDownListShown = true; this.DropDownList.Config.Visible = true; if (this.OnShowHide != null) { this.OnShowHide(this, new BooleanEventArgs(true)); } } else { this.DropDownList.Config.Visible = false; this.Manager.ForegroundSceneNodes.Children.Remove(this.DropDownList); if (this.dropDownListShown) { this.dropDownListShown = false; } if (this.OnShowHide != null) { this.OnShowHide(this, new BooleanEventArgs(false)); } } }
/// <summary>Reacts to when there is a toggle event</summary> /// <param name="sender">The sender.</param> /// <param name="stateEventArgs">The <see cref="ButtonStateEventArgs"/> instance containing the event data.</param> /// <exception cref="System.ArgumentNullException">StateEventArgs can not be null.</exception> public void Toggle(object sender, ButtonStateEventArgs stateEventArgs) { #if DEBUG if (stateEventArgs == null) { throw new ArgumentNullException("stateEventArgs"); } #endif var state = stateEventArgs.ButtonState; if (state == ButtonState.On) { this.Config.HoverColorsEnabled = false; this.Theme.BorderWidth = 2; this.ButtonState = ButtonState.On; this.CurrentTextureName = this.textureHovered; } else { this.Config.HoverColorsEnabled = true; this.Theme.BorderWidth = 1; this.ButtonState = ButtonState.Off; this.CurrentTextureName = this.TextureNameDefault; } }
void gc_ButtonStateChanged(object sender, ButtonStateEventArgs args) { OnButtonStateChanged(args.ControllerNum, args.Button, args.Pressed); }
/// <summary> /// Called when the toggle-button is pressed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="buttonStateEventArgs">The <see cref="ButtonStateEventArgs"/> instance containing the event data.</param> private void OnTogglePress(object sender, ButtonStateEventArgs buttonStateEventArgs) { var state = buttonStateEventArgs.ButtonState; this.InfoLabel.ConfigText = "Toggle:" + state + ":" + GetTime(); }
void gc_ButtonStateChanged(object sender, ButtonStateEventArgs args) { if (ShowOutput) { string key = " down"; if (args.Pressed) key = " up"; AddButtonOutput(args.Button + key); } }