private void JoystickAxisMotion(object sender, JoystickAxisEventArgs e) { if (e.AxisValue == 0) { game.State.DoAction(game.MyPlayerNum, PlayerAction.JoystickCenter); } }
/// <summary> /// Processes a joystick motion event. This event is triggered by /// SDL. Only /// sprites that are JoystickSensitive are processed. /// </summary> /// <param name="sender">Object that sent event</param> /// <param name="e">Event arguments</param> private void Update(object sender, JoystickAxisEventArgs e) { foreach (Sprite s in this) { s.Update(e); } }
/// <summary> /// Raises the joystick axis motion event. /// </summary> /// <param name='ergs'> /// Ergs. /// </param> private static void OnJoystickAxisMotion(JoystickAxisEventArgs ergs) { if (JoystickAxisMotion != null) { if (ergs.RawAxisValue < JoystickAxisEventArgs.JoystickThreshold * -1 || ergs.RawAxisValue > JoystickAxisEventArgs.JoystickThreshold) { JoystickAxisMotion(__instance, ergs); } } }
static void OnJoystickAxisMotion(JoystickAxisEventArgs e) { if (JoystickAxisMotion != null) { if (((e.RawAxisValue < (-1) * JoystickAxisEventArgs.JoystickThreshold) || (e.RawAxisValue > JoystickAxisEventArgs.JoystickThreshold)) && (e.AxisIndex == 0 || e.AxisIndex == 1)) { JoystickAxisMotion(instance, e); } } }
private void JoystickAxisChanged(object sender, JoystickAxisEventArgs e) { if (e.AxisIndex == 0) { position.X = (int)(joystick.GetAxisPosition(JoystickAxis.Horizontal) * width); } else if (e.AxisIndex == 1) { position.Y = (int)(joystick.GetAxisPosition(JoystickAxis.Vertical) * height); } }
public override void DoJoystickAxisMove(JoystickAxisEventArgs e) { //Console.WriteLine(joystick.GetAxisPosition(JoystickAxis.Horizontal).ToString()); if (!lockKeysJoystick) { base.DoJoystickAxisMove(e); } else { lockKeysJoystick = false; Items[SelectedMenuIndex].Options.Clear(); if (e.AxisIndex == 0) { Items[SelectedMenuIndex].Options.Add((e.AxisValue > 0) ? "+X" : "-X"); } else { Items[SelectedMenuIndex].Options.Add((e.AxisValue > 0) ? "+Y" : "-Y"); } } }
/// <summary> /// Processes a joystick motion event. This event is triggered by /// SDL. Only /// sprites that are JoystickSensitive are processed. /// </summary> /// <param name="args">Event args</param> public virtual void Update(JoystickAxisEventArgs args) { }
/// <summary> /// Processes the event. /// </summary> /// <param name='e'> /// E. /// </param> private static void ProcessEvent(SdlSystem.SDL_Event e) { switch ((EventTypes)e.type) { case EventTypes.ActiveEvent: OnActiveEvent(ActiveEventArgs.CreateEventArgs(e)); break; case EventTypes.KeyDown: OnKeyboardDown(KeyboardEventArgs.CreateEventArgs(e)); break; case EventTypes.KeyUp: OnKeyboardUp(KeyboardEventArgs.CreateEventArgs(e)); break; case EventTypes.MouseMotion: OnMouseMotion(MouseMotionEventArgs.CreateEventArgs(e)); break; case EventTypes.MouseButtonDown: OnMouseButtonDown(MouseButtonEventArgs.CreateEventArgs(e)); break; case EventTypes.MouseButtonUp: OnMouseButtonUp(MouseButtonEventArgs.CreateEventArgs(e)); break; case EventTypes.JoystickAxisMotion: OnJoystickAxisMotion(JoystickAxisEventArgs.CreateEventArgs(e)); break; case EventTypes.JoystickBallMotion: OnJoystickBallMotion(JoystickBallEventArgs.CreateEventArgs(e)); break; case EventTypes.JoystickHatMotion: OnJoystickHatMotion(JoystickHatEventArgs.CreateEventArgs(e)); break; case EventTypes.JoystickButtonDown: OnJoystickButtonDown(JoystickButtonEventArgs.CreateEventArgs(e)); break; case EventTypes.JoystickButtonUp: OnJoystickButtonUp(JoystickButtonEventArgs.CreateEventArgs(e)); break; case EventTypes.VideoResize: OnVideoResize(VideoResizeEventArgs.CreateEventArgs(e)); break; case EventTypes.VideoExpose: OnVideoExpose(VideoExposeEventArgs.CreateEventArgs(e)); break; case EventTypes.Quit: OnQuit(QuitEventArgs.CreateEventArgs(e)); break; case EventTypes.WindowManagerEvent: OnWindowManagerEvent(WindowManagerEventArgs.CreateEventArgs(e)); break; case EventTypes.UserEvent: OnUserEvent(UserEventArgs.CreateEventArgs(e)); break; } }
private void JoystickAxisMotion(object sender, JoystickAxisEventArgs e) { bool joy1Mapped = false; bool joy2Mapped = false; if ( (joy1 != null && C64.cia1.Joy1Map == MapType.Joystick1) || (joy2 != null && C64.cia1.Joy1Map == MapType.Joystick2) ) { joy1Mapped = true; } if ( (joy1 != null && C64.cia1.Joy2Map == MapType.Joystick1) || (joy2 != null && C64.cia1.Joy2Map == MapType.Joystick2) ) { joy2Mapped = true; } if (e.AxisIndex == 0) { switch ((int)e.AxisValue) { case 1: if (joy1Mapped) { C64.cia1.JoyEvent(1, JoystickFunction.Right, true); } if (joy2Mapped) { C64.cia1.JoyEvent(2, JoystickFunction.Right, true); } break; case -1: if (joy1Mapped) { C64.cia1.JoyEvent(1, JoystickFunction.Left, true); } if (joy2Mapped) { C64.cia1.JoyEvent(2, JoystickFunction.Left, true); } break; default: if (joy1Mapped) { C64.cia1.JoyEvent(1, JoystickFunction.HorizontalCenter, true); } if (joy2Mapped) { C64.cia1.JoyEvent(2, JoystickFunction.HorizontalCenter, true); } break; } } else { switch ((int)e.AxisValue) { case 1: if (joy1Mapped) { C64.cia1.JoyEvent(1, JoystickFunction.Down, true); } if (joy2Mapped) { C64.cia1.JoyEvent(2, JoystickFunction.Down, true); } break; case -1: if (joy1Mapped) { C64.cia1.JoyEvent(1, JoystickFunction.Up, true); } if (joy2Mapped) { C64.cia1.JoyEvent(2, JoystickFunction.Up, true); } break; default: if (joy1Mapped) { C64.cia1.JoyEvent(1, JoystickFunction.VerticalCenter, true); } if (joy2Mapped) { C64.cia1.JoyEvent(2, JoystickFunction.VerticalCenter, true); } break; } } }