Fixed some issues related to threading in game clock by using a queue

This commit is contained in:
2021-09-30 10:51:49 -05:00
parent 7bfc404413
commit fd6eb64232
10 changed files with 139 additions and 80 deletions

View File

@@ -1,13 +1,20 @@
module TAC
class PracticeGameClock
class ClockProxy
attr_reader :queue, :clock
def initialize(clock, jukebox)
@clock = clock
@jukebox = jukebox
@queue = []
@callbacks = {}
end
def enqueue(&block)
@queue << block
end
def register(callback, method)
@callbacks[callback] = method
end