class MainMenuScreen(PygameScreen): """ Represents the Main Menu screen """ def __init__(self, menu, currentPlayer): """ """ PygameScreen.__init__(self) self.currentPlayer = currentPlayer self.menu = menu self.logo = Logo() name = "None" if currentPlayer is not None: name = currentPlayer.fullname self.playerLabel = Label("{0}: {1}".format("Player", name), size=24, color=(0, 0, 0)) self.menuView = MainMenuWidget(menu) def drawSurface(self): """ Draws the screen to the provided window """ self.drawMap() self.drawOnSurface(self.playerLabel.draw(), right=1, top=0) self.drawLogo() self.drawMenu() def drawMap(self): """ Draws the map to the window """ mapSurface = map.draw() self.drawOnSurface(mapSurface, left=0, top=0) def drawLogo(self): """ Draws the Logo to the window """ logoSurface = self.logo.draw() self.drawOnSurface(logoSurface, centerx=.5, centery=.25) def drawMenu(self): """ Draws the Menu to the window """ menuSurface = self.menuView.draw() self.drawOnSurface(menuSurface, centerx=.5, centery=11.0 / 16)
class MainMenuScreen(PygameScreen): """ Represents the Main Menu screen """ def __init__(self, menu, currentPlayer): """ """ PygameScreen.__init__(self) self.currentPlayer = currentPlayer self.menu = menu self.logo = Logo() name = "None" if currentPlayer is not None: name = currentPlayer.fullname self.playerLabel = Label("{0}: {1}".format("Player", name), size=24, color=(0, 0, 0)) self.menuView = MainMenuWidget(menu) def drawSurface(self): """ Draws the screen to the provided window """ self.drawMap() self.drawOnSurface(self.playerLabel.draw(), right=1, top=0) self.drawLogo() self.drawMenu() def drawMap(self): """ Draws the map to the window """ mapSurface = map.draw() self.drawOnSurface(mapSurface, left=0, top=0) def drawLogo(self): """ Draws the Logo to the window """ logoSurface = self.logo.draw() self.drawOnSurface(logoSurface, centerx=.5, centery=.25) def drawMenu(self): """ Draws the Menu to the window """ menuSurface = self.menuView.draw() self.drawOnSurface(menuSurface, centerx=.5, centery=11.0/16)
class MainMenuScreen(ConsoleScreen): """ Represents the Main Menu screen """ def __init__(self, menu): """ """ self.menu = menu self.logo = Logo() self.menuView = MenuView(menu) def draw(self): """ Draws the screen """ self.drawLogo() self.drawMenu() def drawLogo(self): """ Draws the Logo to the window """ logoText, logoSize = self.logo.draw() self.drawCenteredText(logoText, logoSize, .5, .25) def drawMenu(self): """ Draws the Menu to the window """ menuText, menuSize = self.menuView.draw() self.drawCenteredText(menuText, menuSize, .5, 11.0/16)
# @author huizhan import os from logo import Logo if __name__ == '__main__': store_root = './Logos/' logo = Logo() content = 'gea6' with open('./Workers/gea6.logo', 'r+') as f: layout = f.read().split('\n') logo.set_layout(layout) # get colors colors = os.listdir('./Colors/') colors = [color.split('.')[0] for color in \ colors if color.split('.')[-1]=='jpg'] for color in colors: logo.set_colors(color) logo_img = logo.draw() save_path = store_root + content + '/' img_name = color + '.bmp' if not os.path.exists(save_path): os.makedirs(save_path) logo_img.save(save_path + img_name)