implement ray casting events

This commit is contained in:
ohyzha
2024-11-04 18:22:40 +02:00
parent 4956884d5f
commit 7febb370a8
9 changed files with 176 additions and 5 deletions

View File

@@ -8,6 +8,7 @@
#include "InputDevice.hpp"
#include "Math/Math.hpp"
#include "Base/Event.hpp"
namespace OpenVulkano
{
@@ -143,6 +144,9 @@ namespace OpenVulkano
{
return window == lastWindow;
}
Event<Math::Vector2i> onLeftButtonClick;
};
}
}

View File

@@ -85,6 +85,18 @@ namespace OpenVulkano::Input
return false;
}
InputDevice* InputManager::GetDevice(InputDeviceType type) const
{
for (InputDevice* device: devices)
{
if (device->GetType() == type && type != InputDeviceType::UNKNOWN)
{
return device;
}
}
return nullptr;
}
void InputManager::Tick()
{
for(InputDevice* device : devices)

View File

@@ -42,6 +42,8 @@ namespace OpenVulkano::Input
[[nodiscard]] bool GetButton(InputKey key) const;
[[nodiscard]] InputDevice* GetDevice(InputDeviceType type) const;
[[nodiscard]] InputDevice* GetLastActiveDevice() const
{
return lastActiveDevice;

View File

@@ -84,5 +84,6 @@ namespace OpenVulkano::Input
[[nodiscard]] bool IsMultiTouch() const { return m_multiTouch; }
Event<Touch&> OnTouchAdded, OnTouchDown, OnTouchUp, OnTouchMoved, OnTouchRemoved;
Event<Math::Vector2i> OnTap;
};
}