More CMake Clean Up

This commit is contained in:
TheBrokenRail
2023-10-10 15:58:08 -04:00
parent aa66f713ae
commit 8278e2993d
8 changed files with 17 additions and 30 deletions

View File

@@ -56,10 +56,3 @@ if(EMSCRIPTEN)
# Export Resize Function
target_link_options(reminecraftpe PRIVATE -sEXPORTED_FUNCTIONS=_main,_resize_from_js -sEXPORTED_RUNTIME_METHODS=ccall)
endif()
# Assets
if(EMSCRIPTEN)
target_link_options(reminecraftpe PRIVATE --use-preload-plugins --preload-file "${CMAKE_CURRENT_SOURCE_DIR}/../../game/assets@/assets")
elseif(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/assets")
file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/../../game/assets" "${CMAKE_CURRENT_BINARY_DIR}/assets" SYMBOLIC)
endif()

View File

@@ -1,4 +1,4 @@
#include "AppPlatform_sdl_desktop.hpp"
#include "AppPlatform_sdl.hpp"
#include <fstream>
#include <sstream>
@@ -11,7 +11,7 @@
#include "common/Utils.hpp"
AppPlatform_sdl_desktop::AppPlatform_sdl_desktop(std::string storageDir, SDL_Window *window)
AppPlatform_sdl::AppPlatform_sdl(std::string storageDir, SDL_Window *window)
: AppPlatform_sdl_base(storageDir, window)
{
setIcon(loadTexture("icon.png"));
@@ -97,7 +97,7 @@ ret:
}
// Ensure Screenshots Folder Exists
void AppPlatform_sdl_desktop::ensureDirectoryExists(const char* path)
void AppPlatform_sdl::ensureDirectoryExists(const char* path)
{
// Check Screenshots Folder
struct stat obj;
@@ -118,7 +118,7 @@ void AppPlatform_sdl_desktop::ensureDirectoryExists(const char* path)
}
}
void AppPlatform_sdl_desktop::saveScreenshot(const std::string& filename, int glWidth, int glHeight)
void AppPlatform_sdl::saveScreenshot(const std::string& filename, int glWidth, int glHeight)
{
// Get Directory
std::string screenshots = _storageDir + "/screenshots";
@@ -206,7 +206,7 @@ static void nop_png_warning(png_structp png_ptr, png_const_charp warning_message
// Do Nothing
}
Texture AppPlatform_sdl_desktop::loadTexture(const std::string& path, bool b)
Texture AppPlatform_sdl::loadTexture(const std::string& path, bool b)
{
Texture out;
out.field_C = 1;
@@ -295,7 +295,7 @@ Texture AppPlatform_sdl_desktop::loadTexture(const std::string& path, bool b)
return out;
}
bool AppPlatform_sdl_desktop::hasFileSystemAccess()
bool AppPlatform_sdl::hasFileSystemAccess()
{
return true;
}

View File

@@ -4,10 +4,10 @@
#include "AppPlatform_sdl_base.hpp"
class AppPlatform_sdl_desktop : public AppPlatform_sdl_base
class AppPlatform_sdl : public AppPlatform_sdl_base
{
public:
AppPlatform_sdl_desktop(std::string storageDir, SDL_Window *window);
AppPlatform_sdl(std::string storageDir, SDL_Window *window);
void saveScreenshot(const std::string& fileName, int width, int height) override;
Texture loadTexture(const std::string& path, bool b = false) override;

View File

@@ -3,7 +3,7 @@ project(reminecraftpe-sdl-desktop)
# Build
add_library(reminecraftpe-sdl-platform STATIC
AppPlatform_sdl_desktop.cpp
AppPlatform_sdl.cpp
)
# Core

View File

@@ -1,15 +1,15 @@
#include "AppPlatform_sdl_emscripten.hpp"
#include "AppPlatform_sdl.hpp"
#include <emscripten.h>
#include "common/Utils.hpp"
AppPlatform_sdl_emscripten::AppPlatform_sdl_emscripten(std::string storageDir, SDL_Window *window)
AppPlatform_sdl::AppPlatform_sdl_emscripten(std::string storageDir, SDL_Window *window)
: AppPlatform_sdl_base(storageDir, window)
{
}
Texture AppPlatform_sdl_emscripten::loadTexture(const std::string& path, bool b)
Texture AppPlatform_sdl::loadTexture(const std::string& path, bool b)
{
Texture out;
out.field_C = 1;
@@ -27,7 +27,6 @@ Texture AppPlatform_sdl_emscripten::loadTexture(const std::string& path, bool b)
return out;
}
// I don't think this logic makes any sense
LOG_E("Couldn't find file: %s", realPath.c_str());
return out;
}

View File

@@ -4,10 +4,10 @@
#include "AppPlatform_sdl_base.hpp"
class AppPlatform_sdl_emscripten : public AppPlatform_sdl_base
class AppPlatform_sdl : public AppPlatform_sdl_base
{
public:
AppPlatform_sdl_emscripten(std::string storageDir, SDL_Window *window);
AppPlatform_sdl(std::string storageDir, SDL_Window *window);
Texture loadTexture(const std::string& path, bool b = false) override;
};

View File

@@ -3,7 +3,7 @@ project(reminecraftpe-sdl-emscripten)
# Build
add_library(reminecraftpe-sdl-platform STATIC
AppPlatform_sdl_emscripten.cpp
AppPlatform_sdl.cpp
)
# Core

View File

@@ -5,13 +5,8 @@
#include "thirdparty/GL/GL.hpp"
#include "client/app/App.hpp"
#if defined(__EMSCRIPTEN__)
#include "AppPlatform_sdl_emscripten.hpp"
typedef AppPlatform_sdl_emscripten UsedAppPlatform;
#else
#include "AppPlatform_sdl_desktop.hpp"
typedef AppPlatform_sdl_desktop UsedAppPlatform;
#endif
#include "AppPlatform_sdl.hpp"
typedef AppPlatform_sdl UsedAppPlatform;
#include "client/app/NinecraftApp.hpp"