def __init__(self, x, y, width, height, msg, size=16, 
            text_colour=base.BLACK, bg_colour=base.WHITE, 
            highlight_text=base.WHITE, highlight_bg=base.BLACK,
            offset_x=0, offset_y=0, bold=False):

        self.normal = pygame.Surface((width, height))
        self.normal.fill(bg_colour)

        font = Font(_FONT, size)
        font.set_bold(bold)
        font_width, font_height = font.size(msg)
        font_x = (width - font_width) / 2
        font_y = (height - font_height) / 2

        self.normal.blit(font.render(msg, False, text_colour), 
                                    (font_x, font_y))

        self.highlighted = pygame.Surface((width, height))
        self.highlighted.fill(highlight_bg)
        self.highlighted.blit(font.render(msg, False, highlight_text), 
                                        (font_x, font_y))

        self.offset_x = offset_x
        self.offset_y = offset_y
        
        self.force_highlight = False
        self.disabled = False
        PicassoAsset.__init__(self, self.normal, x, y)
Exemple #2
0
 def __init__(self, x, y, msg, colour=assets.base.BLACK, size=32, 
         bold=False):
     self.colour = colour
     self.size = size
     self.bold = bold
     PicassoAsset.__init__(self, None, x, y)
     self.render_text(msg)
 def __init__(self, continent, territory, image_path, x, y):
     self.territory = territory
     self.last_known_owner = None
     self.highlighted = False
     surface = pygame.image.load(image_path).convert_alpha()
     ClickableAsset.__init__(self, x, y, 0, 0, "")
     PicassoAsset.__init__(self, surface, x, y)
Exemple #4
0
 def __init__(self, territory_asset, size=32):
     self.territory_asset = territory_asset
     self.count = None
     self.size = size
     self.colour = base.BLACK
     x = territory_asset.x + territory_asset.surface.get_width() / 3
     y = territory_asset.y + territory_asset.surface.get_height() / 3
     PicassoAsset.__init__(self, None, x, y)
Exemple #5
0
 def __init__(self, x, y, path, scale_x=1.0, scale_y=1.0):
     self.path = path
     self.surface = pygame.image.load(path).convert_alpha()
     if scale_x != 1 or scale_y != 1:
         self.surface = pygame.transform.scale(self.surface, 
             (int(self.surface.get_width() * scale_x),
             int(self.surface.get_height() * scale_y)))
     PicassoAsset.__init__(self, self.surface, x, y)
Exemple #6
0
 def __init__(self, territory_asset, size=32):
     self.territory_asset = territory_asset
     self.count = None
     self.size = size
     self.colour = base.BLACK
     x = territory_asset.x + territory_asset.surface.get_width() / 2
     y = territory_asset.y + territory_asset.surface.get_height() / 3
     PicassoAsset.__init__(self, None, x, y)
Exemple #7
0
 def __init__(self,
              x,
              y,
              msg,
              colour=assets.base.BLACK,
              size=32,
              bold=False):
     self.colour = colour
     self.size = size
     self.bold = bold
     PicassoAsset.__init__(self, None, x, y)
     self.render_text(msg)
Exemple #8
0
    def __init__(self, x, y, width, height, msg, size=32, 
            text_colour=base.BLACK, bg_colour=base.WHITE, 
            highlight_text=base.WHITE, highlight_bg=base.BLACK):

        font = Font(None, size)
        self.normal = pygame.Surface((width, height))
        self.normal.fill(bg_colour)
        self.normal.blit(font.render(msg, False, text_colour), (0, 0))
    
        self.highlighted = pygame.Surface((width, height))
        self.highlighted.fill(highlight_bg)
        self.highlighted.blit(font.render(msg, False, highlight_text), (0, 0))
        PicassoAsset.__init__(self, self.normal, x, y)
Exemple #9
0
    def __init__(self,
                 x,
                 y,
                 width,
                 height,
                 msg,
                 size=16,
                 text_colour=base.BLACK,
                 bg_colour=base.WHITE,
                 highlight_text=base.WHITE,
                 highlight_bg=base.BLACK,
                 offset_x=0,
                 offset_y=0,
                 bold=False):

        self.normal = pygame.Surface((width, height))
        self.normal.fill(bg_colour)

        font = Font(_FONT, size)
        font.set_bold(bold)
        font_width, font_height = font.size(msg)
        font_x = (width - font_width) / 2
        font_y = (height - font_height) / 2

        self.normal.blit(font.render(msg, False, text_colour),
                         (font_x, font_y))

        self.highlighted = pygame.Surface((width, height))
        self.highlighted.fill(highlight_bg)
        self.highlighted.blit(font.render(msg, False, highlight_text),
                              (font_x, font_y))

        self.offset_x = offset_x
        self.offset_y = offset_y

        self.force_highlight = False
        self.disabled = False
        PicassoAsset.__init__(self, self.normal, x, y)
Exemple #10
0
 def __init__(self, x, y, title, width=400, height=200, colour=BROWN):
     self.colour = colour
     self.background = pygame.Surface((width, height))
     self.width = width
     self.height = height
     self.title = ClickableAsset(
         self._BORDER_PIXELS,
         self._BORDER_PIXELS,
         width - 2 * self._BORDER_PIXELS,
         self._TITLE_HEIGHT_PIXELS - self._BORDER_PIXELS,
         ''
     )
     # HAX, f**k it, make go now
     self.title_background = ScaledImageAsset(0, 0, width, 
         self._TITLE_HEIGHT_PIXELS, TITLE_BACKGROUND)
     self.title_text = CentredTextAsset(0, 2, width, 
         self._TITLE_HEIGHT_PIXELS, "== %s ==" % title, size=16, bold=True)
     self.body = ScaledImageAsset(
         0, self._TITLE_HEIGHT_PIXELS, width, 
         height - self._TITLE_HEIGHT_PIXELS, BODY_BACKGROUND)
     self.title.offset_x = x
     self.title.offset_y = y
     self.assets = []
     PicassoAsset.__init__(self, None, x, y)
Exemple #11
0
 def __init__(self, continent, territory, image_path, x, y):
     self.territory = territory
     self.last_known_owner = None
     self.highlighted = False
     surface = pygame.image.load(image_path)
     PicassoAsset.__init__(self, surface, x, y)