Created
September 19, 2011 23:25
-
-
Save jwoertink/1227889 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Unnecessary code removed | |
| require 'java' | |
| java_import "com.jme3.app.SimpleApplication" | |
| java_import "com.jme3.input.controls.ActionListener" | |
| class HelloInput < SimpleApplication | |
| def initKeys | |
| input_manager.add_listener(action_listener, ["Pause"].to_java(:string)) | |
| end | |
| private | |
| def action_listener | |
| ActionListener.new { | |
| def on_action(name, key_pressed, time_per_frame) | |
| @is_running = !@is_running if name.eql?("Pause") && !key_pressed | |
| end | |
| } | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternate version #2