Skip to content

Commit

Permalink
explicitly define PadConfig buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Oct 23, 2018
1 parent c505ae2 commit 24b5392
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions hxd/Pad.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@ private class GameController {
#end
#end

typedef PadConfig = {
analogX : Int,
analogY : Int,
ranalogX : Int,
ranalogY : Int,
A : Int,
B : Int,
X : Int,
Y : Int,
LB : Int,
RB : Int,
LT : Int,
RT : Int,
back : Int,
start : Int,
analogClick : Int,
ranalogClick : Int,
dpadUp : Int,
dpadDown : Int,
dpadLeft : Int,
dpadRight : Int,
names : Array<String>,
}

class Pad {

#if flash
Expand Down Expand Up @@ -117,7 +141,7 @@ class Pad {
public static var ANALOG_BUTTON_THRESHOLDS = { press: 0.3, release: 0.25 };
#end

public static var DEFAULT_CONFIG =
public static var DEFAULT_CONFIG : PadConfig =
#if hlsdl CONFIG_SDL
#elseif flash CONFIG_XBOX
#elseif (hldx || usesys) GameController.CONFIG
Expand Down Expand Up @@ -388,7 +412,7 @@ class Pad {
default:
}
}

static function syncPads(){
for( p in pads )
for( i in 0...p.buttons.length )
Expand Down

0 comments on commit 24b5392

Please sign in to comment.