def draw(self): if self.text: self.screen.blit( self.style.font.render(self.text, gwglob.ANTI_ALIAS, self.style.color(self)), (self.topleft[0] + 5, self.topleft[1])) gwres.roundrect(self.screen, (self.topleft, self.size), self.style.color(self, 1))
def draw(self): self.screen.blit( self.style.font.render(self.text, gwglob.ANTI_ALIAS, self.style.color(self)), self.topleft) if self.collidepoint(pygame.mouse.get_pos()): gwres.roundrect(self.screen, ((self.topleft[0] - 5, self.topleft[1]), (self.size[0] + 10, self.size[1])), self.style.color(self, 1))
def draw(self): gwres.roundrect( self.screen, ((self.topleft[0] + 3, self.topleft[1] + 3), (max(1, (self.size[0] - 6) / 255 * self.value), self.size[1] - 6)), self.color, 1) gwres.roundrect(self.screen, (self.topleft, self.size), self.style.color(self, 1))
def draw(self): if self.collidepoint(pygame.mouse.get_pos()): self.selected = True self.screen.blit( self.style.font.render(self.text, gwglob.ANTI_ALIAS, self.style.color(self)), (self.topleft[0] + 5, self.topleft[1])) gwres.roundrect(self.screen, (self.topleft, self.size), self.style.color(self, 1)) self.selected = False
def draw(self): if self.collidepoint(pygame.mouse.get_pos()): self.selected = True if isinstance(self.icon, pygame.Surface): self.screen.blit(self.icon, (self.topleft[0] + 3, self.topleft[1] + 3)) else: icon = self.icon(self, (self.topleft[0] + 3, self.topleft[1] + 3)) gwres.roundrect(self.screen, (self.topleft, self.size), self.style.color(self, 1)) self.selected = False
def run(self): while True: if self.processevents(): return MainMenu(self.screen) if self.leave != None: return self.leave self.screen.blit(self.static, (0, 0)) gwres.roundrect(self.screen, ((90, self.page - 10), self.listsize), (0, 128, 255)) self.color.color = (self.red.value, self.green.value, self.blue.value) self.menu.items[self.menu.selitem].color = self.color.color self.draw() pygame.display.flip()
def draw(self): gwres.roundrect(self.screen, ((self.topleft[0] + 2, self.topleft[1] + 2), (self.size[1] - 4, self.size[1] - 4)), self.color, 1) self.screen.blit( self.style.font.render(self.text, gwglob.ANTI_ALIAS, self.style.color(self)), (self.topleft[0] + self.size[1] + 5, self.topleft[1])) if self.collidepoint(pygame.mouse.get_pos()): gwres.roundrect(self.screen, ((self.topleft[0] - 5, self.topleft[1]), (self.size[0] - self.size[1], self.size[1])), self.style.color(self, 1)) self.remove.topleft = (self.topright[0] - self.size[1], self.topright[1]) self.remove.draw()
def __init__(self, screen, title): self.selected = None self.leave = None self.static = pygame.Surface(gwglob.SIZE) gwres.roundrect(self.static, ((10, 10), (gwglob.SIZE[0] - 20, gwglob.SIZE[1] - 20)), (0, 128, 255)) logo = gwres.load('res', 'logo.png') gwres.roundrect(self.static, ((gwglob.SIZE[0] / 2 - logo.get_width() / 2 - 10, 5), (logo.get_width() + 20, logo.get_height() + 20)), (0, 128, 255)) self.static.blit(logo, (gwglob.SIZE[0] / 2 - logo.get_width() / 2, 15)) title = gwglob.BIG_FONT.render(title, gwglob.ANTI_ALIAS, (0, 128, 255)) width = max(gwglob.SIZE[0] / 2 - logo.get_width() / 2 - 5, title.get_width() + 20) gwres.roundrect(self.static, ((5, logo.get_height() + 20), (width, title.get_height() + 20)), (0, 128, 255)) self.static.blit( title, (5 + width / 2 - title.get_width() / 2, logo.get_height() + 30)) self.page = 80 + logo.get_height() + title.get_height() self.widgets = [] Screen.__init__(self, screen)
def draw(self): gwres.roundrect(self.screen, (self.topleft, (12, 12)), self.style.color(self, 1)) c = self.style.color(self) pygame.draw.line(self.screen, c, (self.topleft[0] + 2, self.topleft[1] + 4), (self.topleft[0] + 5, self.topleft[1] + 7)) pygame.draw.line(self.screen, c, (self.topleft[0] + 6, self.topleft[1] + 7), (self.topleft[0] + 9, self.topleft[1] + 4)) if self.selected: dd = ((self.menu.topleft[0] - 10, self.menu.topleft[1] - 5), (self.menu.width + 15, self.menu.height + 10)) gwres.roundrect(self.screen, dd, (0, 0, 0), 1) gwres.roundrect(self.screen, dd, self.style.color(self, 1)) self.menu.draw()