Player headline added

master
kaqu 2 years ago
parent d554cdce9f
commit 65a66fa4ff
  1. 12
      game_objects/pong_viewer.py
  2. 2
      pandemic_pong.py

@ -47,13 +47,15 @@ def draw_buttonstate(x, y, player, painter, scale_x, scale_y):
class pongWindow(QMainWindow):
"""Qt5 base class"""
def __init__(self, debug_x, debug_y, viewserver, game, ball, player1, player2):
def __init__(self, debug_x, debug_y, player_index, viewserver, game, ball, player1, player2):
super().__init__()
self.title = "Pandemic Pong"
if pgv.bIsLocal:
self.title = "Pandemic Pong (Local)"
if pgv.bIsViewer:
self.title = "Pandemic Pong (Viewer)"
elif pgv.bIsViewer:
self.title = "Pandemic Pong (Viewer)"
elif player_index > 0:
self.title = "Pandemic Pong (Player #{})".format(player_index)
self.top = 0
self.left = 0
self.win_width = 1920
@ -241,10 +243,10 @@ class pongWindow(QMainWindow):
self.update() # Enforce redraw (explicitely)
self.timer.start() # Re-enable timer event
def run_Qt5_viewer(debug_x, debug_y, viewserver, game, ball, player1, player2):
def run_Qt5_viewer(debug_x, debug_y, player_index, viewserver, game, ball, player1, player2):
"""Qt5 viewer"""
app = QApplication(sys.argv) # Eval command line args
window = pongWindow(debug_x, debug_y, viewserver, game, ball, player1, player2) # Create Qt5 GUI
window = pongWindow(debug_x, debug_y, player_index, viewserver, game, ball, player1, player2) # Create Qt5 GUI
return app.exec_() # & run logic

@ -129,7 +129,7 @@ if __name__ == '__main__':
rc = 0
if pgv.bIsServer == False: # This is NOT the headless server!
from game_objects.pong_viewer import run_Qt5_viewer
rc = run_Qt5_viewer(debug_x, debug_y, viewserver, game, ball, player1, player2)
rc = run_Qt5_viewer(debug_x, debug_y, player_index, viewserver, game, ball, player1, player2)
else: # Headless server-side game loop
while True:

Loading…
Cancel
Save