Skip to content

Commit

Permalink
Change so joycon works on windows and darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
iamojuve committed Dec 26, 2020
1 parent fa735f7 commit d9ac746
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Sources/arm/KhaKeyboard.hx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ class KhaKeyboard {

#if kha_js
if (scene_trait.num_joycons() > 0) {
var devices:Dynamic = SwitchJoyCon.listConnectedJoyCons();
joycon = devices[0].open();
joycon = js.Syntax.code('window.openedjoycon');
if (joycon == null) {
var devices:Dynamic = SwitchJoyCon.listConnectedJoyCons();
joycon = devices[0].open();
}
joyboard = new JoyconKeyboard(this,joycon.side == 'left');
js.Syntax.code("this.joycon.on('change',() => {this.joyboard.onChange({0})})",joycon.buttons);
}
Expand Down

0 comments on commit d9ac746

Please sign in to comment.