aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-04-06 15:38:13 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-04-06 15:38:13 +0100
commit52fae93d2903fc606bb0c4347a994a1b1285835b (patch)
treea58a595c55d429c13368e8e216a573af92952605
parent4416e0b3a3245f77bd8dde7d2bba80743c6fa20b (diff)
downloadYAGE-52fae93d2903fc606bb0c4347a994a1b1285835b.tar.gz
YAGE-52fae93d2903fc606bb0c4347a994a1b1285835b.zip
Fixing documentation and building
-rw-r--r--CMakeLists.txt3
-rw-r--r--README.md2
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/spritesheet/test.cpp3
-rw-r--r--yage/core/iomanager.cpp12
-rw-r--r--yage/core/iomanager.h13
6 files changed, 22 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2633d4a7..bbf66d77 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,9 +11,6 @@ option(YAGE_BUILD_DOCS "Build documentation using Doxygen" ON)
# set standard
set(CMAKE_CXX_STANDARD 14)
-# adding more warnings to cmake
-set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wall")
-
# find other libraries from source
set(EXTERNAL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external)
diff --git a/README.md b/README.md
index 9e1635fa..deace2fd 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ The full documentation of the API can be seen
## Installation and usage
To use YAGE for your own game, you should link it as a static library and
-include the [yage.h](/include/YAGE/yage.h) header in your project. To link the
+include the [yage.h](/yage/yage.h) header in your project. To link the
project using cmake, the library has to be added as a subdirectory and then
linked with the name `yage`.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 707492aa..5b7d6fd3 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -33,4 +33,3 @@ make_test(syncqueue 1)
make_test(active 1)
make_test(struct ${SIMULATION_RUNS})
make_test(engine ${SIMULATION_RUNS})
-make_test(render ${SIMULATION_RUNS})
diff --git a/tests/spritesheet/test.cpp b/tests/spritesheet/test.cpp
index 7fe4e77f..1955d63e 100644
--- a/tests/spritesheet/test.cpp
+++ b/tests/spritesheet/test.cpp
@@ -15,7 +15,8 @@ using namespace yage;
TEST(SpriteSheet, Load)
{
- SpriteSheet sp("tests/spritesheet/floor_atlas.png", "tests/spritesheet/floor_atlas.json");
+ yLogDebug << IoManager::parentDirectory(__FILE__) << '\n' << __FILE__;
+ SpriteSheet sp(IoManager::parentDirectory(__FILE__), IoManager::parentDirectory(__FILE__));
ASSERT_TRUE(true);
}
diff --git a/yage/core/iomanager.cpp b/yage/core/iomanager.cpp
index 3d9ea7cb..487ef8a9 100644
--- a/yage/core/iomanager.cpp
+++ b/yage/core/iomanager.cpp
@@ -10,11 +10,14 @@
#include <fstream>
#include <stdexcept>
+#include <regex>
namespace yage
{
-bool IoManager::readFileToBuffer(const std::string &file_path,
+namespace IoManager {
+
+bool readFileToBuffer(const std::string &file_path,
std::vector<unsigned char> &buffer)
{
std::ifstream file(file_path, std::ios::binary);
@@ -39,4 +42,11 @@ bool IoManager::readFileToBuffer(const std::string &file_path,
return true;
}
+std::string parentDirectory(std::string file_path)
+{
+ return std::regex_replace(file_path, std::regex("(.*)/.*"), "$1");
+}
+
+}
+
} // namespace yage
diff --git a/yage/core/iomanager.h b/yage/core/iomanager.h
index 6c623adf..556cffb4 100644
--- a/yage/core/iomanager.h
+++ b/yage/core/iomanager.h
@@ -15,12 +15,15 @@
namespace yage
{
-class IoManager
+namespace IoManager
{
-public:
- static bool readFileToBuffer(const std::string &file_path,
- std::vector<unsigned char> &buffer);
-};
+
+extern bool readFileToBuffer(const std::string &file_path,
+ std::vector<unsigned char> &buffer);
+
+extern std::string parentDirectory(std::string file_path);
+
+}
} // namespace yage