Some Code Clean Up

This commit is contained in:
TheBrokenRail 2023-10-10 16:05:02 -04:00
parent 8278e2993d
commit 100dd1db5d
4 changed files with 11 additions and 18 deletions

View file

@ -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:

View file

@ -1,10 +1,8 @@
#include "AppPlatform_sdl.hpp"
#include <emscripten.h>
#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)
{
}

View file

@ -2,6 +2,9 @@
#include <string>
#include <emscripten.h>
#include <emscripten/html5.h>
#include "AppPlatform_sdl_base.hpp"
class AppPlatform_sdl : public AppPlatform_sdl_base

View file

@ -10,15 +10,6 @@ typedef AppPlatform_sdl UsedAppPlatform;
#include "client/app/NinecraftApp.hpp"
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <emscripten/html5.h>
#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