ButtonStatus
DecafSDL::getButtonStatus(vpad::Channel channel, vpad::Core button)
{
   if (!mVpad0Config) {
      return ButtonStatus::ButtonReleased;
   }

   switch (mVpad0Config->type) {
   case config::input::None:
      break;

   case config::input::Keyboard:
   {
      int numKeys = 0;
      auto scancode = getKeyboardButtonMapping(mVpad0Config, channel, button);
      auto state = SDL_GetKeyboardState(&numKeys);

      if (scancode >= 0 && scancode < numKeys && state[scancode]) {
         return ButtonStatus::ButtonPressed;
      }

      break;
   }

   case config::input::Joystick:
      if (mVpad0Controller && SDL_GameControllerGetAttached(mVpad0Controller)) {
         if (getJoystickButtonState(mVpad0Config, mVpad0Controller, channel, button)) {
            return ButtonStatus::ButtonPressed;
         }
      }
      break;
   }

   return ButtonStatus::ButtonReleased;
}
Beispiel #2
0
	void InputSystem::resetOldKeys()
	{
#ifndef PLATFORM_WP8
		for(int i = 0; i < 256; ++i)
		{
			m_oldKeys[i] = getKeyState((KeyboardKey)i);
		}

		for(int i = 0; i < 128; ++i)
		{
			m_oldJoystickButtons[i] = getJoystickButtonState(i);
		}

		for(int i = 0; i < 4; ++i)
		{
			m_oldButtons[i] = getMouseButtonState((MouseButton)i);
		}
#else
		for(int i = 0; i < INPUT_SUPPORTED_TOUCH_COUNT; ++i)
		{
			m_oldTouchList[i] = m_touchList[i];
		}
#endif
	}
Beispiel #3
0
	bool InputSystem::isJoystickButtonUp(int k)
	{
		return (!getJoystickButtonState(k));
	}
Beispiel #4
0
	bool InputSystem::isJoystickButtonDown(int k)
	{
		return (getJoystickButtonState(k));
	}