fixing inputs bug, fixing missing depth image destruction in scenes

This commit is contained in:
2024-10-17 18:35:33 +02:00
parent 160364bda2
commit d0a74e79c5
15 changed files with 104 additions and 108 deletions

View File

@@ -6,14 +6,16 @@
namespace mlx
{
Inputs::Inputs()
void Inputs::FetchInputs()
{
SDLManager::Get().SetEventCallback([this](mlx_event_type event, int window_id, int code, [[maybe_unused]] void* userdata)
SDLManager::Get().InputsFetcher([this](mlx_event_type event, int window_id, int code)
{
if(m_windows.find(window_id) == m_windows.end())
if(!m_windows.contains(window_id))
return;
if(!m_events_hooks.contains(window_id) || !m_events_hooks[window_id][event].hook)
return;
m_events_hooks[window_id][event].hook(code, m_events_hooks[window_id][event].param);
}, nullptr);
});
}
std::int32_t Inputs::GetX() const noexcept

View File

@@ -7,9 +7,7 @@ namespace mlx
{
Window::Window(std::size_t w, std::size_t h, const std::string& title, bool hidden) : m_width(w), m_height(h)
{
static std::uint64_t ids = 0;
p_window = SDLManager::Get().CreateWindow(title, w, h, hidden);
m_id = ids++;
p_window = SDLManager::Get().CreateWindow(title, w, h, hidden, m_id);
}
void Window::Destroy() noexcept