/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #pragma once #include namespace OpenVulkano::Input { class Touch; class GestureProcessor; class Gesture { friend class GestureProcessor; uint32_t m_gestureType = -1; bool m_active = false; GestureProcessor* m_processor = nullptr; public: static constexpr uint32_t TYPE_TAP = 0; static constexpr uint32_t TYPE_PAN = 1; static constexpr uint32_t TYPE_PINCH = 2; Gesture(uint32_t gestureType) : m_gestureType(gestureType) {} virtual ~Gesture() = default; virtual void Cancel() {} virtual void Reset() {} virtual void TouchDown(const Touch& touch) {} virtual void TouchUp(const Touch& touch) {} virtual void TouchMoved(const Touch& touch) {} void SetActive(bool active) { m_active = active; } [[nodiscard]] bool IsActive() const { return m_active; } [[nodiscard]] uint32_t GetType() const { return m_gestureType; } // Impl in GestureProcessor.cpp bool ResolveConflicts(); void RemoveFromProcessor(); }; }