+ text = TextBoxWidget(
+ (x_offset, y_offset), action.get_text(self.card),
+ box_width=(INFO_SIZE[0] - 16) // EIGHT_BIT_SCALE,
+ fontsize=28, colour=text_colour)
+ text.render(self.surface)
+
+ border_colour = None
+ if choice == self.chosen:
+ border_colour = PALETTE.GREEN if action_viable else PALETTE.ORANGE
+ if border_colour:
+ bottom = y_offset + text.surface.get_rect().height
+ right = text.surface.get_rect().width + x_offset
+ pygame.draw.lines(self.surface, border_colour, True,
+ [(x_offset, y_offset), (right, y_offset),
+ (right, bottom), (x_offset, bottom)], 4)
+ if action.required_bits:
+ img_name = BIT_MAP[action.required_bits].replace(
+ '.png', '_small.png')
+ img = resources.get_image(img_name,
+ transforms=(EIGHT_BIT,))
+ self.surface.blit(img, (0, y_offset))
+ return y_offset + text.surface.get_rect().height + 16
+
+ def set_position(self, position):
+ self.card_position = position
+ self.card = self.state.board_locations[self.card_position]
+ if self.state.gameboard.player_mode == ACT:
+ if self.chosen is None:
+ self.chosen = 0
+ else:
+ self.chosen = None