Removed Boost libraries from project

This commit is contained in:
Alan Youngblood 2023-08-21 16:45:15 -04:00
parent de3b2dcdb0
commit 9218c9a4b1
8 changed files with 18 additions and 42 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -12,7 +12,7 @@ PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0) PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
PKG_SEARCH_MODULE(SDL2MIXER REQUIRED SDL2_mixer>=2.0.0) PKG_SEARCH_MODULE(SDL2MIXER REQUIRED SDL2_mixer>=2.0.0)
#PKG_SEARCH_MODULE(BOOSTFILESYSTEM boost_filesystem >=) #PKG_SEARCH_MODULE(BOOSTFILESYSTEM boost_filesystem >=)
find_package(Boost COMPONENTS system filesystem REQUIRED) #find_package(Boost COMPONENTS system filesystem REQUIRED)
# Point to our own cmake modules # Point to our own cmake modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
@ -27,4 +27,4 @@ file(GLOB_RECURSE CPPSOURCES src/*.cpp)
add_executable(${PROJECT_NAME} ${CSOURCES} ${CPPSOURCES}) add_executable(${PROJECT_NAME} ${CSOURCES} ${CPPSOURCES})
install(TARGETS ${PROJECT_NAME} DESTINATION bin) install(TARGETS ${PROJECT_NAME} DESTINATION bin)
target_link_libraries(${PROJECT_NAME} PUBLIC Boost::system Boost::filesystem PRIVATE /usr/local/lib/libSDL2.dylib /usr/local/lib/libSDL2_image.dylib /usr/local/lib/libSDL2_mixer.dylib) target_link_libraries(${PROJECT_NAME} PRIVATE /usr/local/lib/libSDL2.dylib /usr/local/lib/libSDL2_image.dylib /usr/local/lib/libSDL2_mixer.dylib)

BIN
assets/.DS_Store vendored

Binary file not shown.

View File

@ -3,7 +3,7 @@
"height": 4300, "height": 4300,
"width": 2 "width": 2
}, },
"activeFile": "", "activeFile": "kaiju-city-map2.json",
"expandedProjectPaths": [ "expandedProjectPaths": [
"." "."
], ],
@ -56,11 +56,12 @@
"scale": 2, "scale": 2,
"selectedLayer": 1, "selectedLayer": 1,
"viewCenter": { "viewCenter": {
"x": 170, "x": 169.5,
"y": 148.25 "y": 148.25
} }
}, },
"kaiju-city-ts.tsj": { "kaiju-city-ts.tsj": {
"scaleInDock": 3,
"scaleInEditor": 1 "scaleInEditor": 1
}, },
"kaiju-city.tsj": { "kaiju-city.tsj": {
@ -97,9 +98,11 @@
"map.tileWidth": 8, "map.tileWidth": 8,
"map.width": 40, "map.width": 40,
"openFiles": [ "openFiles": [
"kaiju-city-map2.json"
], ],
"project": "kaiju-city-map.tiled-project", "project": "kaiju-city-map.tiled-project",
"recentFiles": [ "recentFiles": [
"kaiju-city-map2.json",
"kaiju-city-ts.tsj", "kaiju-city-ts.tsj",
"kaiju-city-map.json", "kaiju-city-map.json",
"kaiju-city-map.tmj", "kaiju-city-map.tmj",

Binary file not shown.

BIN
src/.DS_Store vendored

Binary file not shown.

View File

@ -66,21 +66,13 @@ public:
spriteType = sType; spriteType = sType;
if(sType == spriteAnimation) if(sType == spriteAnimation)
{ {
/*boost::filesystem::path p{argv[0]};
p = absolute(p).parent_path();
std::string configPath = "src/config/config.json";
std::string bps = p.string();
size_t charPos = bps.find("build");
bps.erase(charPos,bps.length());
std::string configurationPath = bps + json;*/
std::cout << "Project Path: " << Game::projPath << std::endl;
std::string fullPath = Game::projPath + json; std::string fullPath = Game::projPath + json;
std::ifstream fin(fullPath); std::ifstream fin(fullPath);
if(fin.fail()){ if(fin.fail()){
std::cerr<<"ERROR opening json file: " << json << std::endl; std::cerr<<"ERROR opening json file: " << json << std::endl;
} else if (fin.is_open()){ } else if (fin.is_open()){
printf("Opened a json file\n"); //printf("Opened a json file\n");
std::ifstream jsonText(json); std::ifstream jsonText(json);
std::ostringstream tmp; std::ostringstream tmp;
tmp << jsonText.rdbuf(); tmp << jsonText.rdbuf();
@ -88,14 +80,14 @@ public:
cJSON * animJson = cJSON_Parse(aJson.c_str()); cJSON * animJson = cJSON_Parse(aJson.c_str());
std::cout << "animJson: " << std::endl; std::cout << "animJson: " << std::endl;
//std::cout << animJson << std::endl; //std::cout << animJson << std::endl;
char * printOut = cJSON_Print(animJson); //char * printOut = cJSON_Print(animJson);
std::cout << animJson << std::endl; //std::cout << animJson << std::endl;
cJSON * meta = cJSON_GetObjectItem(animJson, "meta"); cJSON * meta = cJSON_GetObjectItem(animJson, "meta");
cJSON * version = cJSON_GetObjectItem(animJson, "version"); cJSON * version = cJSON_GetObjectItem(animJson, "version");
cJSON * frameTags = cJSON_GetObjectItem(meta,"frameTags"); cJSON * frameTags = cJSON_GetObjectItem(meta,"frameTags");
int tagsCount = cJSON_GetArraySize(frameTags); int tagsCount = cJSON_GetArraySize(frameTags);
std::cout << "tagsCount: " << tagsCount << std::endl; //std::cout << "tagsCount: " << tagsCount << std::endl;
std::cout << "version: " << version << std::endl; //std::cout << "version: " << version << std::endl;
const cJSON * aFrame = NULL; const cJSON * aFrame = NULL;
const cJSON * aFrames = NULL; const cJSON * aFrames = NULL;
aFrames =cJSON_GetObjectItemCaseSensitive(animJson, "frames"); aFrames =cJSON_GetObjectItemCaseSensitive(animJson, "frames");

View File

@ -11,44 +11,30 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <boost/filesystem.hpp>
Game *game = nullptr; Game *game = nullptr;
int main(int argc, const char * argv[]) int main(int argc, const char * argv[])
{ {
// printf("Program has started, but not initialized yet.\n");
const int FPS = 60; const int FPS = 60;
const int frameDelay = 1000 / FPS; const int frameDelay = 1000 / FPS;
Uint64 frameStart; Uint64 frameStart;
int frameTime; int frameTime;
boost::filesystem::path p{argv[0]};
p = absolute(p).parent_path();
// std::cout << "boost path: " << p << std::endl;
// ============================= // =============================
// Load cJSON config.json file // Load cJSON config.json file
// ============================= // =============================
// Starting with Error Checking
std::string configPath = "src/config/config.json"; std::string configPath = "src/config/config.json";
std::string bps = p.string(); std::string sdlBasePath = SDL_GetBasePath();
size_t charPos = bps.find("build"); size_t charPosSdl = sdlBasePath.find("build");
bps.erase(charPos,bps.length()); sdlBasePath.erase(charPosSdl,sdlBasePath.length());
// std::cout << "Trimmed Boost Path: " << bps << std::endl; std::string configurationPath = sdlBasePath + configPath;
std::string configurationPath = bps + configPath;
//std::string configPath = "/Users/ayoungblood/Projects/KaijuSaveEarth/src/config/config.json";
// /Users/ayoungblood/Projects/KaijuSaveEarth
// std::string fullPath = p.c_str() + "/" + configPath;
std::ifstream fin(configurationPath); std::ifstream fin(configurationPath);
// std::cout << "Attempting to load: " << configPath << std::endl;
// std::cout << "Current working Dir: " << std::filesystem::current_path() << std::endl;
if(!fin.is_open()){ if(!fin.is_open()){
std::cerr<<"ERROR: config.json not found or opened"<<std::endl; std::cerr<<"ERROR: config.json not found or opened"<<std::endl;
} else { } else {
printf("config.json loaded successfully.\n");
std::ifstream jsonText(configurationPath); std::ifstream jsonText(configurationPath);
std::ostringstream tmp; std::ostringstream tmp;
tmp << jsonText.rdbuf(); tmp << jsonText.rdbuf();
@ -60,12 +46,7 @@ int main(int argc, const char * argv[])
int windowHeight = cJSON_GetObjectItem(windowSize, "h")->valueint; int windowHeight = cJSON_GetObjectItem(windowSize, "h")->valueint;
int windowFS = cJSON_GetObjectItem(myJSON, "WindowFullScreen")->valueint; int windowFS = cJSON_GetObjectItem(myJSON, "WindowFullScreen")->valueint;
int globalScale = cJSON_GetObjectItem(myJSON, "GlobalScale")->valueint; int globalScale = cJSON_GetObjectItem(myJSON, "GlobalScale")->valueint;
/* int windowWidth = 64;
int windowHeight = 64;
int windowFS = 0;
int globalScale = 10;*/
bool isWindowFS; bool isWindowFS;
//std::string windowName = "KaijuSaveEarth";
if (windowFS==0) if (windowFS==0)
{ {
isWindowFS = false; isWindowFS = false;
@ -75,9 +56,9 @@ int main(int argc, const char * argv[])
} }
windowWidth = windowWidth*globalScale; windowWidth = windowWidth*globalScale;
windowHeight = windowHeight*globalScale; windowHeight = windowHeight*globalScale;
game = new Game(bps); game = new Game(sdlBasePath);
game->init(windowName->valuestring, windowWidth, windowHeight, isWindowFS, globalScale); game->init(windowName->valuestring, windowWidth, windowHeight, isWindowFS, globalScale);
// game->init(windowName.c_str(), windowWidth, windowHeight, isWindowFS, globalScale);
// cJSON memory management // cJSON memory management
cJSON_Delete(myJSON); cJSON_Delete(myJSON);