diff --git a/CMakeLists.txt b/CMakeLists.txt index f42b561..d07db7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,8 @@ find_package(OpenAL REQUIRED CONFIG) # Determine dependencies set(STATIC_LIBS - emergent + emergent) +set(SHARED_LIBS OpenAL::OpenAL) # Generate configuration header file @@ -54,7 +55,7 @@ target_include_directories(${EXECUTABLE_TARGET} ${PROJECT_BINARY_DIR}/src) # Link to dependencies -target_link_libraries(${EXECUTABLE_TARGET} ${STATIC_LIBS}) +target_link_libraries(${EXECUTABLE_TARGET} ${STATIC_LIBS} ${SHARED_LIBS}) # Install executable install(TARGETS ${EXECUTABLE_TARGET} DESTINATION bin) diff --git a/src/entity/systems/sound-system.cpp b/src/entity/systems/sound-system.cpp index 5b4f43e..8b0f763 100644 --- a/src/entity/systems/sound-system.cpp +++ b/src/entity/systems/sound-system.cpp @@ -55,7 +55,7 @@ SoundSystem::SoundSystem(ComponentManager* componentManager): // Load wav file { - const char* filename = "shutter.wav"; + const char* filename = "data/shutter.wav"; unsigned int channels; unsigned int sampleRate; drwav_uint64 frameCount; diff --git a/src/game.cpp b/src/game.cpp index b3a557b..56724a3 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -168,12 +168,9 @@ Game::Game(int argc, char* argv[]): #endif // Form resource paths - dataPath = getDataPath(applicationName); + dataPath = getDataPath(applicationName) + "data/"; configPath = getConfigPath(applicationName); - controlsPath = configPath + "/controls/"; - - std::cout << "Data path: " << dataPath << std::endl; - std::cout << "Config path: " << configPath << std::endl; + controlsPath = configPath + "controls/"; // Create nonexistent config directories std::vector configPaths; @@ -186,6 +183,16 @@ Game::Game(int argc, char* argv[]): createDirectory(path); } } + + // Setup logging + #if !defined(DEBUG) + std::string logFilename = configPath + "log.txt"; + logFileStream.open(logFilename.c_str()); + std::cout.rdbuf(logFileStream.rdbuf()); + #endif + + std::cout << "Data path: " << dataPath << std::endl; + std::cout << "Config path: " << configPath << std::endl; // Setup resource manager resourceManager = new ResourceManager(); @@ -2074,7 +2081,7 @@ void Game::screenshot() std::transform(title.begin(), title.end(), title.begin(), ::tolower); // Create screenshot directory if it doesn't exist - std::string screenshotDirectory = configPath + std::string("/screenshots/"); + std::string screenshotDirectory = configPath + std::string("screenshots/"); if (!pathExists(screenshotDirectory)) { createDirectory(screenshotDirectory); diff --git a/src/game.hpp b/src/game.hpp index 578b987..a52cf1e 100644 --- a/src/game.hpp +++ b/src/game.hpp @@ -27,6 +27,7 @@ using namespace Emergent; #include #include #include +#include class GameState; class SplashState; @@ -418,6 +419,7 @@ public: std::string controlProfileName; // Debugging + std::ofstream logFileStream; bool wireframe; private: