fna-workbench

fna-workbench Commit Details


Date:2015-12-27 13:40:23 (9 years 8 months ago)
Author:Ethan Lee
Branch:master
Commit:a6d165195b17bb3fb838716175ab854e04aeb8d6
Parents: 90043ae4e76bf2f1ada1d708e1c89917b4f06013
Message:FNA_GAMEPAD_NUM_GAMEPADS environment variable

Changes:

File differences

src/PlayerIndex.cs
1010
1111
1212
13
13
1414
1515
1616
namespace Microsoft.Xna.Framework
{
/// <summary>
/// Defines the index of player for various MonoGame components.
/// Defines the index of player for various input components.
/// </summary>
public enum PlayerIndex
{
src/SDL2/Input/SDL2_GamePad.cs
3434
3535
3636
37
38
39
40
41
42
43
3744
38
45
3946
40
41
42
43
47
4448
4549
46
47
50
51
4852
4953
50
51
52
53
54
5455
5556
56
57
5758
5859
5960
......
9697
9798
9899
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
99133
100134
101135
#region Internal SDL2_GamePad Variables
/* Determines how many controllers we should be tracking.
* Per XNA4 we track 4 by default, but if you want to track more you can
* do this by changing PlayerIndex.cs to include more index names.
* -flibit
*/
private static readonly int GAMEPAD_COUNT = DetermineNumGamepads();
// Controller device information
private static IntPtr[] INTERNAL_devices = new IntPtr[4];
private static IntPtr[] INTERNAL_devices = new IntPtr[GAMEPAD_COUNT];
private static Dictionary<int, int> INTERNAL_instanceList = new Dictionary<int, int>();
private static string[] INTERNAL_guids = new string[]
{
String.Empty, String.Empty, String.Empty, String.Empty
};
private static string[] INTERNAL_guids = GenStringArray();
// Haptic device information
private static IntPtr[] INTERNAL_haptics = new IntPtr[4];
private static HapticType[] INTERNAL_hapticTypes = new HapticType[4];
private static IntPtr[] INTERNAL_haptics = new IntPtr[GAMEPAD_COUNT];
private static HapticType[] INTERNAL_hapticTypes = new HapticType[GAMEPAD_COUNT];
// Light bar information
private static string[] INTERNAL_lightBars = new string[]
{
String.Empty, String.Empty, String.Empty, String.Empty
};
private static string[] INTERNAL_lightBars = GenStringArray();
// Cached GamePadStates
private static GamePadState[] INTERNAL_states = new GamePadState[4];
private static GamePadState[] INTERNAL_states = new GamePadState[GAMEPAD_COUNT];
// We use this to apply XInput-like rumble effects.
private static SDL.SDL_HapticEffect INTERNAL_leftRightEffect = new SDL.SDL_HapticEffect
#endregion
#region String Array Init Method
private static int DetermineNumGamepads()
{
string numGamepadString = Environment.GetEnvironmentVariable(
"FNA_GAMEPAD_NUM_GAMEPADS"
);
if (!String.IsNullOrEmpty(numGamepadString))
{
int numGamepads;
if (int.TryParse(numGamepadString, out numGamepads))
{
if (numGamepads >= 0)
{
return numGamepads;
}
}
}
return Enum.GetNames(typeof(PlayerIndex)).Length;
}
private static string[] GenStringArray()
{
string[] result = new string[GAMEPAD_COUNT];
for (int i = 0; i < result.Length; i += 1)
{
result[i] = String.Empty;
}
return result;
}
#endregion
#region Device List, Open/Close Devices
internal static void INTERNAL_AddInstance(int dev)

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.59768s using 13 queries.