| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- // Implementation of base platform-agnostic platform functionality.
- #include "Base.h"
- #include "Platform.h"
- #include "Game.h"
- #include "ScriptController.h"
- #include "Form.h"
- namespace gameplay
- {
- void Platform::touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex, bool actuallyMouse)
- {
- if (actuallyMouse || !Form::touchEventInternal(evt, x, y, contactIndex))
- {
- Game::getInstance()->touchEventInternal(evt, x, y, contactIndex);
- }
- }
- void Platform::keyEventInternal(Keyboard::KeyEvent evt, int key)
- {
- if (!Form::keyEventInternal(evt, key))
- {
- Game::getInstance()->keyEventInternal(evt, key);
- }
- }
- bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
- {
- if (Form::mouseEventInternal(evt, x, y, wheelDelta))
- return true;
- return Game::getInstance()->mouseEventInternal(evt, x, y, wheelDelta);
- }
- void Platform::gestureSwipeEventInternal(int x, int y, int direction)
- {
- // TODO: Add support to Form for gestures
- Game::getInstance()->gestureSwipeEventInternal(x, y, direction);
- }
- void Platform::gesturePinchEventInternal(int x, int y, float scale)
- {
- // TODO: Add support to Form for gestures
- Game::getInstance()->gesturePinchEventInternal(x, y, scale);
- }
- void Platform::gestureTapEventInternal(int x, int y)
- {
- // TODO: Add support to Form for gestures
- Game::getInstance()->gestureTapEventInternal(x, y);
- }
- void Platform::gestureLongTapEventInternal(int x, int y, float duration)
- {
- // TODO: Add support to Form for gestures
- Game::getInstance()->gestureLongTapEventInternal(x, y, duration);
- }
- void Platform::gestureDragEventInternal(int x, int y)
- {
- // TODO: Add support to Form for gestures
- Game::getInstance()->gestureDragEventInternal(x, y);
- }
- void Platform::gestureDropEventInternal(int x, int y)
- {
- // TODO: Add support to Form for gestures
- Game::getInstance()->gestureDropEventInternal(x, y);
- }
- void Platform::resizeEventInternal(unsigned int width, unsigned int height)
- {
- Game::getInstance()->resizeEventInternal(width, height);
- Form::resizeEventInternal(width, height);
- }
- void Platform::gamepadEventInternal(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned int analogIndex)
- {
- if (!Form::gamepadEventInternal(evt, gamepad, analogIndex))
- {
- Game::getInstance()->gamepadEventInternal(evt, gamepad, analogIndex);
- }
- }
- void Platform::gamepadEventConnectedInternal(GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
- unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString)
- {
- Gamepad::add(handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
- }
- void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
- {
- Gamepad::remove(handle);
- }
- }
|