adding graphics support class, refactoring the code

This commit is contained in:
kbz_8
2023-04-02 17:37:38 +02:00
parent 534bea942c
commit 7a5e280322
14 changed files with 318 additions and 148 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: 2023/04/01 17:48:21 by maldavid ### ########.fr */
/* Updated: 2023/04/02 15:10:44 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -25,12 +25,12 @@ extern "C"
void* mlx_new_window(void* mlx, int w, int h, const char* title)
{
return static_cast<mlx::core::Application*>(mlx)->new_window(w, h, title);
return static_cast<mlx::core::Application*>(mlx)->newGraphicsSuport(w, h, title);
}
int mlx_loop_hook(void* mlx, int (*f)(void*), void* param)
{
static_cast<mlx::core::Application*>(mlx)->loop_hook(f, param);
static_cast<mlx::core::Application*>(mlx)->loopHook(f, param);
return 0;
}
@@ -42,7 +42,7 @@ extern "C"
int mlx_loop_end(void* mlx)
{
static_cast<mlx::core::Application*>(mlx)->loop_end();
static_cast<mlx::core::Application*>(mlx)->loopEnd();
return 0;
}
@@ -58,48 +58,48 @@ extern "C"
int mlx_mouse_move(void* mlx, void* win_ptr, int x, int y)
{
static_cast<mlx::core::Application*>(mlx)->mouse_move(win_ptr, x, y);
static_cast<mlx::core::Application*>(mlx)->mouseMove(win_ptr, x, y);
return 0;
}
int mlx_mouse_get_pos(void* mlx, int* x, int* y)
{
static_cast<mlx::core::Application*>(mlx)->get_mouse_pos(x, y);
static_cast<mlx::core::Application*>(mlx)->getMousePos(x, y);
return 0;
}
int mlx_put_image_to_window(void* mlx_ptr, void* win_ptr, void* img_ptr, int x, int y)
{
static_cast<mlx::core::Application*>(mlx_ptr)->texture_put(win_ptr, img_ptr, x, y);
static_cast<mlx::core::Application*>(mlx_ptr)->texturePut(win_ptr, img_ptr, x, y);
return 0;
}
int mlx_destroy_image(void* mlx_ptr, void* img_ptr)
{
static_cast<mlx::core::Application*>(mlx_ptr)->destroy_texture(img_ptr);
static_cast<mlx::core::Application*>(mlx_ptr)->destroyTexture(img_ptr);
return 0;
}
void* mlx_png_file_to_image(void* mlx_ptr, char* filename, int* width, int* height)
{
return static_cast<mlx::core::Application*>(mlx_ptr)->new_stb_texture(filename, width, height);
return static_cast<mlx::core::Application*>(mlx_ptr)->newStbTexture(filename, width, height);
}
int mlx_pixel_put(void* mlx, void* win_ptr, int x, int y, int color)
{
static_cast<mlx::core::Application*>(mlx)->pixel_put(win_ptr, x, y, color);
static_cast<mlx::core::Application*>(mlx)->pixelPut(win_ptr, x, y, color);
return 0;
}
int mlx_clear_window(void* mlx_ptr, void* win_ptr)
{
static_cast<mlx::core::Application*>(mlx_ptr)->clear_window(win_ptr);
static_cast<mlx::core::Application*>(mlx_ptr)->clearGraphicsSupport(win_ptr);
return 0;
}
int mlx_destroy_window(void* mlx, void* win_ptr)
{
static_cast<mlx::core::Application*>(mlx)->destroy_window(win_ptr);
static_cast<mlx::core::Application*>(mlx)->destroyGraphicsSupport(win_ptr);
return 0;
}