mirror of https://github.com/bjornbytes/lovr.git
Use defines to shrink stb_image footprint;
This commit is contained in:
parent
7f158a3473
commit
3d691ed087
|
@ -86,9 +86,15 @@ void lovrGraphicsCreateWindow(int w, int h, bool fullscreen, int msaa, const cha
|
|||
|
||||
if (icon) {
|
||||
GLFWimage image;
|
||||
image.pixels = stbi_load(icon, &image.width, &image.height, NULL, 3);
|
||||
size_t size;
|
||||
lovrAssert(lovrFilesystemIsFile(icon), "Could not read icon from %s", icon);
|
||||
void* data = lovrFilesystemRead(icon, &size);
|
||||
lovrAssert(data, "Could not read icon from %s", icon);
|
||||
image.pixels = stbi_load_from_memory(data, size, &image.width, &image.height, NULL, 4);
|
||||
lovrAssert(image.pixels, "Could not read icon from %s", icon);
|
||||
glfwSetWindowIcon(state.window, 1, &image);
|
||||
free(image.pixels);
|
||||
free(data);
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(state.window);
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#define STBI_NO_STDIO
|
||||
#define STBI_ONLY_JPEG
|
||||
#define STBI_ONLY_PNG
|
||||
#define STBI_ONLY_HDR
|
||||
#include "stb_image.h"
|
||||
|
|
Loading…
Reference in New Issue