Esempio n. 1
0
def draw_frame(title, name, perc):
    global last_draw
    if time.time() < last_draw + timeout:
        return

    frame = pygame.display.get_surface()
    w, h = frame.get_size()
    ui.fill(frame, (0, 0))
    text = ui.mediumfont.render(name, 1, (0, 0, 0))
    titletext = ui.mediumfont.render(title, 1, (0, 0, 0))
    frame.blit(text, ((w - text.get_width()) / 2, h - 60))
    frame.blit(titletext, ((w - titletext.get_width()) / 2, h - 120))

    barheight = 20
    barwidth = w * 0.6
    barpos = (w * 0.2, 100)
    round = 8
    ui.round_rect(frame, (200, 255, 200, 200), (0, 0, 0, 0),
                  barpos + (barwidth, barheight), round)
    if perc > 0:
        ui.round_rect(frame, (0, 255, 0, 200), (0, 0, 0, 0),
                      barpos + (int(barwidth * perc), barheight), round)
    #pygame.draw.rect(frame, (200, 255, 200), barpos + (barwidth, barheight))
    #pygame.draw.rect(frame, (0, 255, 0), barpos + (int(barwidth * perc), barheight))

    pygame.display.flip()

    last_draw = time.time()
Esempio n. 2
0
def draw_frame(title, name, perc):
    return
    global last_draw
    if time.time() < last_draw + timeout:
        return

    frame = graphics.get_surface()
    w, h = frame.get_size()
    ui.fill(frame, (0, 0))
    text = ui.mediumfont.render(name, 1, (0, 0, 0))
    titletext = ui.mediumfont.render(title, 1, (0, 0, 0))
    frame.blit(text, ((w - text.get_width()) / 2, h - 60))
    frame.blit(titletext, ((w - titletext.get_width()) / 2, h - 120))

    barheight = 20
    barwidth = w * 0.6
    barpos = (w * 0.2, 100)
    round = 8
    ui.round_rect(frame, (200, 255, 200, 200), (0, 0, 0, 0), barpos + (barwidth, barheight), round)
    if perc > 0:
        ui.round_rect(frame, (0, 255, 0, 200), (0, 0, 0, 0), barpos + (int(barwidth * perc), barheight), round)
    # .draw.rect(frame, (200, 255, 200), barpos + (barwidth, barheight))
    # .draw.rect(frame, (0, 255, 0), barpos + (int(barwidth * perc), barheight))

    graphics.flip()

    last_draw = time.time()
Esempio n. 3
0
 def draw(self, surf, pos):
     if self.dir != None and self.joystick.hidden:
         return
     if self.active:
         color = self.active_bg
     else:
         color = self.bg
     ui.round_rect(surf, color, self.fg, pos + self.size)
Esempio n. 4
0
 def draw(self, surf, pos):
     if self.dir != None and self.joystick.hidden:
         return
     if self.active:
         color = self.active_bg
     else:
         color = self.bg
     ui.round_rect(surf, color, self.fg, pos + self.size)
Esempio n. 5
0
    def draw(self, surf, pos):
        self.screen.draw(surf, pos)

        x, y = self.get_pos()
        size = self.item.size
        spacing = 5
        rect = (x + pos[0] - spacing, y + pos[1] - spacing, size[0] + spacing*2, size[1] + spacing*2)

        ui.round_rect(surf, (255, 255, 255), (0, 0, 0), rect, 10)
        self.item.draw(surf, (x + pos[0], y + pos[1]))
Esempio n. 6
0
    def draw(self, surf, pos):
        self.screen.draw(surf, pos)

        x, y = self.get_pos()
        size = self.item.size
        spacing = 5
        rect = (x + pos[0] - spacing, y + pos[1] - spacing,
                size[0] + spacing * 2, size[1] + spacing * 2)

        ui.round_rect(surf, (255, 255, 255, 240), (0, 0, 0), rect, 10)
        self.item.draw(surf, (x + pos[0], y + pos[1]))
Esempio n. 7
0
def draw_frame(title, name, perc):
    frame = pygame.display.get_surface()
    w, h = frame.get_size()
    ui.fill(frame, (0, 0))
    text = ui.mediumfont.render(name, 1, (0, 0, 0))
    titletext = ui.mediumfont.render(title, 1, (0, 0, 0))
    frame.blit(text, ((w - text.get_width())/2, h - 60))
    frame.blit(titletext, ((w - titletext.get_width())/2, h - 120))
    
    barheight = 20
    barwidth = w * 0.6
    barpos = (w * 0.2, 100)
    round = 8
    ui.round_rect(frame, (200, 255, 200, 200), (0,0,0,0), barpos + (barwidth, barheight), round)
    if perc > 0:
        ui.round_rect(frame, (0, 255, 0, 200), (0,0,0,0), barpos + (int(barwidth * perc), barheight), round)
    #pygame.draw.rect(frame, (200, 255, 200), barpos + (barwidth, barheight))
    #pygame.draw.rect(frame, (0, 255, 0), barpos + (int(barwidth * perc), barheight))
    
    pygame.display.flip()