public JoystickAxisButtonHandler(int trackedAxis) { this.trackedAxis = (JoystickAxisSource)trackedAxis; positiveAxisButton = JoystickButton.FirstAxisPositive + trackedAxis; negativeAxisButton = JoystickButton.FirstAxisNegative + trackedAxis; Size = new Vector2(100, 50); InternalChildren = new[] { background = new Container { RelativeSizeAxes = Axes.Both, Colour = Color4.Transparent, Child = new Box { RelativeSizeAxes = Axes.Both } }, new SpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = $"AX{trackedAxis + 1}" }, rawValue = new SpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Text = "-" } }; }
/// <summary> /// Get the <see cref="JoystickAxisEventManager"/> responsible for a specified joystick axis. /// </summary> /// <param name="source">The axis to find the manager for.</param> /// <returns>The <see cref="JoystickAxisEventManager"/>.</returns> public JoystickAxisEventManager GetJoystickAxisEventManagerFor(JoystickAxisSource source) { if (joystickAxisEventManagers.TryGetValue(source, out var existing)) { return(existing); } var manager = CreateJoystickAxisEventManagerFor(source); manager.GetInputQueue = () => NonPositionalInputQueue; return(joystickAxisEventManagers[source] = manager); }
public JoystickAxisButtonHandler(int trackedAxis) { this.trackedAxis = (JoystickAxisSource)trackedAxis; positiveAxisButton = JoystickButton.FirstAxisPositive + trackedAxis; negativeAxisButton = JoystickButton.FirstAxisNegative + trackedAxis; Size = new Vector2(100, 50); InternalChildren = new Drawable[] { fill = new Box { Anchor = Anchor.Centre, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both, Width = 0, Colour = Color4.SkyBlue, }, background = new Container { RelativeSizeAxes = Axes.Both, Masking = true, BorderThickness = 3, Child = new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Transparent }, }, new SpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = $"Axis {trackedAxis + 1}" }, rawValue = new SpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Text = "-" } }; }
public JoystickAxis(JoystickAxisSource source, float value) { Source = source; Value = value; }
/// <summary> /// Create a <see cref="JoystickAxisEventManager"/> for a specified joystick axis. /// </summary> /// <param name="source">The axis to be handled by the returned manager.</param> /// <returns>The <see cref="JoystickAxisEventManager"/>.</returns> protected virtual JoystickAxisEventManager CreateJoystickAxisEventManagerFor(JoystickAxisSource source) => new JoystickAxisEventManager(source);
public JoystickAxisEventManager(JoystickAxisSource source) { this.source = source; }