add no stbi build version

This commit is contained in:
Matthew 2025-12-16 18:02:10 +11:00
parent 617e03f917
commit 7f4c109106
2 changed files with 17 additions and 5 deletions

View File

@ -194,7 +194,14 @@ LoadImage(void* data, i32 size)
ImageData image; ImageData image;
i32 w, h, has_ch; i32 w, h, has_ch;
u8* image_bytes = stbi_load_from_memory(cast(const(u8)*)data, size, &w, &h, &has_ch, 4); version(NO_STBI)
{
u8* image_bytes;
}
else
{
u8* image_bytes = stbi_load_from_memory(cast(const(u8)*)data, size, &w, &h, &has_ch, 4);
}
if(w <= 0 || h <= 0 || has_ch <= 0) if(w <= 0 || h <= 0 || has_ch <= 0)
{ {
Logf("Failed to load image data"); Logf("Failed to load image data");
@ -213,7 +220,11 @@ LoadImage(void* data, i32 size)
void void
UnloadImage(ImageData* image) UnloadImage(ImageData* image)
{ {
stbi_image_free(image.data.ptr); version(NO_STBI) {}
else
{
stbi_image_free(image.data.ptr);
}
} }
ImageData ImageData

View File

@ -17,9 +17,10 @@
# include FT_GLYPH_H # include FT_GLYPH_H
#endif #endif
#include "external/stb/stb_image.h" #ifdef NO_STBI
# include "external/stb/stb_image.h"
#include "external/stb/stb_image_write.h" # include "external/stb/stb_image_write.h"
#endif
#define CGLM_FORCE_DEPTH_ZERO_TO_ONE #define CGLM_FORCE_DEPTH_ZERO_TO_ONE
#include "external/cglm/cglm.h" #include "external/cglm/cglm.h"