Browse Source

Merge branch 'master' of blinkenbunt:gitrepos/blup3

feature/balanceutils
Fr3deric 8 years ago committed by Frederic
parent
commit
f69b38c402
  1. 9
      gamemenu.py
  2. 4
      wii-pair/daemon.py

9
gamemenu.py

@ -204,7 +204,7 @@ class TestInput(AbstractInput):
pygame = self.__pygame pygame = self.__pygame
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == pygame.KEYDOWN: if event.type == pygame.KEYDOWN:
if self.control.get(event.key, None) == InputEvent.STEP_ON: if self.controls.get(event.key, None) == InputEvent.STEP_ON:
self.player_present = True self.player_present = True
return self.controls.get(event.key, None) return self.controls.get(event.key, None)
return None return None
@ -342,12 +342,17 @@ if __name__ == '__main__':
games = Game.__subclasses__() games = Game.__subclasses__()
game_idx = 0 game_idx = 0
old_idx = -1 old_idx = -1
lastrefresh = 0
while True: while True:
if old_idx != game_idx: if old_idx != game_idx:
gamecls = games[game_idx] gamecls = games[game_idx]
game = gamecls() game = gamecls()
out.sendFrame(create_menu_frame(dim, game))
old_idx = game_idx old_idx = game_idx
lastrefresh = 0
if time.time() >= lastrefresh+1:
out.sendFrame(create_menu_frame(dim, game))
lastrefresh = time.time()
evt = inp1.get_event() evt = inp1.get_event()
if evt == InputEvent.LEFT: if evt == InputEvent.LEFT:

4
wii-pair/daemon.py

@ -200,13 +200,13 @@ try:
v = 0 v = 0
if w.weight is not None: if w.weight is not None:
v = round(w.weight) v = round(w.weight)
r += struct.pack('b', v) r += struct.pack('B', v)
elif m[0] == ord('b'): elif m[0] == ord('b'):
# Return battery # Return battery
v = 0 v = 0
if w.board.battery is not None: if w.board.battery is not None:
v = round(w.board.battery*100) v = round(w.board.battery*100)
r += struct.pack('b', v) r += struct.pack('B', v)
else: else:
# Return balance # Return balance
if w.pos_x is None: if w.pos_x is None:

Loading…
Cancel
Save