Created
November 23, 2015 14:00
-
-
Save amirrajan/d253ad2d33c2ee4b01ea to your computer and use it in GitHub Desktop.
This file contains 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
def class MainThreadRunnable < Runnable | |
def initialize(room_activity) | |
@room_activity = room_activity | |
end | |
def run | |
@room_activity.update_core | |
end | |
end | |
class MyTimerTask < Java::Util::TimerTask | |
def initialize(roomscreen, ctx) | |
@game = Game.new | |
@ctx = ctx | |
@handler = Handler.new(ctx.getMainLooper) #Handler mainHandler = new Handler(context.getMainLooper()); | |
@roomscreen = roomscreen | |
end | |
def run | |
return if @timer_paused | |
game.tick | |
@handler.post(MainThreadRunnable.new(@roomscreen)) #mainHandler.post(myRunnable); | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment