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()
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()
def main_draw(): surf = graphics.get_window() fill(surf, (0,0)) screen.draw(surf, (0, 0)) for overlay in overlays: overlay.draw(surf, overlay.pos) graphics.flip()
def main_draw(): surf = graphics.get_window() fill(surf, (0, 0)) screen.draw(surf, (0, 0)) for overlay in overlays: overlay.draw(surf, overlay.pos) graphics.flip()
def main_draw(): last_draw.capture() surf = graphics.get_window() fill(surf, (0,0)) _screen.update_layout() _screen.draw(surf, (0, 0)) for overlay in overlays: overlay.draw(surf, overlay.pos) draw_hooks.execute_and_clear() graphics.flip()