Single gamepad queue bug fixed

pull/2/head
kaqu 2 years ago
parent feb871ade4
commit b63330291a
  1. 14
      pandemic_pong.py

@ -13,7 +13,7 @@ History:
02.12.20/KQ Streamlined version published
"""
DEVLOCAL = False # TODO: Adjust for publication to False!!!
DEVLOCAL = False # TODO: For client/server local development set to 'True'!
import sys, os, fcntl, time, random
from glob import glob
@ -86,7 +86,7 @@ class pongWindow(QMainWindow):
self.show()
# Don't annoy developers (except for local play - to test game mechanics !) ...
if (DEVLOCAL == False) or (pgv.bIsServer == False):
if (DEVLOCAL == False) and (pgv.bIsServer == False):
# Enforce caching ...
playsound(pgc.sounds[pgc.PLAYERCONTACTSOUND])
playsound(pgc.sounds[pgc.PLAYERMISSSOUND])
@ -295,10 +295,10 @@ if __name__ == '__main__':
else: # Local version (both gamepads assumed locally connected)
player1 = PongPlayer(sEventQueue1, False, 1, "", 10, pgc.GAMEAREA_MAX_Y/2-50, 20, 160)
player2 = PongPlayer(sEventQueue2, False, 2, "", pgc.GAMEAREA_MAX_X-40, pgc.GAMEAREA_MAX_Y/2-50, 20, 160)
elif player_index == 1: # Client/server version, player #1
player1 = PongPlayer(sEventQueue1, False, player_index, player_server, 10, pgc.GAMEAREA_MAX_Y/2-50, 20, 160)
elif player_index == 1: # Client/server version, player #1, only one queue (the last one!) avail. ...
player1 = PongPlayer(sEventQueue2, False, player_index, player_server, 10, pgc.GAMEAREA_MAX_Y/2-50, 20, 160)
player2 = PongPlayer(None, False, 2, "", pgc.GAMEAREA_MAX_X-40, pgc.GAMEAREA_MAX_Y/2-50, 20, 160)
elif player_index == 2: # Client/server version, player #2
elif player_index == 2: # Client/server version, player #2, only one queue (the last one!) avail. ...
player1 = PongPlayer(None, False, 1, "", 10, pgc.GAMEAREA_MAX_Y/2-50, 20, 160)
if DEVLOCAL == True: # 2 gamepads required FOR LOCAL DEVELOPMENT ONLY!
player2 = PongPlayer(sEventQueue2, False, player_index, player_server, pgc.GAMEAREA_MAX_X-40, pgc.GAMEAREA_MAX_Y/2-50, 20, 160)
@ -315,9 +315,9 @@ if __name__ == '__main__':
except IOError as e:
import errno
if e.errno == errno.EACCES:
print("Insufficient permissions to access {} or {}".format(path1, path2))
print("Insufficient permissions to access, maybe USB gamepad not plugged in?")
elif e.errno == errno.ENOENT:
print("Device {} or {} does not exist".format(path1, path2))
print("Device not found?")
else:
raise e
sys.exit(-1)

Loading…
Cancel
Save