コード例 #1
0
ファイル: gui.py プロジェクト: morgan-cromell/GymnasieArbete
 def __init__(self, data, event_type, rect):
     self.data = data
     self.rect = rect
     self.event_type = event_type
     if type(self.data) == str:
         self.image = render_textrect(self.data, self.rect.w, self.rect, (255, 255, 255), None, 1)
     else:
         self.image = self.data
コード例 #2
0
ファイル: gui.py プロジェクト: bojkott/GymnasieArbete
 def __init__(self, data, event_type, rect):
     self.data = data
     self.rect = rect
     self.event_type = event_type
     if type(self.data) == str:
         self.image = render_textrect(self.data, self.rect.w, self.rect,
                                      (255, 255, 255), None, 1)
     else:
         self.image = self.data
コード例 #3
0
 def update_data(self):
     self.show_window = False
     self.image = pygame.Surface((200, 100), pygame.SRCALPHA, 32)
     i = 0
     for key, event in self.options.items():
         string = "{0}: {1}".format(key, event[0])
         rect = pygame.Rect((0, 15 * i), (len(string) * 7, 15))
         i += 1
         self.image.blit(render_textrect(string, 15, rect, (128, 128, 128), (0, 0, 0)), (rect.x, rect.y))
コード例 #4
0
 def update_data(self):
     self.show_window = False
     self.image = pygame.Surface((200, 100), pygame.SRCALPHA, 32)
     i = 0
     for key, event in self.options.items():
         string = "{0}: {1}".format(key, event[0])
         rect = pygame.Rect((0, 15 * i), (len(string) * 7, 15))
         i += 1
         self.image.blit(
             render_textrect(string, 15, rect, (128, 128, 128), (0, 0, 0)),
             (rect.x, rect.y))
コード例 #5
0
 def update_data(self):
     self.show_window = False
     i = 0
     self.image.fill(0)
     string_len = 0
     for key, event in self.options.items():
         string = "[{0}] : {1}".format(key, event[0])
         if len(string) > string_len:
             string_len = len(string)
     for key, event in self.options.items():
         string = "[{0}] : {1}".format(key, event[0])
         rect = pygame.Rect((0, TOOLTIP_FONT_SIZE * i), (string_len * 10, TOOLTIP_FONT_SIZE))
         i += 1
         self.image.blit(render_textrect(string, TOOLTIP_FONT_SIZE, rect, (255, 255, 255), (24, 72, 240)), (rect.x, rect.y))
コード例 #6
0
    def examine(self):
        width = 250
        info = pygame.Surface((width, 80))
        info.fill((54, 54, 54))
        info.blit(self.image, (0, 0))
        info.blit(render_textrect(self.name, 32, info.get_rect(), eval(self.extra['rarity'])), (40, 5))
        info.blit(render_textrect(self.description, 20, info.get_rect(), (255, 255, 255)), (0, 40))

        stats = pygame.Surface((width, 50))
        stats.fill((54, 54, 54))
        y = 0
        for stat, i in self.stats.items():
            stats.blit(self.stats_font.render('{0}: '.format(stat), 0, (255, 255, 255)), (0, y * 10))
            stats.blit(self.stats_font.render(str(i), 0, (255, 255, 143)),
                       (self.stats_font.size('{0}: '.format(stat))[0], y * 10))
            y += 1
        image = pygame.Surface((width + 20, info.get_rect().h + stats.get_rect().h + 20))
        image.fill((54, 54, 54))
        image.blit(info, (10, 10))
        image.blit(stats, (10, info.get_rect().h + 20))
        pygame.draw.line(image, (0, 0, 0), (10, info.get_rect().h + 13),
                         (info.get_rect().w + 10, info.get_rect().h + 13), 2)
        pygame.draw.rect(image, (155, 155, 155), image.get_rect(), 1)
        return image
コード例 #7
0
ファイル: tooltip.py プロジェクト: bojkott/GymnasieArbete
 def update_data(self):
     self.show_window = False
     i = 0
     self.image.fill(0)
     string_len = 0
     for key, event in self.options.items():
         string = "[{0}] : {1}".format(key, event[0])
         if len(string) > string_len:
             string_len = len(string)
     for key, event in self.options.items():
         string = "[{0}] : {1}".format(key, event[0])
         rect = pygame.Rect((0, TOOLTIP_FONT_SIZE * i),
                            (string_len * 10, TOOLTIP_FONT_SIZE))
         i += 1
         self.image.blit(
             render_textrect(string, TOOLTIP_FONT_SIZE, rect,
                             (255, 255, 255), (24, 72, 240)),
             (rect.x, rect.y))
コード例 #8
0
ファイル: console.py プロジェクト: bojkott/GymnasieArbete
 def __init__(self, rect, data, color):
     self.data = data
     self.rect = rect
     if type(data) == str:
         self.image = render_textrect(data, 15, rect, color)
コード例 #9
0
 def __init__(self, rect, data, color):
     self.data = data
     self.rect = rect
     if type(data) == str:
         self.image = render_textrect(data, 15, rect, color)
コード例 #10
0
 def handle_event(self, event):
     self.image = pygame.image.load('../res/gui/info_bar.png')
     etype = get_event_type(event)
     if etype == GUI_INFOBAR_POST:
         self.image.blit(render_textrect(event.msg, self.text_size, self.rect, (255, 255, 255), (0, 0, 0, 0), 1), (0, 2))