support controllers that aren't PlayerIndex.One
This commit is contained in:
parent
63fb57d3a3
commit
9a6a6079d4
|
|
@ -33,7 +33,8 @@ These are the plans for what I want to be customizable via .config modification
|
||||||
## Misc
|
## Misc
|
||||||
|
|
||||||
- Optionally assign "close" keybind to a combination of stick buttons ☐
|
- Optionally assign "close" keybind to a combination of stick buttons ☐
|
||||||
- Choose an XInput device instead of defaulting to whichever one is considered player 1 ☐
|
- Choose an XInput device instead of defaulting to whichever one is considered player 1 🗹
|
||||||
- "Press Start" prompt if ambiguous, save to config file?
|
- ~~"Press Start" prompt if ambiguous, save to config file?~~
|
||||||
|
- Every frame, just use the controller with the lowest index and any input
|
||||||
- Keybinds to generate .config file and default images in execution folder ☐
|
- Keybinds to generate .config file and default images in execution folder ☐
|
||||||
- This would allow the distribution of just the .exe file. If someone wishes to customize, those default resources could be generated from the program
|
- This would allow the distribution of just the .exe file. If someone wishes to customize, those default resources could be generated from the program
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
@ -47,7 +48,6 @@ namespace sticky_viewer
|
||||||
private Texture2D C;
|
private Texture2D C;
|
||||||
private Texture2D J;
|
private Texture2D J;
|
||||||
private Texture2D S;
|
private Texture2D S;
|
||||||
|
|
||||||
public Display()
|
public Display()
|
||||||
{
|
{
|
||||||
graphics = new GraphicsDeviceManager(this);
|
graphics = new GraphicsDeviceManager(this);
|
||||||
|
|
@ -149,7 +149,15 @@ namespace sticky_viewer
|
||||||
Exit();
|
Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
GamePadDPad dpad = GamePad.GetState(PlayerIndex.One).DPad;
|
// Find the controller being used currently
|
||||||
|
GamePadState emptyInput = new GamePadState();
|
||||||
|
GamePadState currentState = new GamePadState();
|
||||||
|
foreach (PlayerIndex p in Enum.GetValues(typeof(PlayerIndex)))
|
||||||
|
{
|
||||||
|
if ((currentState = GamePad.GetState(p)) != emptyInput) { break; }
|
||||||
|
}
|
||||||
|
|
||||||
|
GamePadDPad dpad = currentState.DPad;
|
||||||
|
|
||||||
if (dpad.Up == ButtonState.Pressed && dpad.Left == ButtonState.Pressed)
|
if (dpad.Up == ButtonState.Pressed && dpad.Left == ButtonState.Pressed)
|
||||||
{
|
{
|
||||||
|
|
@ -188,8 +196,6 @@ namespace sticky_viewer
|
||||||
stick = neutral;
|
stick = neutral;
|
||||||
}
|
}
|
||||||
|
|
||||||
GamePadState currentState = GamePad.GetState(PlayerIndex.One);
|
|
||||||
|
|
||||||
Dictionary<string, bool> inputs = new Dictionary<string, bool>()
|
Dictionary<string, bool> inputs = new Dictionary<string, bool>()
|
||||||
{
|
{
|
||||||
{"A", currentState.Buttons.A == ButtonState.Pressed},
|
{"A", currentState.Buttons.A == ButtonState.Pressed},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue