Skip to content

Commit 9a0cb7c

Browse files
committed
Gamepad fixes
1 parent efc00c2 commit 9a0cb7c

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/game.nim

+1
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ gdobj Game of Node:
426426

427427
if TouchControls notin state.local_flags:
428428
state.push_flag MouseCaptured
429+
state.push_flag ViewportFocused
429430

430431
state.queued_action_value.changes:
431432
if added and change.item != "":

src/models/states.nim

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ const groups =
1313
@[
1414
{
1515
EditorFocused, ConsoleFocused, DocsFocused, SettingsFocused,
16-
ViewportFocused
16+
ViewportFocused,
1717
},
1818
{ReticleVisible, BlockTargetVisible},
19-
{Playing, Flying}
19+
{Playing, Flying},
2020
]
2121

2222
proc resolve_flags*(
@@ -39,6 +39,9 @@ proc resolve_flags*(
3939
if not groups[1].any_it(it in result):
4040
result.incl ReticleVisible
4141

42+
if MouseCaptured in result:
43+
result.incl(ViewportFocused)
44+
4245
if CommandMode in result:
4346
for flag in groups[0]:
4447
result.excl(flag)

src/ui/gui.nim

+3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ gdobj GUI of Control:
7878
# self.get_tree().set_input_as_handled()
7979
# self.accept_event()
8080

81+
if event of InputEventJoypadButton:
82+
(state.nodes.player as PlayerNode).viewport_input(event)
83+
8184
# method gui_input(event: InputEvent) =
8285
# (state.nodes.player as PlayerNode).viewport_input(event)
8386
# self.accept_event()

0 commit comments

Comments
 (0)