From 100dd1db5db8ed85f35dfb33bb327f0d83b741f1 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Tue, 10 Oct 2023 16:05:02 -0400 Subject: [PATCH] Some Code Clean Up --- platforms/sdl/desktop/AppPlatform_sdl.hpp | 4 ++++ platforms/sdl/emscripten/AppPlatform_sdl.cpp | 4 +--- platforms/sdl/emscripten/AppPlatform_sdl.hpp | 3 +++ platforms/sdl/main.cpp | 18 +++--------------- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/platforms/sdl/desktop/AppPlatform_sdl.hpp b/platforms/sdl/desktop/AppPlatform_sdl.hpp index 9d5b898..12ff18e 100644 --- a/platforms/sdl/desktop/AppPlatform_sdl.hpp +++ b/platforms/sdl/desktop/AppPlatform_sdl.hpp @@ -4,6 +4,10 @@ #include "AppPlatform_sdl_base.hpp" +#define EM_BOOL bool +#define EM_TRUE true +#define EM_FALSE false + class AppPlatform_sdl : public AppPlatform_sdl_base { public: diff --git a/platforms/sdl/emscripten/AppPlatform_sdl.cpp b/platforms/sdl/emscripten/AppPlatform_sdl.cpp index 5371a48..83a74d2 100644 --- a/platforms/sdl/emscripten/AppPlatform_sdl.cpp +++ b/platforms/sdl/emscripten/AppPlatform_sdl.cpp @@ -1,10 +1,8 @@ #include "AppPlatform_sdl.hpp" -#include - #include "common/Utils.hpp" -AppPlatform_sdl::AppPlatform_sdl_emscripten(std::string storageDir, SDL_Window *window) +AppPlatform_sdl::AppPlatform_sdl(std::string storageDir, SDL_Window *window) : AppPlatform_sdl_base(storageDir, window) { } diff --git a/platforms/sdl/emscripten/AppPlatform_sdl.hpp b/platforms/sdl/emscripten/AppPlatform_sdl.hpp index 91f1ffe..0eb7556 100644 --- a/platforms/sdl/emscripten/AppPlatform_sdl.hpp +++ b/platforms/sdl/emscripten/AppPlatform_sdl.hpp @@ -2,6 +2,9 @@ #include +#include +#include + #include "AppPlatform_sdl_base.hpp" class AppPlatform_sdl : public AppPlatform_sdl_base diff --git a/platforms/sdl/main.cpp b/platforms/sdl/main.cpp index f1e7364..2f90521 100644 --- a/platforms/sdl/main.cpp +++ b/platforms/sdl/main.cpp @@ -10,15 +10,6 @@ typedef AppPlatform_sdl UsedAppPlatform; #include "client/app/NinecraftApp.hpp" -#ifdef __EMSCRIPTEN__ -#include -#include -#else -#define EM_BOOL bool -#define EM_TRUE true -#define EM_FALSE false -#endif - static float g_fPointToPixelScale = 1.0f; UsedAppPlatform *g_pAppPlatform; @@ -217,18 +208,15 @@ bool DoesAssetExist(const std::string & fileName) free(data); return true; } +#else +// access works just fine on linux and friends +#define DoesAssetExist(fileName) (XPL_ACCESS(fileName, 0) == 0) #endif void CheckOptionalTextureAvailability() { -#ifdef __EMSCRIPTEN__ g_bIsMenuBackgroundAvailable = DoesAssetExist("gui/background/panorama_0.png"); g_bAreCloudsAvailable = DoesAssetExist("environment/clouds.png"); -#else - // access works just fine on linux and friends - g_bIsMenuBackgroundAvailable = XPL_ACCESS("assets/gui/background/panorama_0.png", 0) == 0; - g_bAreCloudsAvailable = XPL_ACCESS("assets/environment/clouds.png", 0) == 0; -#endif } // Main