Example #1
0
def handle_events():
    events = pc.get_events()
    for a in events:
        if a.type == pc.SDL_QUIT:
            game_framework.quit()

        # ESC 게임 종료
        if a.type == pc.SDL_KEYDOWN and a.key == pc.SDLK_ESCAPE:
            game_framework.quit()

        # 마우스 입력
        if a.type == pc.SDL_MOUSEBUTTONDOWN and a.button == 1:
            prc.set_mouse_input()
            MouseController.is_down = True
        elif a.type == pc.SDL_MOUSEBUTTONUP and a.button == 1:
            MouseController.is_down = False

        if a.type == pc.SDL_KEYDOWN:
            if a.key == 97:  # a
                KeyController.x -= 1
            if a.key == 100:  # d
                KeyController.x += 1

        if a.type == pc.SDL_KEYUP:
            if a.key == 97:  # a
                KeyController.x += 1
            if a.key == 100:  # d
                KeyController.x -= 1

        if a.type == pc.SDL_MOUSEMOTION:
            MouseController.mouse_input(a.x, a.y)

        if a.type == pc.SDL_KEYDOWN:
            if a.key == 97 or a.key == 100 or a.key == 115 or a.key == 119:
                prc.set_key_input()
Example #2
0
def enter():
    pc.SDL_SetRelativeMouseMode(pc.SDL_FALSE)  # 마우스 화면밖에 못나가게

    global bgm
    if (bgm == None):
        bgm = pc.load_music('sound/Win.mp3')
    bgm.set_volume(64)
    bgm.play()

    View.reset()

    global objsList
    if objsList == None:
        objsList = ObjsList()
    objsList.active()

    ready_remain_time = ready_time

    make_objs()

    if victory_img is not None:
        victory_img.pos[0] = 1920 // 2
        victory_img.pos[1] = 1080 - victory_img.get_halfsize()[1] + 100

    prc.reset()

    is_enter_before = True
Example #3
0
def draw():
    i = 0
    for view in View.views:
        pc.update_canvas()
        pc.clear_canvas()
        view.use()
        objsList.render(view.cam)

        text_pos = get_center()
        text_pos[1] -= 300
        prc.render_status(i, text_pos)

        i += 1
Example #4
0
def handle_events():
    events = pc.get_events()
    for a in events:
        if a.type == pc.SDL_QUIT:
            game_framework.quit()

        # ESC 게임 종료
        if a.type == pc.SDL_KEYDOWN and a.key == pc.SDLK_ESCAPE:
            game_framework.quit()

        # 마우스 입력
        if a.type == pc.SDL_MOUSEBUTTONDOWN and a.button == 1:
            prc.set_mouse_input()

        if a.type == pc.SDL_KEYDOWN:
            if a.key == 97 or a.key == 100 or a.key == 115 or a.key == 119:
                prc.set_key_input()
Example #5
0
def update(dt):  # View 각자의 그리기를 불러줌
    objsList.tick(dt)

    if prc.check_ready_status():
        global ready_remain_time
        ready_remain_time -= dt
        if ready_remain_time <= 0:
            ready_remain_time = -1
            game_framework.change_state(NextScene)
Example #6
0
def enter():
    pc.SDL_SetRelativeMouseMode(pc.SDL_FALSE)  # 마우스 화면밖에 못나가게
    KeyController.x = 0
    global bgm
    if (bgm == None):
        bgm = pc.load_music('sound/Title.mp3')
    bgm.set_volume(64)
    bgm.repeat_play()

    View.reset()
    global objsList
    if objsList == None:
        objsList = ObjsList()
    objsList.active()

    ready_remain_time = ready_time

    global is_enter_before
    if not is_enter_before:
        make_objs()

    prc.reset()

    is_enter_before = True