mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
working on endianness with vulkan images
This commit is contained in:
@@ -126,7 +126,7 @@ extern "C"
|
||||
gs->GetWindow()->GetSize(x, y);
|
||||
}
|
||||
|
||||
void mlx_clear_window(mlx_context mlx, mlx_window win, int color)
|
||||
void mlx_clear_window(mlx_context mlx, mlx_window win, mlx_color color)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
@@ -201,7 +201,7 @@ extern "C"
|
||||
mlx->app->OnEvent(win, static_cast<int>(event), funct_ptr, param);
|
||||
}
|
||||
|
||||
void mlx_pixel_put(mlx_context mlx, mlx_window win, int x, int y, int color)
|
||||
void mlx_pixel_put(mlx_context mlx, mlx_window win, int x, int y, mlx_color color)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
@@ -248,16 +248,16 @@ extern "C"
|
||||
mlx->app->DestroyTexture(image);
|
||||
}
|
||||
|
||||
int mlx_get_image_pixel(mlx_context mlx, mlx_image image, int x, int y)
|
||||
mlx_color mlx_get_image_pixel(mlx_context mlx, mlx_image image, int x, int y)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::Texture> texture = mlx->app->GetTexture(image);
|
||||
if(!texture)
|
||||
return 0;
|
||||
return { .rgba = 0x00000000 };
|
||||
return texture->GetPixel(x, y);
|
||||
}
|
||||
|
||||
void mlx_set_image_pixel(mlx_context mlx, mlx_image image, int x, int y, int color)
|
||||
void mlx_set_image_pixel(mlx_context mlx, mlx_image image, int x, int y, mlx_color color)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::Texture> texture = mlx->app->GetTexture(image);
|
||||
@@ -278,7 +278,7 @@ extern "C"
|
||||
gs->TexturePut(texture, x, y, 1.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
void mlx_string_put(mlx_context mlx, mlx_window win, int x, int y, int color, char* str)
|
||||
void mlx_string_put(mlx_context mlx, mlx_window win, int x, int y, mlx_color color, char* str)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
@@ -381,7 +381,7 @@ extern "C"
|
||||
gs->GetWindow()->Restore();
|
||||
}
|
||||
|
||||
void mlx_pixel_put_array(mlx_context mlx, mlx_window win, int x, int y, int* pixels, size_t pixels_size)
|
||||
void mlx_pixel_put_array(mlx_context mlx, mlx_window win, int x, int y, mlx_color* pixels, size_t pixels_size)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
@@ -390,7 +390,7 @@ extern "C"
|
||||
gs->PixelPutArray(x, y, pixels, pixels_size);
|
||||
}
|
||||
|
||||
void mlx_pixel_put_region(mlx_context mlx, mlx_window win, int x, int y, int w, int h, int* pixels)
|
||||
void mlx_pixel_put_region(mlx_context mlx, mlx_window win, int x, int y, int w, int h, mlx_color* pixels)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::GraphicsSupport> gs = mlx->app->GetGraphicsSupport(win);
|
||||
@@ -399,7 +399,7 @@ extern "C"
|
||||
gs->PixelPutRegion(x, y, w, h, pixels);
|
||||
}
|
||||
|
||||
void mlx_get_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, int* dst)
|
||||
void mlx_get_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color* dst)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::Texture> texture = mlx->app->GetTexture(image);
|
||||
@@ -408,7 +408,7 @@ extern "C"
|
||||
texture->GetRegion(x, y, w, h, dst);
|
||||
}
|
||||
|
||||
void mlx_set_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, int* pixels)
|
||||
void mlx_set_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color* pixels)
|
||||
{
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
mlx::NonOwningPtr<mlx::Texture> texture = mlx->app->GetTexture(image);
|
||||
|
||||
@@ -2,21 +2,10 @@
|
||||
#include <Core/SDLManager.h>
|
||||
#include <Core/Memory.h>
|
||||
#include <Embedded/IconMlx.h>
|
||||
#include <Utils/Bits.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
constexpr const std::uint32_t rmask = 0xff000000;
|
||||
constexpr const std::uint32_t gmask = 0x00ff0000;
|
||||
constexpr const std::uint32_t bmask = 0x0000ff00;
|
||||
constexpr const std::uint32_t amask = 0x000000ff;
|
||||
#else
|
||||
constexpr const std::uint32_t rmask = 0x000000ff;
|
||||
constexpr const std::uint32_t gmask = 0x0000ff00;
|
||||
constexpr const std::uint32_t bmask = 0x00ff0000;
|
||||
constexpr const std::uint32_t amask = 0xff000000;
|
||||
#endif
|
||||
|
||||
namespace Internal
|
||||
{
|
||||
struct WindowInfos
|
||||
@@ -65,7 +54,7 @@ namespace mlx
|
||||
infos->window = SDL_CreateWindow(info->title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, info->width, info->height, flags);
|
||||
if(!infos->window)
|
||||
FatalError("SDL: unable to open a new window; %", SDL_GetError());
|
||||
infos->icon = SDL_CreateRGBSurfaceFrom(static_cast<void*>(logo_mlx), logo_mlx_width, logo_mlx_height, 32, 4 * logo_mlx_width, rmask, gmask, bmask, amask);
|
||||
infos->icon = SDL_CreateRGBSurfaceFrom(static_cast<void*>(logo_mlx), logo_mlx_width, logo_mlx_height, 32, 4 * logo_mlx_width, Rmask(), Gmask(), Bmask(), Amask());
|
||||
SDL_SetWindowIcon(infos->window, infos->icon);
|
||||
|
||||
m_windows_registry.insert(infos);
|
||||
|
||||
Reference in New Issue
Block a user