コード例 #1
0
def minimal_setup_for_game():
    pg.init()
    font.init_fonts()
    # Window parameters
    pg.display.set_mode((MAIN_WIN_WIDTH, MAIN_WIN_HEIGHT))
    # Load some data
    races = Loader.load_races()
    classes = Loader.load_classes()
    Character.init_data(races, classes)
コード例 #2
0
 def setUpClass(cls):
     super(TestStartScreen, cls).setUpClass()
     pg.init()
     font.init_fonts()
     cls.save_url = "saves/main_save.xml"
     cls.level_class = Level
     cls.buttons = []
     cls.buttons.append(Rect(NEW_GAME_BUTTON_POS[0], NEW_GAME_BUTTON_POS[1], BUTTON_SIZE[0], BUTTON_SIZE[1]))
     cls.buttons.append(Rect(LOAD_GAME_BUTTON_POS[0], LOAD_GAME_BUTTON_POS[1], BUTTON_SIZE[0], BUTTON_SIZE[1]))
     cls.buttons.append(Rect(OPTIONS_BUTTON_POS[0], NEW_GAME_BUTTON_POS[1], BUTTON_SIZE[0], BUTTON_SIZE[1]))
     cls.buttons.append(Rect(EXIT_GAME_BUTTON_POS[0], NEW_GAME_BUTTON_POS[1], BUTTON_SIZE[0], BUTTON_SIZE[1]))
     races = Loader.load_races()
     classes = Loader.load_classes()
     Character.init_data(races, classes)
コード例 #3
0
    # Window parameters
    pg.display.set_caption("In the name of the Five Cats")
    screen = pg.display.set_mode((MAIN_WIN_WIDTH, MAIN_WIN_HEIGHT))

    # Load constant sprites
    Destroyable.init_constant_sprites()
    Breakable.init_constant_sprites()
    Movable.init_constant_sprites()
    Sidebar.init_constant_sprites()
    Level.init_constant_sprites()

    # Load some data
    races = Loader.load_races()
    classes = Loader.load_classes()
    Character.init_data(races, classes)

    clock = pg.time.Clock()

    start_screen = StartScreen(screen)

    quit_game = False
    while not quit_game:
        for e in pg.event.get():
            if e.type == pg.QUIT:
                quit_game = True
            elif e.type == pg.MOUSEMOTION:
                start_screen.motion(e.pos)
            elif e.type == pg.MOUSEBUTTONUP:
                if e.button == 1 or e.button == 3:
                    quit_game = start_screen.click(e.button, e.pos)