mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
working input API
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/12 11:14:24 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/12 19:34:45 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace mlx::core
|
||||
inline void getMousePos(int* x, int* y) noexcept;
|
||||
inline void mouseMove(void* win, int x, int y) noexcept;
|
||||
|
||||
inline void onEvent(int event, int (*funct_ptr)(int, void*), void* param) noexcept;
|
||||
inline void onEvent(void* win, int event, int (*funct_ptr)(int, void*), void* param) noexcept;
|
||||
|
||||
inline constexpr void enableAutoRepeat() noexcept;
|
||||
inline constexpr void disableAutoRepeat() noexcept;
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace mlx::core
|
||||
SDL_FlushEvent(SDL_MOUSEMOTION);
|
||||
}
|
||||
|
||||
void Application::onEvent(int event, int (*funct_ptr)(int, void*), void* param) noexcept
|
||||
void Application::onEvent(void* win, int event, int (*funct_ptr)(int, void*), void* param) noexcept
|
||||
{
|
||||
_in->onEvent(event, funct_ptr, param);
|
||||
_in->onEvent(_graphics[*static_cast<int*>(win)]->getWindow()->getID(), event, funct_ptr, param);
|
||||
}
|
||||
|
||||
constexpr void Application::enableAutoRepeat() noexcept
|
||||
@@ -53,6 +53,7 @@ namespace mlx::core
|
||||
void* Application::newGraphicsSuport(std::size_t w, std::size_t h, std::string title)
|
||||
{
|
||||
_graphics.emplace_back(std::make_unique<GraphicsSupport>(w, h, std::move(title), _graphics.size()));
|
||||
_in->addWindow(_graphics.back()->getWindow());
|
||||
return static_cast<void*>(&_graphics.back()->getID());
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/12 11:16:52 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/12 19:34:22 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -69,9 +69,9 @@ extern "C"
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mlx_on_event(void* mlx, int event, int (*funct_ptr)(int, void*), void* param)
|
||||
int mlx_on_event(void* mlx, void* win, int event, int (*funct_ptr)(int, void*), void* param)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx)->onEvent(event, funct_ptr, param);
|
||||
static_cast<mlx::core::Application*>(mlx)->onEvent(win, event, funct_ptr, param);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user