File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,7 @@ class VisualizerArgs:
215
215
216
216
# Callbacks
217
217
customRenderCallback = None # Used to render custom OpenGL objects in user code
218
+ customKeyDownCallbacks = {} # User callback is called when event.type == pygame.KEYDOWN and event.key == key
218
219
219
220
class Recorder :
220
221
def __init__ (self , recordPath , resolution ):
@@ -398,7 +399,9 @@ def __processUserInput(self):
398
399
if event .type == pygame .QUIT :
399
400
self .shouldQuit = True
400
401
elif event .type == pygame .KEYDOWN :
401
- if event .key == pygame .K_q : self .shouldQuit = True
402
+ if event .key in self .args .customKeyDownCallbacks :
403
+ self .args .customKeyDownCallbacks [event .key ]()
404
+ elif event .key == pygame .K_q : self .shouldQuit = True
402
405
elif event .key == pygame .K_SPACE : self .shouldPause = not self .shouldPause
403
406
elif event .key == pygame .K_c :
404
407
self .cameraMode = self .cameraMode .next ()
You can’t perform that action at this time.
0 commit comments