|
|
@ -116,7 +116,7 @@ class BalanceBoardPlayer(object): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class B4lancePong(object): |
|
|
|
class B4lancePong(object): |
|
|
|
def __init__(self, out, balanceserver=None, color=True, numplayers=None): |
|
|
|
def __init__(self, out, balanceserver=None, color=True): |
|
|
|
self.__playground = None |
|
|
|
self.__playground = None |
|
|
|
self.__out = out |
|
|
|
self.__out = out |
|
|
|
self.__color = color |
|
|
|
self.__color = color |
|
|
@ -124,7 +124,6 @@ class B4lancePong(object): |
|
|
|
self.__balanceserver = ('localhost', 4711) |
|
|
|
self.__balanceserver = ('localhost', 4711) |
|
|
|
else: |
|
|
|
else: |
|
|
|
self.__balanceserver = balanceserver |
|
|
|
self.__balanceserver = balanceserver |
|
|
|
self.__numplayers = numplayers |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if color: |
|
|
|
if color: |
|
|
|
self.__dimension = blup.frame.FrameDimension(22, 16, 256, 3) |
|
|
|
self.__dimension = blup.frame.FrameDimension(22, 16, 256, 3) |
|
|
@ -150,9 +149,6 @@ class B4lancePong(object): |
|
|
|
self.__players = [] |
|
|
|
self.__players = [] |
|
|
|
self.__players.append(BalanceBoardPlayer(self.__playground, self.__playground.leftPaddle, balance_util_p1)) |
|
|
|
self.__players.append(BalanceBoardPlayer(self.__playground, self.__playground.leftPaddle, balance_util_p1)) |
|
|
|
|
|
|
|
|
|
|
|
if self.__numplayers == 2: |
|
|
|
|
|
|
|
self.__players.append(BalanceBoardPlayer(self.__playground, self.__playground.rightPaddle, balance_util_p2)) |
|
|
|
|
|
|
|
elif self.__numplayers is None: |
|
|
|
|
|
|
|
for i in range(5): |
|
|
|
for i in range(5): |
|
|
|
frame = mk_logo_frame(self.__dimension, onePlayer) |
|
|
|
frame = mk_logo_frame(self.__dimension, onePlayer) |
|
|
|
self.__out.sendFrame(frame) |
|
|
|
self.__out.sendFrame(frame) |
|
|
@ -204,8 +200,6 @@ class B4lancePong(object): |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
if __name__ == '__main__': |
|
|
|
parser = argparse.ArgumentParser(description='Blinkenbunt Pong!') |
|
|
|
parser = argparse.ArgumentParser(description='Blinkenbunt Pong!') |
|
|
|
parser.add_argument('--players', dest='players', type=int, |
|
|
|
|
|
|
|
help='number of players (autodetect if unspecified)') |
|
|
|
|
|
|
|
parser.add_argument('--balance', dest='balance', type=str, |
|
|
|
parser.add_argument('--balance', dest='balance', type=str, |
|
|
|
metavar='HOST:PORT', help='use balance input') |
|
|
|
metavar='HOST:PORT', help='use balance input') |
|
|
|
parser.add_argument('--out', dest='out', type=str, metavar='OUTPUT', |
|
|
|
parser.add_argument('--out', dest='out', type=str, metavar='OUTPUT', |
|
|
@ -215,7 +209,6 @@ if __name__ == '__main__': |
|
|
|
out = blup.output.getOutput(args.out) |
|
|
|
out = blup.output.getOutput(args.out) |
|
|
|
bhost, bport = args.balance.split(':') |
|
|
|
bhost, bport = args.balance.split(':') |
|
|
|
|
|
|
|
|
|
|
|
p0ng = B4lancePong(out, balanceserver=(bhost, int(bport)), color=True, |
|
|
|
p0ng = B4lancePong(out, balanceserver=(bhost, int(bport)), color=True) |
|
|
|
numplayers=args.players) |
|
|
|
|
|
|
|
p0ng.runGame() |
|
|
|
p0ng.runGame() |
|
|
|
|
|
|
|
|
|
|
|