public static DetourEvent ClientSizeChangedCallback(StaticContextAccessor accessor) { var @event = new ClientSizeChangedEvent(new StaticContext(accessor)); FireEvent(@event); return(@event); }
public static DetourEvent UpdateTitleScreenCallback(StaticContextAccessor accessor) { var @event = new UpdateTitleScreenEvent(new StaticContext(accessor)); FireEvent(@event); return(@event); }
public static DetourEvent GameExitEventCallback(StaticContextAccessor accessor) { var @event = new GameExitEvent(new StaticContext(accessor)); FireEvent(@event); return(@event); }
public static DetourEvent PreUpdateCallback(StaticContextAccessor accessor) { var @event = new PreUpdateEvent(); FireEvent(@event); return(@event); }
public static DetourEvent UnloadContentCallback(StaticContextAccessor accessor) { var @event = new UnloadContentEvent(); FireEvent(@event); return(@event); }
public static DetourEvent PostDrawCallback(StaticContextAccessor accessor) { var batch = accessor._GetSpriteBatch(); batch.Begin(); var @event = new PostRenderEvent(); FireEvent(@event); batch.End(); return(@event); }
public static DetourEvent InitializeCallback(StaticContextAccessor accesor) { WrappedGame.Version += ", " + AssemblyInfo.NICE_VERSION; WrappedGame.Version += ", mods loaded: " + EventBus.mods.Count; WrappedGame.Window.Title = "Stardew Valley - Version " + WrappedGame.Version; Logging.DebugLog("Game Initialized"); var @event = new InitializeEvent(); FireEvent(@event); return(@event); }
public static DetourEvent PostUpdateCallback(StaticContextAccessor accessor) { var keyboardState = Keyboard.GetState(); var mouseState = Mouse.GetState(); var gamepadState = GamePad.GetState(PlayerIndex.One); /* keyboard events */ foreach (var key in keyboardState.GetPressedKeys()) { if (!oldKeyboardState.IsKeyDown(key)) { FireEvent(new KeyPressedEvent(key)); } } foreach (var key in oldKeyboardState.GetPressedKeys()) { if (!keyboardState.IsKeyDown(key)) { FireEvent(new KeyReleasedEvent(key)); } } /* probably a way to template this, but whatever, mouse events */ if (mouseState.LeftButton == ButtonState.Pressed && oldMouseState.LeftButton == ButtonState.Released) { FireEvent(new MouseButtonPressedEvent(MouseButtonPressedEvent.MouseButton.Left, mouseState)); } if (mouseState.LeftButton == ButtonState.Released && oldMouseState.LeftButton == ButtonState.Pressed) { FireEvent(new MouseButtonReleasedEvent(MouseButtonReleasedEvent.MouseButton.Left, mouseState)); } if (mouseState.MiddleButton == ButtonState.Pressed && oldMouseState.MiddleButton == ButtonState.Released) { FireEvent(new MouseButtonPressedEvent(MouseButtonPressedEvent.MouseButton.Middle, mouseState)); } if (mouseState.MiddleButton == ButtonState.Released && oldMouseState.MiddleButton == ButtonState.Pressed) { FireEvent(new MouseButtonReleasedEvent(MouseButtonReleasedEvent.MouseButton.Middle, mouseState)); } if (mouseState.RightButton == ButtonState.Pressed && oldMouseState.RightButton == ButtonState.Released) { FireEvent(new MouseButtonPressedEvent(MouseButtonPressedEvent.MouseButton.Right, mouseState)); } if (mouseState.RightButton == ButtonState.Released && oldMouseState.RightButton == ButtonState.Pressed) { FireEvent(new MouseButtonReleasedEvent(MouseButtonReleasedEvent.MouseButton.Right, mouseState)); } /* gamepad events */ foreach (Buttons button in Enum.GetValues(typeof(Buttons))) { if (gamepadState.IsButtonDown(button) && oldGamepadState.IsButtonUp(button)) { FireEvent(new GamepadButtonPressedEvent(button)); } if (gamepadState.IsButtonUp(button) && oldGamepadState.IsButtonDown(button)) { FireEvent(new GamepadButtonReleasedEvent(button)); } } oldKeyboardState = keyboardState; oldMouseState = mouseState; oldGamepadState = gamepadState; var @event = new PostUpdateEvent(); FireEvent(@event); return(@event); }