working on window manager

This commit is contained in:
2022-10-05 20:37:04 +02:00
parent 3ee3a5899b
commit b275918de6
10 changed files with 83 additions and 24 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */
/* Updated: 2022/10/05 14:02:27 by maldavid ### ########.fr */
/* Updated: 2022/10/05 18:45:52 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -26,11 +26,11 @@ extern "C"
__main_app.reset(new mlx::core::Application());
}
void mlx_new_window(int w, int h, const char* title)
void* mlx_new_window(int w, int h, const char* title)
{
if(__main_app == nullptr)
mlx::core::error::report(e_kind::fatal_error, "You must initialize the mlx before you can create new windows");
__main_app->new_window(w, h, title);
return __main_app->new_window(w, h, title);
}
int mlx_loop()
@@ -39,4 +39,30 @@ extern "C"
mlx::core::error::report(e_kind::fatal_error, "You must initialize the mlx before you can run the main loop");
__main_app->run();
}
int mlx_mouse_show()
{
if(__main_app == nullptr)
mlx::core::error::report(e_kind::fatal_error, "You must initialize the mlx before you can modify the cursor");
return SDL_ShowCursor(SDL_ENABLE);
}
int mlx_mouse_hide()
{
if(__main_app == nullptr)
mlx::core::error::report(e_kind::fatal_error, "You must initialize the mlx before you can modify the cursor");
return SDL_ShowCursor(SDL_DISABLE);
}
int mlx_mouse_move(void* win_ptr, int x, int y)
{
if(__main_app == nullptr)
mlx::core::error::report(e_kind::fatal_error, "You must initialize the mlx before you can modify the mouse");
}
int mlx_mouse_get_pos(void* win_ptr, int* x, int* y)
{
if(__main_app == nullptr)
mlx::core::error::report(e_kind::fatal_error, "You must initialize the mlx before you can access to the mouse");
}
}