From b3b001c2a8947c5fdc227e91e88d00dbd813e7d4 Mon Sep 17 00:00:00 2001 From: Misa Date: Tue, 9 Jan 2024 16:03:05 -0800 Subject: [PATCH] Place GraphicsResources functions in header file These are functions used in other files that are not on the GraphicsResources class but are implemented inside the GraphicsResources.cpp file. For some reason they were never put in the GraphicsResources.h file until now, even though it's a perfectly good header file to put them in. --- desktop_version/src/Font.cpp | 5 +---- desktop_version/src/GraphicsResources.cpp | 1 - desktop_version/src/GraphicsResources.h | 6 ++++++ desktop_version/src/Screen.cpp | 5 +++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/desktop_version/src/Font.cpp b/desktop_version/src/Font.cpp index cf47a176..da2d2b65 100644 --- a/desktop_version/src/Font.cpp +++ b/desktop_version/src/Font.cpp @@ -8,6 +8,7 @@ #include "FileSystemUtils.h" #include "FontBidi.h" #include "Graphics.h" +#include "GraphicsResources.h" #include "GraphicsUtil.h" #include "Localization.h" #include "UTF8.h" @@ -20,10 +21,6 @@ extern "C" #include } -// Sigh... This is the second forward-declaration, we need to put this in a header file -SDL_Texture* LoadImage(const char *filename, TextureLoadType loadtype); -SDL_Surface* LoadImageSurface(const char* filename); - namespace font { diff --git a/desktop_version/src/GraphicsResources.cpp b/desktop_version/src/GraphicsResources.cpp index 4410085f..c1f23ff0 100644 --- a/desktop_version/src/GraphicsResources.cpp +++ b/desktop_version/src/GraphicsResources.cpp @@ -82,7 +82,6 @@ static SDL_Surface* LoadSurfaceFromRaw(SDL_Surface* loadedImage) return optimizedImage; } -/* Can't be static, used in Screen.h */ SDL_Surface* LoadImageSurface(const char* filename) { unsigned char* data; diff --git a/desktop_version/src/GraphicsResources.h b/desktop_version/src/GraphicsResources.h index 20ba116d..f7973c68 100644 --- a/desktop_version/src/GraphicsResources.h +++ b/desktop_version/src/GraphicsResources.h @@ -50,4 +50,10 @@ public: SDL_Texture* im_flipsprites_translated; }; +SDL_Surface* LoadImageSurface(const char* filename); +SDL_Texture* LoadImage(const char *filename, TextureLoadType loadtype); + +bool SaveImage(const SDL_Surface* surface, const char* filename); +bool SaveScreenshot(void); + #endif /* GRAPHICSRESOURCES_H */ diff --git a/desktop_version/src/Screen.cpp b/desktop_version/src/Screen.cpp index c77c9998..8284ea86 100644 --- a/desktop_version/src/Screen.cpp +++ b/desktop_version/src/Screen.cpp @@ -10,6 +10,9 @@ #include "Game.h" #include "Graphics.h" #include "GraphicsUtil.h" +#ifndef __APPLE__ +#include "GraphicsResources.h" +#endif #include "InterimVersion.h" #include "Render.h" #include "Vlogging.h" @@ -118,8 +121,6 @@ void Screen::LoadIcon(void) } #else -SDL_Surface* LoadImageSurface(const char* filename); - void Screen::LoadIcon(void) { SDL_Surface* icon = LoadImageSurface("VVVVVV.png");