コード例 #1
0
    def install(
        self
    ):  # Graphical representation of scoreboard are four labels and a separator line
        self.playerLabels = [
            __new__(
                fabric.Text(
                    'Player {}'.format(name), {
                        'fill': 'white',
                        'fontFamily': 'arial',
                        'fontSize': '{}'.format(self.game.canvas.width / 30),
                        'left': self.game.orthoX(position * orthoWidth),
                        'top':
                        self.game.orthoY(fieldHeight // 2 + self.nameShift)
                    }))
            for name, position in (('AZ keys:', -7 / 16), ('KM keys:', 1 / 16))
        ]

        self.hintLabel = __new__(
            fabric.Text(
                '[spacebar] starts game, [enter] resets score', {
                    'fill': 'white',
                    'fontFamily': 'arial',
                    'fontSize': '{}'.format(self.game.canvas.width / 70),
                    'left': self.game.orthoX(-7 / 16 * orthoWidth),
                    'top': self.game.orthoY(fieldHeight // 2 + self.hintShift)
                }))

        self.image = __new__(
            fabric.Line([
                self.game.orthoX(-orthoWidth // 2),
                self.game.orthoY(fieldHeight // 2),
                self.game.orthoX(orthoWidth // 2),
                self.game.orthoY(fieldHeight // 2)
            ], {'stroke': 'white'}))
コード例 #2
0
 def commit(self):  # Committing labels is adapting their texts
     self.scoreLabels = [
         __new__(
             fabric.Text(
                 '{}'.format(score), {
                     'fill': 'white',
                     'fontFamily': 'arial',
                     'fontSize': '{}'.format(self.game.canvas.width / 30),
                     'left': self.game.orthoX(position * orthoWidth),
                     'top':
                     self.game.orthoY(fieldHeight // 2 + self.nameShift)
                 }))
         for score, position in zip(self.scores, (-2 / 16, 6 / 16))
     ]
コード例 #3
0
ファイル: pong.py プロジェクト: pkdevboxy/Transcrypt
 def commit(self):  # Committing labels is adapting their texts
     self.scoreLabels = [
         __new__(
             fabric.Text(
                 '{}'.format(score), {
                     fill: 'white',
                     fontFamily: 'arial',
                     fontSize: '30',
                     left: self.game.orthoX(position * orthoWidth),
                     top:
                     self.game.orthoY(fieldHeight // 2 + self.nameShift)
                 }))
         for score, position in zip(self.scores, (-2 / 16, 6 / 16))
     ]