implement ray casting events
This commit is contained in:
@@ -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;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user