diff --git a/.DS_Store b/.DS_Store index e3c3151..8066f49 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/CMakeLists.txt b/CMakeLists.txt index 03fb21b..f43864b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2) PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0) PKG_SEARCH_MODULE(SDL2MIXER REQUIRED SDL2_mixer>=2.0.0) #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 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}) 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) diff --git a/assets/.DS_Store b/assets/.DS_Store index 80beb96..0079dd6 100644 Binary files a/assets/.DS_Store and b/assets/.DS_Store differ diff --git a/assets/maps/kaiju-city-map.tiled-session b/assets/maps/kaiju-city-map.tiled-session index 3002db2..2af5542 100644 --- a/assets/maps/kaiju-city-map.tiled-session +++ b/assets/maps/kaiju-city-map.tiled-session @@ -3,7 +3,7 @@ "height": 4300, "width": 2 }, - "activeFile": "", + "activeFile": "kaiju-city-map2.json", "expandedProjectPaths": [ "." ], @@ -56,11 +56,12 @@ "scale": 2, "selectedLayer": 1, "viewCenter": { - "x": 170, + "x": 169.5, "y": 148.25 } }, "kaiju-city-ts.tsj": { + "scaleInDock": 3, "scaleInEditor": 1 }, "kaiju-city.tsj": { @@ -97,9 +98,11 @@ "map.tileWidth": 8, "map.width": 40, "openFiles": [ + "kaiju-city-map2.json" ], "project": "kaiju-city-map.tiled-project", "recentFiles": [ + "kaiju-city-map2.json", "kaiju-city-ts.tsj", "kaiju-city-map.json", "kaiju-city-map.tmj", diff --git a/assets/textures/.DS_Store b/assets/textures/.DS_Store index 406732f..c056964 100644 Binary files a/assets/textures/.DS_Store and b/assets/textures/.DS_Store differ diff --git a/src/.DS_Store b/src/.DS_Store index d863c1b..c2fba20 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ diff --git a/src/ecs/SpriteComponent.h b/src/ecs/SpriteComponent.h index 8944fdc..bfabd28 100644 --- a/src/ecs/SpriteComponent.h +++ b/src/ecs/SpriteComponent.h @@ -66,21 +66,13 @@ public: spriteType = sType; 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::ifstream fin(fullPath); if(fin.fail()){ std::cerr<<"ERROR opening json file: " << json << std::endl; } else if (fin.is_open()){ - printf("Opened a json file\n"); + //printf("Opened a json file\n"); std::ifstream jsonText(json); std::ostringstream tmp; tmp << jsonText.rdbuf(); @@ -88,14 +80,14 @@ public: cJSON * animJson = cJSON_Parse(aJson.c_str()); std::cout << "animJson: " << std::endl; //std::cout << animJson << std::endl; - char * printOut = cJSON_Print(animJson); - std::cout << animJson << std::endl; + //char * printOut = cJSON_Print(animJson); + //std::cout << animJson << std::endl; cJSON * meta = cJSON_GetObjectItem(animJson, "meta"); cJSON * version = cJSON_GetObjectItem(animJson, "version"); cJSON * frameTags = cJSON_GetObjectItem(meta,"frameTags"); int tagsCount = cJSON_GetArraySize(frameTags); - std::cout << "tagsCount: " << tagsCount << std::endl; - std::cout << "version: " << version << std::endl; + //std::cout << "tagsCount: " << tagsCount << std::endl; + //std::cout << "version: " << version << std::endl; const cJSON * aFrame = NULL; const cJSON * aFrames = NULL; aFrames =cJSON_GetObjectItemCaseSensitive(animJson, "frames"); diff --git a/src/game/Main.cpp b/src/game/Main.cpp index cfcff07..c213c45 100644 --- a/src/game/Main.cpp +++ b/src/game/Main.cpp @@ -11,44 +11,30 @@ #include #include #include -#include Game *game = nullptr; int main(int argc, const char * argv[]) { -// printf("Program has started, but not initialized yet.\n"); const int FPS = 60; const int frameDelay = 1000 / FPS; Uint64 frameStart; 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 // ============================= -// Starting with Error Checking std::string configPath = "src/config/config.json"; - std::string bps = p.string(); - size_t charPos = bps.find("build"); - bps.erase(charPos,bps.length()); -// std::cout << "Trimmed Boost Path: " << bps << std::endl; - 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::string sdlBasePath = SDL_GetBasePath(); + size_t charPosSdl = sdlBasePath.find("build"); + sdlBasePath.erase(charPosSdl,sdlBasePath.length()); + std::string configurationPath = sdlBasePath + configPath; 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()){ std::cerr<<"ERROR: config.json not found or opened"<valueint; int windowFS = cJSON_GetObjectItem(myJSON, "WindowFullScreen")->valueint; int globalScale = cJSON_GetObjectItem(myJSON, "GlobalScale")->valueint; -/* int windowWidth = 64; - int windowHeight = 64; - int windowFS = 0; - int globalScale = 10;*/ bool isWindowFS; - //std::string windowName = "KaijuSaveEarth"; if (windowFS==0) { isWindowFS = false; @@ -75,9 +56,9 @@ int main(int argc, const char * argv[]) } windowWidth = windowWidth*globalScale; windowHeight = windowHeight*globalScale; - game = new Game(bps); + game = new Game(sdlBasePath); game->init(windowName->valuestring, windowWidth, windowHeight, isWindowFS, globalScale); -// game->init(windowName.c_str(), windowWidth, windowHeight, isWindowFS, globalScale); + // cJSON memory management cJSON_Delete(myJSON);