|
|
|
@ -198,7 +198,7 @@ class BalanceInput(AbstractInput, threading.Thread):
@@ -198,7 +198,7 @@ class BalanceInput(AbstractInput, threading.Thread):
|
|
|
|
|
self.addr = addr |
|
|
|
|
self.player_id = player_id |
|
|
|
|
self.evt = None |
|
|
|
|
self.oldevt = None |
|
|
|
|
self.lastevt = None |
|
|
|
|
self.player_present = False |
|
|
|
|
threading.Thread.__init__(self, daemon=True) |
|
|
|
|
self.start() |
|
|
|
@ -259,9 +259,9 @@ class BalanceInput(AbstractInput, threading.Thread):
@@ -259,9 +259,9 @@ class BalanceInput(AbstractInput, threading.Thread):
|
|
|
|
|
print('player_id=%d debounce %s' % (self.player_id, evt)) |
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
if self.lastevent != evt: |
|
|
|
|
if self.lastevt != evt: |
|
|
|
|
self.evt = evt |
|
|
|
|
self.lastevent = evt |
|
|
|
|
self.lastevt = evt |
|
|
|
|
print('player_id=%d event=%s' % (self.player_id, self.evt)) |
|
|
|
|
|
|
|
|
|
else: |
|
|
|
@ -318,10 +318,13 @@ if __name__ == '__main__':
@@ -318,10 +318,13 @@ if __name__ == '__main__':
|
|
|
|
|
time.sleep(2) |
|
|
|
|
games = Game.__subclasses__() |
|
|
|
|
game_idx = 0 |
|
|
|
|
old_idx = -1 |
|
|
|
|
while True: |
|
|
|
|
gamecls = games[game_idx] |
|
|
|
|
game = gamecls() |
|
|
|
|
out.sendFrame(create_menu_frame(dim, game)) |
|
|
|
|
if old_idx != game_idx: |
|
|
|
|
gamecls = games[game_idx] |
|
|
|
|
game = gamecls() |
|
|
|
|
out.sendFrame(create_menu_frame(dim, game)) |
|
|
|
|
old_idx = game_idx |
|
|
|
|
|
|
|
|
|
evt = inp1.get_event() |
|
|
|
|
if evt == InputEvent.LEFT: |
|
|
|
@ -346,8 +349,12 @@ if __name__ == '__main__':
@@ -346,8 +349,12 @@ if __name__ == '__main__':
|
|
|
|
|
start = time.time() |
|
|
|
|
while time.time() < start+wait_time: |
|
|
|
|
if inp2.get_event() == InputEvent.STEP_ON: |
|
|
|
|
inp1.running = False |
|
|
|
|
inp2.running = False |
|
|
|
|
start_game(game, 2) |
|
|
|
|
time.sleep(0.1) |
|
|
|
|
|
|
|
|
|
inp1.running = False |
|
|
|
|
inp2.running = False |
|
|
|
|
start_game(game, 1) |
|
|
|
|
|
|
|
|
|