def __init__(self, level): self.ui = UI() self.level = level self.map = level.map self.menus = {} self.data = UIData() self.left, self.middle, self.right = (0,0,0) hover_graphic = Graphic(GFX_TILE_HOVER, 0.5) self.hover_tile = MapGraphic(hover_graphic, (0,0), "hover") self.highlight = Highlight(hover_graphic) self.status_window = StatusWindow(self.level.creatures) self.status_window = GraphicAbsPositioned(self.status_window, (0,0)) self.status_window.make_visible() # Status window drawn after sprites. self.ui.add(self.status_window) # Highlights drawn before sprites. self.ui.add_under(self.hover_tile) self.ui.add_under(self.highlight) #One menu showing at any time self.current_menu = None self.keybuffer = self.new_keybuffer() self.mouse_coords = (0,0) self.mouse_state = pygame.mouse.get_pressed() display = pygame.display.get_surface() self.h = display.get_height()
def load_graphics(self): self.ground_tile = Graphic(texture="./content/gfx/sprites/grass.png") self.setup_ground() for obj in self.obj_list: pos = self.obj_list[obj] animation = Animated("./content/gfx/sprites/" + obj + ".png", "./content/metadata/" + obj + ".spr") self.place_object(animation, pos, obj)
def load_portraits(self): for c in self.creatures: self.creatures[c].portrait = Graphic("./content/gfx/sprites/" + c + ".png")
def set_entry_hover_graphic(self, graphic): self.entry_hover_graphic = Graphic(graphic)
def set_body_graphic(self, graphic): self.body_graphic = Graphic(graphic)
def __init__(self, image, length=100.0): self.image = Graphic(image) self.base_length = float(length) self.image.w = self.base_length self.image.setup_draw() self.max_value = None
def setup_portraits(self): for c in self.table: self.portrait_list[c] = Graphic("./content/gfx/sprites/"+c+"_portrait.png")