diff options
author | Adrian Kummerlaender | 2020-03-27 20:35:13 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2020-03-27 20:35:13 +0100 |
commit | 774a4e4d6298f03ff61fb6e2c13a62ca25a2afb2 (patch) | |
tree | 0555f94cb71f1a038020d5913ad27f64843f0aec /boltzgas/visualizer.py | |
parent | ee05ee023df26be65d143537e4ad26090572bd1e (diff) | |
download | boltzgas-774a4e4d6298f03ff61fb6e2c13a62ca25a2afb2.tar boltzgas-774a4e4d6298f03ff61fb6e2c13a62ca25a2afb2.tar.gz boltzgas-774a4e4d6298f03ff61fb6e2c13a62ca25a2afb2.tar.bz2 boltzgas-774a4e4d6298f03ff61fb6e2c13a62ca25a2afb2.tar.lz boltzgas-774a4e4d6298f03ff61fb6e2c13a62ca25a2afb2.tar.xz boltzgas-774a4e4d6298f03ff61fb6e2c13a62ca25a2afb2.tar.zst boltzgas-774a4e4d6298f03ff61fb6e2c13a62ca25a2afb2.zip |
Add wire box, enable depth testing
Diffstat (limited to 'boltzgas/visualizer.py')
-rw-r--r-- | boltzgas/visualizer.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/boltzgas/visualizer.py b/boltzgas/visualizer.py index 44cec7a..373a181 100644 --- a/boltzgas/visualizer.py +++ b/boltzgas/visualizer.py @@ -57,12 +57,15 @@ def make_timer(): return on_timer -def make_keyboard_handler(controller): +def make_keyboard_handler(controller, view): def on_keyboard(key, x, y): - if controller.isRunning(): - controller.pause() - else: - controller.run() + if key == b' ': + if controller.isRunning(): + controller.pause() + else: + controller.run() + if key == b'h': + view.show_histogram = not view.show_histogram return on_keyboard @@ -88,7 +91,9 @@ def simulate(config, gas, instruments, decorations, windows, updates_per_frame = glutDisplayFunc(make_display_handler(controller, view)) glutReshapeFunc(make_reshape_handler(view)) glutTimerFunc(20, make_timer(), 20) - glutKeyboardFunc(make_keyboard_handler(controller)) + glutKeyboardFunc(make_keyboard_handler(controller, view)) glutCloseFunc(make_close_handler(controller)) + glutMouseFunc(lambda *args: list(map(lambda m: m.on_mouse(*args), view.mouse_monitors))) + glutMotionFunc(lambda *args: list(map(lambda m: m.on_mouse_move(*args), view.mouse_monitors))) glutMainLoop() |