Exemple #1
0
 def __init__(self, name, position, ball, state):
     """Initialise the ball"""
     self.addLogger()
     #
     self.name = name
     self.state = state
     #
     # Create the background chip
     self.background = common.NamedSprite.from_sprite_sheet(
         'chips', (2, 5),
         S['called-ball-sprite-lookup'][ball.col],
         position,
         scale=S['machine-ball-sprite-scale'])
     #
     # And the text for the number
     self.text = common.getLabel(
         'machine-ball',
         (self.background.rect.width / 2, self.background.rect.height / 2),
         str(ball.number), S)
     self.text.color = pg.Color(S['called-ball-font-color'][ball.col])
     self.text.update_text()
     #
     # Write the number on the background
     self.text.draw(self.background.sprite)
     #
     # And rotate a bit
     self.background.rotate_to(
         random.uniform(*S['machine-ball-angle-range']))
     #
     self._x, self._y = self.background.rect.x, self.background.rect.y
Exemple #2
0
 def __init__(self, name, position, ball, state):
     """Initialise the ball"""
     self.addLogger()
     #
     self.name = name
     self.state = state
     #
     # Create the background chip
     self.background = common.NamedSprite.from_sprite_sheet(
         'chips', (2, 5),
         S['called-ball-sprite-lookup'][ball.col], position,
         scale=S['machine-ball-sprite-scale']
     )
     #
     # And the text for the number
     self.text = common.getLabel(
         'machine-ball',
         (self.background.rect.width / 2, self.background.rect.height / 2), str(ball.number), S
     )
     self.text.color = pg.Color(S['called-ball-font-color'][ball.col])
     self.text.update_text()
     #
     # Write the number on the background
     self.text.draw(self.background.sprite)
     #
     # And rotate a bit
     self.background.rotate_to(random.uniform(*S['machine-ball-angle-range']))
     #
     self._x, self._y = self.background.rect.x, self.background.rect.y
Exemple #3
0
 def __init__(self, name, position, state, index):
     """Initialise the card"""
     super(PlayerCard, self).__init__(name, position, state, index)
     #
     self.initial_value = self.value = S['card-initial-value']
     #
     # The button to double down the bet
     label_offset = S['card-double-down-button-offset']
     self.double_down_button = common.ImageOnOffButton(
         'double-down',
         (self.x + label_offset[0], self.y + label_offset[1]),
         'bingo-double-on', 'bingo-double-off',
         'card-double-down-button',
         'Double', True,
         S,
     )
     self.double_down_button.linkEvent(common.E_MOUSE_CLICK, self.double_down)
     #
     # The label for display of the card value
     label_offset = S['card-value-label-offset']
     label_position = (self.x + label_offset[0], self.y + label_offset[1])
     self.value_label = common.getLabel(
         'card-value-label',
         label_position,
         '*PLACEHOLDER*', S
     )
     self.update_value(self.initial_value)
     #
     # Button states
     self.states = [common.NamedSprite(state_name, label_position) for state_name in self.state_names]
     #
     self.drawables.extend([
         self.double_down_button, self.value_label,
     ])
     self.clickables.append(self.double_down_button)
Exemple #4
0
 def __init__(self, name, position, value, state):
     """Initialise the display"""
     common.DrawableGroup.__init__([])
     self.addLogger()
     #
     self.state = state
     self.ox, self.oy = self.x, self.y = position
     self.dx, self.dy = S['money-hide-offsets']
     self.background = common.NamedSprite(
         'digit-background',
         position,
         'bingo-money-display',
     )
     self.text = common.getLabel('money-digit', position, value, S)
     #
     self.append(self.background)
     self.append(self.text)
     #
     self.new_value = None
     self.hider = None
Exemple #5
0
    def __init__(self, name, card, offset, text):
        """Initialise the label"""
        self.name = name
        self.offset = offset
        self.text = text
        self.highlighted_state = S_NONE
        self.card = card
        self.is_active = True
        #
        self.x, self.y = card.x + offset[0], card.y + offset[1]
        self.label = common.getLabel(self.style_name, (self.x, self.y), text, S)
        self.highlighters = [
            self.get_highlighter(highlighter_name)
            for highlighter_name in self.highlight_names

        ]
        self.mouse_highlight = common.NamedSprite(
            'bingo-mouse-highlight', (self.x, self.y), scale=self.get_scale())
        #
        super(BingoLabel, self).__init__(name, self.label.rect)
Exemple #6
0
 def __init__(self, name, position, value, state):
     """Initialise the display"""
     common.DrawableGroup.__init__([])
     self.addLogger()
     #
     self.state = state
     self.ox, self.oy = self.x, self.y = position
     self.dx, self.dy = S['money-hide-offsets']
     self.background = common.NamedSprite(
         'digit-background', position, 'bingo-money-display',
     )
     self.text = common.getLabel(
         'money-digit', position, value, S
     )
     #
     self.append(self.background)
     self.append(self.text)
     #
     self.new_value = None
     self.hider = None
Exemple #7
0
 def __init__(self, name, position, state, index):
     """Initialise the card"""
     super(PlayerCard, self).__init__(name, position, state, index)
     #
     self.initial_value = self.value = S['card-initial-value']
     #
     # The button to double down the bet
     label_offset = S['card-double-down-button-offset']
     self.double_down_button = common.ImageOnOffButton(
         'double-down',
         (self.x + label_offset[0], self.y + label_offset[1]),
         'bingo-double-on',
         'bingo-double-off',
         'card-double-down-button',
         'Double',
         True,
         S,
     )
     self.double_down_button.linkEvent(common.E_MOUSE_CLICK,
                                       self.double_down)
     #
     # The label for display of the card value
     label_offset = S['card-value-label-offset']
     label_position = (self.x + label_offset[0], self.y + label_offset[1])
     self.value_label = common.getLabel('card-value-label', label_position,
                                        '*PLACEHOLDER*', S)
     self.update_value(self.initial_value)
     #
     # Button states
     self.states = [
         common.NamedSprite(state_name, label_position)
         for state_name in self.state_names
     ]
     #
     self.drawables.extend([
         self.double_down_button,
         self.value_label,
     ])
     self.clickables.append(self.double_down_button)