Exemplo n.º 1
0
void InputHandler::update()
{
	//SDL_Event event;

	if (event.type != SDL_MOUSEMOTION)
	{
		MouseMoved = false;
	}

	while (SDL_PollEvent(&event))
	{
		switch (event.type)
		{
		case SDL_QUIT:
			TheGame::Instance()->quit();
			break;

		case SDL_JOYAXISMOTION:
			onJoystickAxisMove(event);
			break;

		case SDL_JOYBUTTONDOWN:
			onJoystickButtonDown(event);
			break;

		case SDL_JOYBUTTONUP:
			onJoystickButtonUp(event);
			break;

		case SDL_MOUSEMOTION:
			MouseMoved = true;
			onMouseMove(event);
			break;

		case SDL_MOUSEBUTTONDOWN:
			onMouseButtonDown(event);
			break;

		case SDL_MOUSEBUTTONUP:
			onMouseButtonUp(event);
			break;

		case SDL_KEYDOWN:
			onKeyDown();
			break;

		case SDL_KEYUP:
			onKeyUp();
			break;

		default:
			break;
		}
	}
}
Exemplo n.º 2
0
void InputHandler::update()
{
	SDL_Event event;

	while (SDL_PollEvent(&event))
	{
		switch (event.type)
		{
		case SDL_QUIT:
			Game::getInstance()->clean();
			break;

		case SDL_JOYAXISMOTION:
			onJoystickAxisMove(event);
			break;

		case SDL_JOYBUTTONDOWN:
			onJoystickButtonDown(event);
			break;

		case SDL_JOYBUTTONUP:
			onJoystickButtonUp(event);
			break;

		case SDL_MOUSEMOTION:
			onMouseMove(event);
			break;

		case SDL_MOUSEBUTTONDOWN:
			onMouseButtonDown(event);
			break;

		case SDL_MOUSEBUTTONUP:
			onMouseButtonUp(event);
			break;

		case SDL_KEYDOWN:
			onKeyDown();
			break;

		case SDL_KEYUP:
			onKeyUp();
			break;

		default:
			break;
		}

	}
}
void ManejadorEntrada::actualizar()
{
    SDL_Event evento;
    while(SDL_PollEvent(&evento))
    {
        switch (evento.type)
        {
            case SDL_QUIT:
                ElJuego::Instancia()->salir();
                break;

            case SDL_JOYAXISMOTION:
                onJoystickAxisMove(evento);
                break;

            case SDL_JOYBUTTONDOWN:
                onJoystickButtonDown(evento);
                break;

            case SDL_JOYBUTTONUP:
                onJoystickButtonUp(evento);
                break;

            case SDL_MOUSEMOTION:
                onMouseMove(evento);
                break;

            case SDL_MOUSEBUTTONDOWN:
                onMouseButtonDown(evento);
                break;

            case SDL_MOUSEBUTTONUP:
                onMouseButtonUp(evento);
                break;

            case SDL_KEYDOWN:
                onKeyDown();
                break;

            case SDL_KEYUP:
                onKeyUp();
                break;

            default:
                break;
        }
    }
}
Exemplo n.º 4
0
void InputHandler::update()
{
    SDL_Event event;
    m_keyStates = (Uint8*)SDL_GetKeyboardState(0);
    while(SDL_PollEvent(&event)){
        switch (event.type) {
            case SDL_QUIT:
                TheGame::Instance() -> quit();
                break;
            case SDL_JOYAXISMOTION:
                onJoystickAxisMove(event);
                break;
            case SDL_JOYBUTTONDOWN:
                onJoystickButtonDown(event);
                break;
            case SDL_JOYBUTTONUP:
                onJoystickButtonUp(event);
                break;
            case SDL_MOUSEMOTION:
                onMouseMove(event);
                break;
            case SDL_MOUSEBUTTONDOWN:
                onMouseButtonDown(event);
                break;
            case SDL_MOUSEBUTTONUP:
                onMouseButtonUp(event);
                break;
            case SDL_KEYDOWN:
                onKeyDown(event.key.keysym.scancode);
                break;
            case SDL_KEYUP:
                onKeyUp(event.key.keysym.scancode);
                break;
            default:
                break;
        }


    }

}