Created
September 22, 2013 05:21
-
-
Save RyanScottLewis/6656957 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
startGameButton.addListener(new InputListener() { | |
@Override | |
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { | |
game.setScreen(new GameScreen(game)); | |
return true; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If InputListener is a Java Interface, JRuby has a feature where you can use a Ruby block for that, documented here:
https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby#closure-conversion
So in JRuby, this code might look like:
Make sense?
It also lets you use snake_case instead of camelCase for those identifiers if you wish for things to look more ruby-like, and also has sugar for getters and setters. So I imaging you could write
game.screen = GameScreen.new(game)
instead ofgame.setScreen( GameScreen.new(game) )