mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
working on xpm implementation
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/03 14:18:50 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/04 13:44:12 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -57,9 +57,9 @@ extern "C"
|
||||
return SDL_ShowCursor(SDL_DISABLE);
|
||||
}
|
||||
|
||||
int mlx_mouse_move(void* mlx, void* win_ptr, int x, int y)
|
||||
int mlx_mouse_move(void* mlx, void* win, int x, int y)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx)->mouseMove(win_ptr, x, y);
|
||||
static_cast<mlx::core::Application*>(mlx)->mouseMove(win, x, y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -86,24 +86,24 @@ extern "C"
|
||||
return static_cast<mlx::core::Application*>(mlx)->newTexture(width, height);
|
||||
}
|
||||
|
||||
char* mlx_get_data_addr(void* mlx, void* img_ptr, int* bits_per_pixel, int* size_line, int* endian)
|
||||
char* mlx_get_data_addr(void* mlx, void* img, int* bits_per_pixel, int* size_line, int* endian)
|
||||
{
|
||||
return static_cast<mlx::core::Application*>(mlx)->mapTexture(img_ptr, bits_per_pixel, size_line, endian);
|
||||
return static_cast<mlx::core::Application*>(mlx)->mapTexture(img, bits_per_pixel, size_line, endian);
|
||||
}
|
||||
|
||||
int mlx_put_image_to_window(void* mlx_ptr, void* win_ptr, void* img_ptr, int x, int y)
|
||||
int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx_ptr)->texturePut(win_ptr, img_ptr, x, y);
|
||||
static_cast<mlx::core::Application*>(mlx)->texturePut(win, img, x, y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mlx_destroy_image(void* mlx_ptr, void* img_ptr)
|
||||
int mlx_destroy_image(void* mlx, void* img)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx_ptr)->destroyTexture(img_ptr);
|
||||
static_cast<mlx::core::Application*>(mlx)->destroyTexture(img);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* mlx_png_file_to_image(void* mlx_ptr, char* filename, int* width, int* height)
|
||||
void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||
{
|
||||
std::filesystem::path file(filename);
|
||||
if(file.extension() != ".png")
|
||||
@@ -111,10 +111,10 @@ extern "C"
|
||||
mlx::core::error::report(e_kind::error, "PNG loader : not a png file '%s'", filename);
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<mlx::core::Application*>(mlx_ptr)->newStbTexture(filename, width, height);
|
||||
return static_cast<mlx::core::Application*>(mlx)->newStbTexture(filename, width, height);
|
||||
}
|
||||
|
||||
void* mlx_jpg_file_to_image(void* mlx_ptr, char* filename, int* width, int* height)
|
||||
void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||
{
|
||||
std::filesystem::path file(filename);
|
||||
if(file.extension() != ".jpg" && file.extension() != ".jpeg")
|
||||
@@ -122,10 +122,10 @@ extern "C"
|
||||
mlx::core::error::report(e_kind::error, "PNG loader : not a jpg file '%s'", filename);
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<mlx::core::Application*>(mlx_ptr)->newStbTexture(filename, width, height);
|
||||
return static_cast<mlx::core::Application*>(mlx)->newStbTexture(filename, width, height);
|
||||
}
|
||||
|
||||
void* mlx_bmp_file_to_image(void* mlx_ptr, char* filename, int* width, int* height)
|
||||
void* mlx_bmp_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||
{
|
||||
std::filesystem::path file(filename);
|
||||
if(file.extension() != ".bmp" && file.extension() != ".dib")
|
||||
@@ -133,24 +133,34 @@ extern "C"
|
||||
mlx::core::error::report(e_kind::error, "PNG loader : not a jpg file '%s'", filename);
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<mlx::core::Application*>(mlx_ptr)->newStbTexture(filename, width, height);
|
||||
return static_cast<mlx::core::Application*>(mlx)->newStbTexture(filename, width, height);
|
||||
}
|
||||
|
||||
int mlx_pixel_put(void* mlx, void* win_ptr, int x, int y, int color)
|
||||
void* mlx_xpm_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx)->pixelPut(win_ptr, x, y, color);
|
||||
//return static_cast<mlx::core::Application*>(mlx)->newXpmTexture(filename, width, height);
|
||||
}
|
||||
|
||||
void* mlx_xpm_to_image(void* mlx, char** xpm_data, int* width, int* height)
|
||||
{
|
||||
return static_cast<mlx::core::Application*>(mlx)->newXpmTexture(xpm_data, width, height);
|
||||
}
|
||||
|
||||
int mlx_pixel_put(void* mlx, void* win, int x, int y, int color)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx)->pixelPut(win, x, y, color);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mlx_clear_window(void* mlx_ptr, void* win_ptr)
|
||||
int mlx_clear_window(void* mlx, void* win)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx_ptr)->clearGraphicsSupport(win_ptr);
|
||||
static_cast<mlx::core::Application*>(mlx)->clearGraphicsSupport(win);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mlx_destroy_window(void* mlx, void* win_ptr)
|
||||
int mlx_destroy_window(void* mlx, void* win)
|
||||
{
|
||||
static_cast<mlx::core::Application*>(mlx)->destroyGraphicsSupport(win_ptr);
|
||||
static_cast<mlx::core::Application*>(mlx)->destroyGraphicsSupport(win);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user