comparison tests/test_panel.nim @ 1021:73b572f82a1f

add: bases for a better input-system
author sam <sam@basx.dev>
date Thu, 09 May 2024 23:02:35 +0700
parents f9d25bc331b3
children 74957cbf589b
comparison
equal deleted inserted replaced
1020:355ef428b5f4 1021:73b572f82a1f
62 scene.add button 62 scene.add button
63 scene.add help_text 63 scene.add help_text
64 scene.add origin 64 scene.add origin
65 engine.loadScene(scene) 65 engine.loadScene(scene)
66 66
67 while engine.updateInputs() == Running and not engine.keyIsDown(Escape): 67 while engine.updateInputs() and not keyIsDown(Escape):
68 if engine.keyWasPressed(F1): 68 if keyWasPressed(F1):
69 button.horizontalAlignment = Left 69 button.horizontalAlignment = Left
70 counterText.horizontalAlignment = Left 70 counterText.horizontalAlignment = Left
71 elif engine.keyWasPressed(F2): 71 elif keyWasPressed(F2):
72 button.horizontalAlignment = Center 72 button.horizontalAlignment = Center
73 counterText.horizontalAlignment = Center 73 counterText.horizontalAlignment = Center
74 elif engine.keyWasPressed(F3): 74 elif keyWasPressed(F3):
75 button.horizontalAlignment = Right 75 button.horizontalAlignment = Right
76 counterText.horizontalAlignment = Right 76 counterText.horizontalAlignment = Right
77 elif engine.keyWasPressed(F4): 77 elif keyWasPressed(F4):
78 button.verticalAlignment = Top 78 button.verticalAlignment = Top
79 counterText.verticalAlignment = Top 79 counterText.verticalAlignment = Top
80 elif engine.keyWasPressed(F5): 80 elif keyWasPressed(F5):
81 button.verticalAlignment = Center 81 button.verticalAlignment = Center
82 counterText.verticalAlignment = Center 82 counterText.verticalAlignment = Center
83 elif engine.keyWasPressed(F6): 83 elif keyWasPressed(F6):
84 button.verticalAlignment = Bottom 84 button.verticalAlignment = Bottom
85 counterText.verticalAlignment = Bottom 85 counterText.verticalAlignment = Bottom
86 86
87 engine.processEvents(button) 87 engine.processEvents(button)
88 88