diff --git a/desktop_version/src/GraphicsResources.cpp b/desktop_version/src/GraphicsResources.cpp index a6455fcf..743f9f39 100644 --- a/desktop_version/src/GraphicsResources.cpp +++ b/desktop_version/src/GraphicsResources.cpp @@ -16,7 +16,8 @@ extern "C" extern const char* lodepng_error_text(unsigned code); } -static SDL_Surface* LoadImage(const char *filename) +/* Don't declare `static`, this is used elsewhere */ +SDL_Surface* LoadImage(const char *filename) { //Temporary storage for the image that's loaded SDL_Surface* loadedImage = NULL; diff --git a/desktop_version/src/Screen.cpp b/desktop_version/src/Screen.cpp index 57b18645..d84c7f71 100644 --- a/desktop_version/src/Screen.cpp +++ b/desktop_version/src/Screen.cpp @@ -8,18 +8,6 @@ #include "GraphicsUtil.h" #include "Vlogging.h" -// Used to create the window icon -extern "C" -{ - extern unsigned lodepng_decode24( - unsigned char** out, - unsigned* w, - unsigned* h, - const unsigned char* in, - size_t insize - ); -} - void ScreenSettings_default(struct ScreenSettings* _this) { _this->windowWidth = 320; @@ -120,29 +108,26 @@ void Screen::GetSettings(struct ScreenSettings* settings) settings->badSignal = badSignalEffect; } +#ifdef __APPLE__ +/* Apple doesn't like icons anymore... */ void Screen::LoadIcon(void) { -#ifndef __APPLE__ - unsigned char *fileIn; - size_t length; - unsigned char *data; - unsigned int width, height; - FILESYSTEM_loadAssetToMemory("VVVVVV.png", &fileIn, &length, false); - lodepng_decode24(&data, &width, &height, fileIn, length); - FILESYSTEM_freeMemory(&fileIn); - SDL_Surface *icon = SDL_CreateRGBSurfaceWithFormatFrom( - data, - width, - height, - 24, - width * 3, - SDL_PIXELFORMAT_RGB24 - ); + +} +#else +SDL_Surface* LoadImage(const char* filename); + +void Screen::LoadIcon(void) +{ + SDL_Surface* icon = LoadImage("VVVVVV.png"); + if (icon == NULL) + { + return; + } SDL_SetWindowIcon(m_window, icon); SDL_FreeSurface(icon); - SDL_free(data); -#endif /* __APPLE__ */ } +#endif /* __APPLE__ */ void Screen::ResizeScreen(int x, int y) {