Exemple #1
0
void InputListener::onEvent(const sf::Event& event)
{
	switch (event.type)
	{
		/* Window */
		case sf::Event::LostFocus:               onFocusLost();                                   break;
		case sf::Event::GainedFocus:             onFocusGained();                                 break;
		case sf::Event::Closed:                  onWindowClosed();                                break;
		case sf::Event::Resized:                 onWindowResized(event.size);                     break;
			
		/* Keyboard */
		case sf::Event::TextEntered:             onTextEntered(event.text);                       break;
		case sf::Event::KeyPressed:              onKeyPressed(event.key);                         break;
		case sf::Event::KeyReleased:             onKeyReleased(event.key);                        break;
			
		/* Mouse */
		case sf::Event::MouseEntered:            onMouseEntered();                                break;
		case sf::Event::MouseLeft:               onMouseLeft();                                   break;
		case sf::Event::MouseMoved:              onMouseMoved(event.mouseMove);                   break;
		case sf::Event::MouseWheelMoved:         onMouseWheelMoved(event.mouseWheel);             break;
		case sf::Event::MouseButtonPressed:      onMouseButtonPressed(event.mouseButton);         break;
		case sf::Event::MouseButtonReleased:     onMouseButtonReleased(event.mouseButton);        break;
			
		/* Joystick */
		case sf::Event::JoystickConnected:       onJoystickConnected(event.joystickConnect);      break;
		case sf::Event::JoystickDisconnected:    onJoystickDisconnected(event.joystickConnect);   break;
		case sf::Event::JoystickButtonPressed:   onJoystickButtonPressed(event.joystickButton);   break;
		case sf::Event::JoystickButtonReleased:  onJoystickButtonReleased(event.joystickButton);  break;
		case sf::Event::JoystickMoved:           onJoystickMoved(event.joystickMove);             break;
			
		default:
			Logger::log("Warning", "Unknow event type: %d", event.type);
			break;
	}
}
Exemple #2
0
void SFMLInputSource::dispatchOne(sf::Event const& event) {
    switch (event.type) {
    case sf::Event::KeyPressed:
        onKeyPressed(event.key);
        break;

    case sf::Event::KeyReleased:
        onKeyReleased(event.key);
        break;

    case sf::Event::MouseButtonPressed:
        onMouseButtonPressed(event.mouseButton);
        break;

    case sf::Event::MouseButtonReleased:
        onMouseButtonReleased(event.mouseButton);
        break;

    case sf::Event::MouseMoved:
        onMouseMoved(event.mouseMove);
        break;

    case sf::Event::MouseWheelMoved:
        onMouseWheelMoved(event.mouseWheel);
        break;

    default:
        break;
    }
}
	void TextureControl::notifyMouseButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
	{
		if (_id == MyGUI::MouseButton::Right)
		{
			mMouseCapture = false;

			mTexture->setPointer("arrow");
			MyGUI::PointerManager::getInstance().setPointer("arrow");
			MyGUI::PointerManager::getInstance().eventChangeMousePointer("arrow");
		}
		else if (_id == MyGUI::MouseButton::Left)
		{
			if (!mMouseCapture && mMouseLeftPressed)
			{
				mMouseLeftPressed = false;
				onMouseButtonClick(getMousePosition());
			}
			onMouseButtonReleased(getMousePosition());
		}
	}
Exemple #4
0
bool Clickable::handleClick(const sf::Event::MouseButtonEvent &event,
                            sf::Event::EventType eventType) {
  if (isMouseEventInInterior(event)) {
    auto button = event.button;
    switch (eventType) {
    case sf::Event::MouseButtonPressed:
      MouseData::instance()->setPressed(this, button);
      onMouseButtonPressed(button);
      break;
    case sf::Event::MouseButtonReleased:
      onMouseButtonReleased(button);
      if (MouseData::instance()->setReleased(this, button)) {
        onMouseButtonClicked(button);
      }
      break;
    default:
      assert(!"Unhandled Enum Value");
    };
    return true;
  }
  return false;
}
Exemple #5
0
	void WidgetInput::_riseMouseButtonReleased(int _left, int _top, MouseButton _id)
	{
		onMouseButtonReleased(_left, _top, _id);
		eventMouseButtonReleased(static_cast<Widget*>(this), _left, _top, _id);
	}