From 38d46b2dda0243cfa60bc6945859ebd587e0a851 Mon Sep 17 00:00:00 2001 From: Steph Enders Date: Mon, 27 Jun 2022 17:45:44 -0400 Subject: Update MacOS to compile w/ Boost MacOS seems to rely on an older/different C++ stdlib than Windows or Linux. So replacing those with Boost equivalents. Mostly contained to the Resources thankfully! --- src/resources/Resources.h | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'src/resources/Resources.h') diff --git a/src/resources/Resources.h b/src/resources/Resources.h index 2e0e7c0..c307c1b 100644 --- a/src/resources/Resources.h +++ b/src/resources/Resources.h @@ -29,13 +29,15 @@ #define DNG_RESOURCES_H #ifdef __APPLE__ -#include -namespace fs = std::experimental::filesystem; +#include "boost/filesystem.hpp" +#include "boost/optional.hpp" +using namespace boost; #else #include -namespace fs = std::filesystem; -#endif #include +using namespace std; +#endif +#include #include // struct LevelInfo { @@ -43,9 +45,8 @@ namespace fs = std::filesystem; // filesystem::path dngMap; // optional procLua; // }; -using namespace std; -static const string FONT_TYPES[] = {".otf", ".ttf"}; +static const std::string FONT_TYPES[] = {".otf", ".ttf"}; static const filesystem::path DEFAULT_LUA{"defaults.lua"}; static const filesystem::path DNG_MAP{"dng.map"}; static const filesystem::path PROC_LUA{"proc.lua"}; @@ -54,26 +55,26 @@ static const char *DEFAULT_FONT = "PressStart2P-vaV7.ttf"; class Resources { protected: - shared_ptr font; // chosen font - shared_ptr defaultsLua; // defaults lua file - vector fonts; // all found maps - vector levels; // all found maps - virtual vector levelSearchDirs() = 0; - virtual vector defaultsSearchDirs() = 0; - virtual vector fontSearchDirs() = 0; + std::shared_ptr font; // chosen font + std::shared_ptr defaultsLua; // defaults lua file + std::vector fonts; // all found maps + std::vector levels; // all found maps + virtual std::vector levelSearchDirs() = 0; + virtual std::vector defaultsSearchDirs() = 0; + virtual std::vector fontSearchDirs() = 0; public: Resources(); void loadLevels(); void loadFontFiles(); void loadDefaultLuaFile(); - vector getFontFiles(); - vector getLevels(); - shared_ptr updateFont(int idx); - shared_ptr getFontFile(); - shared_ptr getDefaultsLuaFile(); - shared_ptr getLevelMap(int idx); - optional> getLevelProcLua(int idx); + std::vector getFontFiles(); + std::vector getLevels(); + std::shared_ptr updateFont(int idx); + std::shared_ptr getFontFile(); + std::shared_ptr getDefaultsLuaFile(); + std::shared_ptr getLevelMap(int idx); + optional> getLevelProcLua(int idx); /* Helper method to convert any path to a const char * * Windows uses wchar_t so this can help provide a common way to * interact with files -- cgit v1.2.3-54-g00ecf