def __init__(self): # Initialize via superclass constructor ViewInterface.__init__(self) # Write out the logo and menu items using the TextRenderer module self.writeTexts() # Menu item highlighted by the user, or "None" self.mouseover = None # BG image self.bg = pygame.transform.smoothscale( pygame.image.load(os.path.join(PATH_GRAPHICS_SPRITES, "main_menu_bg.png")), (SCREEN_WIDTH, SCREEN_HEIGHT) ).convert() # Title image self.title = pygame.image.load(os.path.join(PATH_GRAPHICS_SPRITES, "title.png")) # Load menu stuff. First, Boolean if it is open self.loadmenu_open = False tr = GlobalServices.getTextRenderer() self.loadmenu_caption = tr.writeAsSurface("Where do you want to pick up?", COLOR_TEXT, FONTSTYLE_CAPTION) back = tr.writeAsSurface("Back", COLOR_TEXT, FONTSTYLE_CAPTION) self.menu_backbutton = (back, pygame.Rect((500, 20), back.get_rect().size)) # The list of save game folders to choose from self.loadmenu_saves = [] # New game menu stuff. Boolean if it is open self.newgame_open = False self.newgame_caption = tr.writeAsSurface( "Enter a save game name. Proceed with Enter...", COLOR_TEXT, FONTSTYLE_CAPTION ) # List of characters that make up the save game name self.newgame_name = [] self.newgame_surf = tr.writeAsSurface("_") # Play BGM self.ad = GlobalServices.getAudioDevice() self.ad.play(MUSIC, "maincredit", VOLUME_MUSIC + 0.2, -1)
def __init__(self): ViewInterface.__init__(self) self.tr = GlobalServices.getTextRenderer() self.logo = self.tr.write("Loading", 0, COLOR_TEXT, (200, 200), FONTSTYLE_CAPTION) self.name = None self.img = pygame.image.load(os.path.join(PATH_GRAPHICS_SPRITES, "loading_screen_bg.png")).convert_alpha() self.pos = center_image(self.img)
def __init__(self): ViewInterface.__init__(self) # Renderer object that displays the map self.renderer = tiledtmxloader.helperspygame.RendererPygame() self.renderer.set_camera_position_and_size(200, 300, SCREEN_WIDTH, SCREEN_HEIGHT) # Reference to current map to be rendered (will be updated whenever the Game object posts a MapChangeEvent) self.currentmap = None # Reference to currently highlighted object (will be set by the view controller whenever that actually happens) self.highlighted = None # Reference to currently highlighted inventory item (only relevant when it's actually open) self.invitem = None # Boolean switch that depicts if the inventory is open or not self.inventory_open = False # Boolean switch that depicts if the game menu is open or not self.gamemenu_open = False self.darkened = OverlayFactory.create_by_color((0,0,0), 0, 200) self.backtogame = [GlobalServices.getTextRenderer().writeAsSurface(\ "Back to Game", COLOR_TEXT, FONTSTYLE_CAPTION),\ (100,300)] self.backtomainmenu = [GlobalServices.getTextRenderer().writeAsSurface(\ "Back to Main menu", COLOR_TEXT, FONTSTYLE_CAPTION),\ (100,328)] self.selected = None # Screen handle, used for screenshot saving self.screen_surface = None