[SMAPI 1.15] ControlEvents.ControllerButtonPressed is broken
Jarvie8176 opened this issue ยท 2 comments
How to reproduce
write a simple mod with handler for ControllerButtonPressed
event that prints out controller input (see below)
Only button press events of DPadRight
, RightStick
, Back
are passed to handler.
I uninstalled 1.15 and then installed 1.14.1, controller events were handled connectly.
Environment
Windows 10 64 bit, Game version 1.2.33 (steam), Xbox one controller (cable connected)
sample code
using System;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
namespace test
{
/// <summary>The mod entry point.</summary>
public class ModEntry : Mod
{
/*********
** Public methods
*********/
/// <summary>The mod entry point, called after the mod is first loaded.</summary>
/// <param name="helper">Provides simplified APIs for writing mods.</param>
public override void Entry(IModHelper helper)
{
ControlEvents.KeyPressed += this.ControlEvents_KeyPress;
ControlEvents.ControllerButtonPressed += this.Button_press;
ControlEvents.ControllerTriggerPressed += this.Trigger_press;
}
/*********
** Private methods
*********/
/// <summary>The method invoked when the player presses a keyboard button.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
private void ControlEvents_KeyPress(object sender, EventArgsKeyPressed e)
{
this.Monitor.Log($"Player pressed {e.KeyPressed}.");
}
private void Button_press(object sender, EventArgsControllerButtonPressed e)
{
this.Monitor.Log($"Player pressed {e.ButtonPressed}.");
}
private void Trigger_press(object sender, EventArgsControllerTriggerPressed e)
{
this.Monitor.Log($"Player pressed {e.ButtonPressed}.");
}
}
}