Files
OpenVulkano/openVulkanoCpp/Input/Touch/Gesture.hpp
2023-10-15 13:39:22 +02:00

49 lines
1.2 KiB
C++

/*
* 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 <cstdint>
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();
};
}