def __init__(self): Menu.__init__(self, 400, 300) self.panel = Panel(200, 150) self.add_widget(self.panel, (40, 80)) self.add_widget(MenuLabel(), (90, 20)) self.add_widget(Label('NonFocusable', focusable=False), (150, 20)) first_panel_label = Label('Panel0') self.panel.add_widget(first_panel_label, (40, 20)) self.panel.add_widget(Label('Panel1'), (120, 20)) self.panel.add_widget(Label('Panel2'), (40, 60)) self.panel.add_widget(Label('Panel3'), (120, 60)) self.panel.add_widget(AdjustableBar(100, 14, filled=0.9), (50, 100)) side_panel = Panel(110, 220) self.add_widget(side_panel, (260, 40)) grid = AdjustableVerticalGrid(110, 72, 2, 6) side_panel.add_widget(grid, AlignTopLeft()) img = pygame.image.load(data_path('icon.png')) #img = pygame.image.load(data_path('test.png')) self.add_widget(ImageWidget(img), (8, 8)) group = WidgetGroup(148, 20) group.add_widget(Label('Group0'), (10, 0)) group.add_widget(Label('Group1'), (90, 0)) self.add_widget(group, (60, 240)) #self.crystallize() # Add cursor cursor = Cursor() cursor.bind(self, first_panel_label)
def init(game_name='LibRPG Game', icon=None): pygame.init() sound.init() if icon is not None: icon = pygame.image.load(icon) else: icon = pygame.image.load(path.data_path('icon.png')) pygame.display.set_icon(icon) virtualscreen.init(config.graphics_config.real_screen_dimensions, config.graphics_config.display_mode, config.graphics_config.screen_dimensions, config.graphics_config.scale) pygame.display.set_caption(game_name)