class UI: def __init__(self): self.window_manager = WindowManager() self.create_world_map() self.create_bar() BAR_SIZE = 200 def create_world_map(self): self.map_sf = create_surface( self.window_manager.main_window.get_width(), self.window_manager.main_window.get_height() - self.BAR_SIZE) self.window_manager.add_redraw_element(RedrawSurface( lambda : self.render_global_map(), 0, 0) ) def set_current_level(self, level, camera_x, camera_y): self.current_level = level self.camera_x = camera_x self.camera_y = camera_y def render_global_map(self): return render_map(self.map_sf, self.current_level, self.camera_x, self.camera_y) def create_bar(self): self.bar_surface = create_surface( self.window_manager.main_window.get_width(), self.BAR_SIZE) self.window_manager.add_redraw_element(RedrawSurface( lambda : self.render_bar(), 0, self.window_manager.main_window.get_height() - self.BAR_SIZE) ) def render_bar(self): self.bar_surface.fill(Color("Black")) lines =["Str : ", "Dex : ", "Int :"] font_info = FontInfo(name = "Arial", size = 24, italic=True, fcolor = Color("DarkGreen"), bcolor = Color("Black")) RenderText.render_column(lines, font_info, self.bar_surface) return self.bar_surface
def __init__(self): self.window_manager = WindowManager() self.create_world_map() self.create_bar()