def redraw(self, type): if type == MOUSEMOTION and type != self.MODE: self.blit(Shapes.drawOutsetRect(self, self.get_size(), 10, Colors.LIGHT_BACKGROUND, Colors.MENU_BUTTON_BACKGROUND), (0,0)) self.blit(self.text, self.text_location) self.mainController.myView.MENU.drawMenu() self.mainController.myView.drawScreen() elif type == MOUSEBUTTONUP and type != self.MODE: self.blit(Shapes.drawOutsetRect(self, self.get_size(), 10, Colors.BACKGROUND, Colors.MENU_BUTTON_BACKGROUND), (0,0)) self.blit(self.text, self.text_location) self.mainController.myView.MENU.drawMenu() self.mainController.myView.drawScreen() elif type == MOUSEBUTTONDOWN and type != self.MODE: self.blit(Shapes.drawOutsetRect(self, self.get_size(), 10, Colors.DARK_GREY, Colors.MENU_BUTTON_BACKGROUND), (0,0)) self.blit(self.text, self.text_location) self.mainController.myView.MENU.drawMenu() self.mainController.myView.drawScreen()
def __init__(self, mainController, location, size, text, isDropdown, command, options=[], commands=[]): pygame.Surface.__init__(self, (size)) self.blit(Shapes.drawOutsetRect(self, size, 10, Colors.BACKGROUND, Colors.MENU_BUTTON_BACKGROUND), (0,0)) self.mainController = mainController self.size = size self.location = location self.text = text self.command = command self.isDropdown = isDropdown self.text = Sources.MENU_FONT.render(text, 1, Colors.MENU_BUTTON_TEXT_COLOR) self.text_location = (self.size[0]/2 - self.text.get_size()[0]/2, self.size[1]/2 - self.text.get_size()[1]/2) self.blit(self.text, self.text_location) self.MODE = MOUSEBUTTONUP
def __init__(self, mainController, location, size, text, command, insideColor, outsideColor): pygame.Surface.__init__(self, (size)) self.blit(Shapes.drawOutsetRect(self, size, 10, insideColor, outsideColor), (0,0)) self.insideColor = insideColor self.outsideColor = outsideColor self.mainController = mainController self.size = size self.location = location self.text = text self.command = command self.text = Sources.MENU_FONT.render(text, 1, Colors.MENU_BUTTON_TEXT_COLOR) self.text_location = (self.size[0]/2 - self.text.get_size()[0]/2, self.size[1]/2 - self.text.get_size()[1]/2) self.blit(self.text, self.text_location) self.MODE = MOUSEBUTTONUP
def __init__(self, location, size, text, hint, inputType, mainController): pygame.Surface.__init__(self, (size)) self.blit(Shapes.drawOutsetRect(self, size, 10, Colors.BACKGROUND, Colors.MENU_BUTTON_BACKGROUND), (0,0)) self.size = size self.location = location self.fillerText = text self.hint = hint self.text = text self.asciiText = [] self.text = Sources.MENU_FONT.render(text, 1, Colors.MENU_BUTTON_TEXT_COLOR) self.text_location = (self.size[0]/2 - self.text.get_size()[0]/2, self.size[1]/2 - self.text.get_size()[1]/2) self.blit(self.text, self.text_location) self.mainController = mainController self.MODE = MOUSEBUTTONUP self.ON_OFF_COUNTER = 0 self.HAS_FOCUS = False self.redraw(False)