From a28da7ef1a42cddd42f60220708eb5d36ea18d12 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sun, 17 Dec 2017 12:13:14 +0000 Subject: Mores to travis --- .travis.yml | 32 ++++++++++++++++---------------- README.md | 19 ++++++++++++++----- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 827fed4b..399ab0d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -103,21 +103,21 @@ matrix: env: - "MATRIX_EVAL=\"CC=clang-5.0 && CXX=clang++-5.0\"" os: linux - - - env: - - "MATRIX_EVAL=\"rvm install ruby-2.3.3 && rvm use 2.3.3 && brew update && brew install gcc5 && CC=gcc-5 && CXX=g++-5\"" - os: osx - osx_image: xcode8 - - - env: - - "MATRIX_EVAL=\"rvm install ruby-2.3.3 && rvm use 2.3.3 && brew update && brew install gcc6 && CC=gcc-6 && CXX=g++-6\"" - os: osx - osx_image: xcode8 - - - env: - - "MATRIX_EVAL=\"rvm install ruby-2.3.3 && rvm use 2.3.3 && brew update && brew install gcc && CC=gcc-7 && CXX=g++-7\"" - os: osx - osx_image: xcode8 +# - +# env: +# - "MATRIX_EVAL=\"rvm install ruby-2.3.3 && rvm use 2.3.3 && brew update && brew install gcc5 && CC=gcc-5 && CXX=g++-5\"" +# os: osx +# osx_image: xcode8 +# - +# env: +# - "MATRIX_EVAL=\"rvm install ruby-2.3.3 && rvm use 2.3.3 && brew update && brew install gcc6 && CC=gcc-6 && CXX=g++-6\"" +# os: osx +# osx_image: xcode8 +# - +# env: +# - "MATRIX_EVAL=\"rvm install ruby-2.3.3 && rvm use 2.3.3 && brew update && brew install gcc && CC=gcc-7 && CXX=g++-7\"" +# os: osx +# osx_image: xcode8 notifications: email: false script: @@ -127,7 +127,7 @@ script: - "mkdir -p build" - "cd build" - "cmake -DUNIT_TESTS=ON .." - - make + - "make -j9" - ctest - "cd .. && ./scripts/update_docs" diff --git a/README.md b/README.md index 724e5e5a..882f37dd 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,15 @@ YAGE {#mainpage} Introduction ------------ -YAGE stands for Yet Another Game Engine. It is a game engine that I am -developing for a game called [Arider](https://github.com/ymherklotz/Arider). +YAGE stands for Yet Another Game Engine. It is a game engine that is being +developed for a game called [Arider](https://github.com/ymherklotz/Arider). It uses OpenGL and GLFW for the window creation and management and graphics. +It is also going to be a general game engine for use with other games in the +similar style. + +The inspiration for this game engine is to learn about OpenGL and create an +optimised 2D game engine with a simple API that can be used to easily create +simple 2D games. The full documentation can be seen [here](https://www.yannherklotz.com/YAGE). @@ -15,7 +21,9 @@ 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. +include the [yage.h](/include/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`. Build and Testing ----------------- @@ -23,11 +31,12 @@ Build and Testing To compile YAGE, create a build directory from the base directory. Then call cmake and point it to the directory containing. [CMakeLists.txt](/CMakeLists.txt). +For example, one can use the following commands ``` shell -mkdir build +mkdir -p build cd build -cmake .. -DENABLE_TESTING=1 +cmake -DENABLE_TESTING=1 .. ``` You can then run google test on YAGE. -- cgit From 335a259da22a1775fad3f3b83cc31cbcf7d1afcc Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sun, 17 Dec 2017 19:58:55 +0000 Subject: Fixing whitespace and improving README. --- .travis.yml | 90 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/.travis.yml b/.travis.yml index 399ab0d8..d6383cb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,23 @@ ---- -before_install: +--- +before_install: - "eval \"${MATRIX_EVAL}\"" -branches: - only: +branches: + only: - master - develop dist: trusty -env: - global: +env: + global: secure: NGWn7hJAd/iYfJQmr8oDjTlwttldj8zB+X0gk2TqDhAJ2gLiZ2+b8Bp5FSzBlNIyhcbuhzRU+rzkbo03XSwXZXFRZK/gyPMGaB75ay8MLQBrN3L7THXbjQm1SZg2mO17/MKT+rJH/NvhmqPoUoJaYnoki1G6AZfhnDx+3bW4MNp5/g3u8trk1HNvXWTvjdqS99OH36bvoq8BsOi53Po1veeCIWza6JO61n2nRHzCC2sYWtsZyTQSi3B//iie5zF3gvuRorbzjA/ayc8lLmhUsTmoA1t9HJP52fKzv/q3mxllXzyzpWNRmUJCzf7I1wY9jp1FVwojfl0umofzYPCCjwSrKlRtmwQfi0peg7VOJVCCJx7Eh/i0hamGUnDEu0aZnfhgwzkqDDIgO1AwcEv5i9egt/73kK4mdm22sEDa3dWVu37tnj5dItaQesMm6TXKMy9+r7v0aaVJbQB2atvBaf3RlW71P9iy8mOZ+geKNwVFRuBdu5g3oQe5QrqXRi4inMv0bjN8HwOVs/f8ZTGZePnbHnxOnYRErxLnha/bsu7btfDT8Q8nmZ/Rhcu7QkMRNTm5L3+YHFUngiIygOs8wrH6HECtSYwmi9WejRuPgU2GnYR0Rzyi5dyaFok1iN+jsYsY9YFx5tRgxuX4H9CnUlfDabdFSLzqbmKRlbP79as= -git: +git: depth: 1 language: cpp -matrix: - include: - - - addons: - apt: - packages: +matrix: + include: + - + addons: + apt: + packages: - g++-5 - libegl1-mesa-dev - libgles2-mesa-dev @@ -25,16 +25,16 @@ matrix: - xorg-dev - libglu1-mesa-dev - doxygen - sources: + sources: - ubuntu-toolchain-r-test compiler: g++-5 - env: + env: - "MATRIX_EVAL=\"CC=gcc-5 && CXX=g++-5\"" os: linux - - - addons: - apt: - packages: + - + addons: + apt: + packages: - g++-6 - libegl1-mesa-dev - libgles2-mesa-dev @@ -42,16 +42,16 @@ matrix: - xorg-dev - libglu1-mesa-dev - doxygen - sources: + sources: - ubuntu-toolchain-r-test compiler: g++-6 - env: + env: - "MATRIX_EVAL=\"CC=gcc-6 && CXX=g++-6\"" os: linux - - - addons: - apt: - packages: + - + addons: + apt: + packages: - g++-7 - libegl1-mesa-dev - libgles2-mesa-dev @@ -59,15 +59,15 @@ matrix: - xorg-dev - libglu1-mesa-dev - doxygen - sources: + sources: - ubuntu-toolchain-r-test compiler: g++-7 - env: + env: - "MATRIX_EVAL=\"CC=gcc-7 && CXX=g++-7\"" os: linux - - - addons: - apt: + - + addons: + apt: packages: - g++-7 - clang-4.0 @@ -77,16 +77,16 @@ matrix: - xorg-dev - libglu1-mesa-dev - doxygen - sources: + sources: - ubuntu-toolchain-r-test - llvm-toolchain-trusty-4.0 compiler: clang++-4.0 - env: + env: - "MATRIX_EVAL=\"CC=clang-4.0 && CXX=clang++-4.0\"" os: linux - - - addons: - apt: + - + addons: + apt: packages: - g++-7 - clang-5.0 @@ -96,31 +96,31 @@ matrix: - xorg-dev - libglu1-mesa-dev - doxygen - sources: + sources: - ubuntu-toolchain-r-test - llvm-toolchain-trusty-5.0 compiler: clang++-5.0 - env: + env: - "MATRIX_EVAL=\"CC=clang-5.0 && CXX=clang++-5.0\"" os: linux -# - -# env: +# - +# env: # - "MATRIX_EVAL=\"rvm install ruby-2.3.3 && rvm use 2.3.3 && brew update && brew install gcc5 && CC=gcc-5 && CXX=g++-5\"" # os: osx # osx_image: xcode8 -# - -# env: +# - +# env: # - "MATRIX_EVAL=\"rvm install ruby-2.3.3 && rvm use 2.3.3 && brew update && brew install gcc6 && CC=gcc-6 && CXX=g++-6\"" # os: osx # osx_image: xcode8 -# - -# env: +# - +# env: # - "MATRIX_EVAL=\"rvm install ruby-2.3.3 && rvm use 2.3.3 && brew update && brew install gcc && CC=gcc-7 && CXX=g++-7\"" # os: osx # osx_image: xcode8 -notifications: +notifications: email: false -script: +script: - "$CC --version" - "$CXX --version" - "cd $TRAVIS_BUILD_DIR" -- cgit From 16905976c82c57fdc98a8988392354597f166a12 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 20 Dec 2017 13:12:19 +0000 Subject: improving compilation speed --- CMakeLists.txt | 1 + scripts/add_version_headers | 17 +++++++++++++---- yage/core/camera2d.cpp | 1 + yage/core/camera2d.h | 4 ++-- yage/core/imageloader.cpp | 4 +--- yage/core/imageloader.h | 4 ++-- yage/core/inputmanager.h | 2 ++ yage/core/logger.cpp | 2 ++ yage/core/logger.h | 3 +-- yage/core/logsink.h | 3 +++ yage/core/spritesheet.cpp | 33 ++++++++++++++++----------------- yage/core/spritesheet.h | 7 +++++-- yage/math/math.h | 14 -------------- yage/yage.h | 1 + 14 files changed, 50 insertions(+), 46 deletions(-) delete mode 100644 yage/math/math.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 957224a5..8fd23f7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,4 +55,5 @@ if(UNIT_TESTS) make_test(syncqueuetest 1) make_test(activetest 1) make_test(structtest ${SIMULATION_RUNS}) + make_test(defaultfiletest ${SIMULATION_RUNS}) endif() diff --git a/scripts/add_version_headers b/scripts/add_version_headers index c4fd3ffc..c3b26566 100755 --- a/scripts/add_version_headers +++ b/scripts/add_version_headers @@ -24,10 +24,12 @@ import os import re import sys +from subprocess import call -header = """/* ---------------------------------------------------------------\ -------------- - * {0} + +header = """/** ---------------------------------------------------------------\ +------------ + * @file: {0} * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. @@ -38,7 +40,7 @@ header = """/* ---------------------------------------------------------------\ lic_regex = re.compile( - "\/\* -+\n \* ([a-z]+\.(?:cpp|h)|\{0\})\n(?: \*[ a-zA-Z0-9_.,\-()<>@]*\n)+ \* -+\n \*/", re.MULTILINE) + "\/(?:\*|\*\*) -+\n \* ((?:@file: )?[a-z]+\.(?:cpp|h)|\{0\})\n(?: \*[ a-zA-Z0-9_.,\-()<>@]*\n)+ \* -+\n \*/", re.MULTILINE) class HeaderUpdate(object): @@ -102,12 +104,19 @@ class HeaderUpdate(object): not re.match(self.exclude_re, fileName)): fileOperation(os.path.join(subdir, fileName)) + def runClangFormat(self): + def clangFormatFileOpration(filePath): + call(["clang-format", "-i", filePath]) + + self._traverseDir(self.starting_dir, clangFormatFileOpration) + def main(argv): update = HeaderUpdate(exclude_re="^picopng\.cpp", match_dir=".*yage|.*tests", exclude_dir=".*lib.*|.*build.*") update.updateHeader() + update.runClangFormat() if __name__ == "__main__": diff --git a/yage/core/camera2d.cpp b/yage/core/camera2d.cpp index d5640c3f..a2d40a78 100644 --- a/yage/core/camera2d.cpp +++ b/yage/core/camera2d.cpp @@ -7,6 +7,7 @@ */ #include "camera2d.h" +#include "glslprogram.h" #include diff --git a/yage/core/camera2d.h b/yage/core/camera2d.h index 333f907d..5d2fc8a2 100644 --- a/yage/core/camera2d.h +++ b/yage/core/camera2d.h @@ -17,14 +17,14 @@ #ifndef YAGE_CAMERA2D_H #define YAGE_CAMERA2D_H -#include "glslprogram.h" - #include #include namespace yage { +class GlslProgram; + class Camera2D { private: diff --git a/yage/core/imageloader.cpp b/yage/core/imageloader.cpp index ae67a94a..45424799 100644 --- a/yage/core/imageloader.cpp +++ b/yage/core/imageloader.cpp @@ -7,11 +7,9 @@ */ #include "imageloader.h" +#include "texture.h" -#ifndef UNIT_TESTS #include -#endif - #include #include diff --git a/yage/core/imageloader.h b/yage/core/imageloader.h index ab9f9e4d..ca68bd58 100644 --- a/yage/core/imageloader.h +++ b/yage/core/imageloader.h @@ -9,13 +9,13 @@ #ifndef IMAGE_LOADER_H #define IMAGE_LOADER_H -#include "texture.h" - #include namespace yage { +class Texture; + class ImageLoader { public: diff --git a/yage/core/inputmanager.h b/yage/core/inputmanager.h index 9fabd997..4b74ed90 100644 --- a/yage/core/inputmanager.h +++ b/yage/core/inputmanager.h @@ -24,5 +24,7 @@ public: void keyReleased(unsigned key); bool isKeyPressed(unsigned key) const; }; + } // namespace yage + #endif diff --git a/yage/core/logger.cpp b/yage/core/logger.cpp index 7a58efb6..355de5bc 100644 --- a/yage/core/logger.cpp +++ b/yage/core/logger.cpp @@ -10,6 +10,8 @@ #include "logmessage.h" #include "logsink.h" +#include + #include #include #include diff --git a/yage/core/logger.h b/yage/core/logger.h index 76f38641..44c35227 100644 --- a/yage/core/logger.h +++ b/yage/core/logger.h @@ -9,8 +9,6 @@ #ifndef YAGE_CORE_LOGGER_H #define YAGE_CORE_LOGGER_H -#include - #include #include #include @@ -18,6 +16,7 @@ namespace yage { +class Active; class LogMessage; class LogSink; diff --git a/yage/core/logsink.h b/yage/core/logsink.h index 064abc63..b597fc24 100644 --- a/yage/core/logsink.h +++ b/yage/core/logsink.h @@ -6,9 +6,12 @@ * ---------------------------------------------------------------------------- */ +/// @file + #ifndef YAGE_CORE_LOGSINK_H #define YAGE_CORE_LOGSINK_H +/// @todo remove the include to make compilation faster #include "logmessage.h" #include diff --git a/yage/core/spritesheet.cpp b/yage/core/spritesheet.cpp index e18d7fe8..f61b668a 100644 --- a/yage/core/spritesheet.cpp +++ b/yage/core/spritesheet.cpp @@ -6,27 +6,26 @@ * ---------------------------------------------------------------------------- */ -/** @file - */ +/// @file #include "spritesheet.h" +#include +#include + #include #include #include #include -#include -#include - -using namespace std; -using namespace rapidjson; -using namespace yage::details; +using rapidjson::Document; +using yage::details::Coordinate; +using yage::details::SpriteMap; namespace yage { -SpriteSheet::SpriteSheet(string pngFileName, string jsonFileName) +SpriteSheet::SpriteSheet(std::string pngFileName, std::string jsonFileName) { int jsonWidth, jsonHeight; fileLocations_ = @@ -34,23 +33,23 @@ SpriteSheet::SpriteSheet(string pngFileName, string jsonFileName) texture_ = ImageLoader::loadPng(pngFileName); if (texture_.width != jsonWidth) - throw runtime_error("JSON width does not match texture width"); + throw std::runtime_error("JSON width does not match texture width"); if (texture_.height != jsonHeight) - throw runtime_error("JSON height does not match texture height"); + throw std::runtime_error("JSON height does not match texture height"); } -string SpriteSheet::fileContent(string jsonFileName) const +std::string SpriteSheet::fileContent(std::string jsonFileName) const { - ifstream inputFile(jsonFileName); + std::ifstream inputFile(jsonFileName); - stringstream stream; + std::stringstream stream; stream << inputFile.rdbuf(); return stream.str(); } SpriteMap SpriteSheet::parseJson(int &width, int &height, - string jsonContent) const + std::string jsonContent) const { SpriteMap spriteMap; Document jsonAtlas; @@ -62,7 +61,7 @@ SpriteMap SpriteSheet::parseJson(int &width, int &height, for (auto &texture : jsonAtlas["sprites"].GetObject()) { Coordinate coord; for (auto &value : texture.value.GetObject()) { - string keyName{value.value.GetString()}; + std::string keyName{value.value.GetString()}; int keyValue{value.value.GetInt()}; if (keyName == "x") { coord.x = keyValue; @@ -73,7 +72,7 @@ SpriteMap SpriteSheet::parseJson(int &width, int &height, } else if (keyName == "height") { coord.height = keyValue; } else { - throw runtime_error("JSON key incorrect: " + keyName); + throw std::runtime_error("JSON key incorrect: " + keyName); } } spriteMap[texture.name.GetString()] = coord; diff --git a/yage/core/spritesheet.h b/yage/core/spritesheet.h index 2ead0ba1..6ae8d266 100644 --- a/yage/core/spritesheet.h +++ b/yage/core/spritesheet.h @@ -6,12 +6,15 @@ * ---------------------------------------------------------------------------- */ -/** @file - */ +/// @file #ifndef YAGE_SPRITESHEET_H #define YAGE_SPRITESHEET_H +/** @todo think of removing this, by, for example, using a pointer + * This could be more efficient when copying the texture out of the + * spritesheet. + */ #include "texture.h" #include diff --git a/yage/math/math.h b/yage/math/math.h deleted file mode 100644 index 87f1af6c..00000000 --- a/yage/math/math.h +++ /dev/null @@ -1,14 +0,0 @@ -/* ---------------------------------------------------------------------------- - * math.h - * - * Copyright (c) 2017 Yann Herklotz Grave - * MIT License, see LICENSE file for more details. - * ---------------------------------------------------------------------------- - */ - -#ifndef YAGE_MATH_H -#define YAGE_MATH_H - -#include "matrix.h" - -#endif diff --git a/yage/yage.h b/yage/yage.h index 630bc1be..f15b9ad0 100644 --- a/yage/yage.h +++ b/yage/yage.h @@ -15,6 +15,7 @@ #define YAGE_YAGE_H #include "core/camera2d.h" +#include "core/defaultfile.h" #include "core/glslprogram.h" #include "core/imageloader.h" #include "core/inputmanager.h" -- cgit From c60164953dd6a4ee485c42211a3bcf8ee9eba06f Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 20 Dec 2017 14:38:14 +0000 Subject: Fixed license headers --- scripts/add_version_headers | 12 +++++++----- tests/activetest.cpp | 4 ++-- tests/logtest.cpp | 6 ++---- tests/matrixtest.cpp | 6 ++---- tests/particlebodytest.cpp | 6 ++---- tests/rendertest.cpp | 14 ++++---------- tests/rendertest.h | 6 ++---- tests/simplegame.cpp | 4 ++-- tests/spritesheettest.cpp | 6 ++---- tests/structtest.cpp | 14 +++++++++++--- tests/syncqueuetest.cpp | 4 ++-- tests/threadtest.cpp | 8 +++----- tests/vector3test.cpp | 38 ++++++++++++++++++++++++++++++-------- tests/vector4test.cpp | 32 ++++++++++++++++++++++++++++---- tests/windowtest.cpp | 8 +++----- tests/yagetest.cpp | 12 +++++------- yage/core/camera2d.cpp | 4 ++-- yage/core/camera2d.h | 12 ++---------- yage/core/glslprogram.cpp | 8 +++----- yage/core/glslprogram.h | 4 ++-- yage/core/imageloader.cpp | 4 ++-- yage/core/imageloader.h | 4 ++-- yage/core/inputmanager.cpp | 4 ++-- yage/core/inputmanager.h | 4 ++-- yage/core/iomanager.cpp | 4 ++-- yage/core/iomanager.h | 4 ++-- yage/core/logger.cpp | 4 ++-- yage/core/logger.h | 4 ++-- yage/core/loglevel.h | 4 ++-- yage/core/logmessage.cpp | 4 ++-- yage/core/logmessage.h | 4 ++-- yage/core/logsink.cpp | 4 ++-- yage/core/logsink.h | 4 ++-- yage/core/picopng.h | 4 ++-- yage/core/resourcemanager.cpp | 4 ++-- yage/core/resourcemanager.h | 12 ++++++------ yage/core/sprite.cpp | 4 ++-- yage/core/sprite.h | 4 ++-- yage/core/spritebatch.cpp | 4 ++-- yage/core/spritebatch.h | 8 ++++---- yage/core/spritesheet.cpp | 4 ++-- yage/core/spritesheet.h | 8 ++++---- yage/core/texture.h | 4 ++-- yage/core/texturecache.cpp | 4 ++-- yage/core/texturecache.h | 4 ++-- yage/core/vertex.h | 4 ++-- yage/core/window.cpp | 4 ++-- yage/core/window.h | 4 ++-- yage/math/matrix.h | 4 ++-- yage/physics/body.cpp | 4 ++-- yage/physics/body.h | 4 ++-- yage/physics/collider.h | 4 ++-- yage/physics/collisionbody.h | 4 ++-- yage/physics/particlebody.cpp | 4 ++-- yage/physics/particlebody.h | 4 ++-- yage/physics/physics.h | 4 ++-- yage/physics/rectanglecollider.cpp | 4 ++-- yage/physics/rectanglecollider.h | 4 ++-- yage/physics/rigidbody.cpp | 4 ++-- yage/physics/rigidbody.h | 4 ++-- yage/util/active.cpp | 4 ++-- yage/util/active.h | 4 ++-- yage/util/syncqueue.h | 4 ++-- yage/yage.cpp | 4 ++-- yage/yage.h | 4 ++-- 65 files changed, 214 insertions(+), 190 deletions(-) diff --git a/scripts/add_version_headers b/scripts/add_version_headers index c3b26566..cf1531b0 100755 --- a/scripts/add_version_headers +++ b/scripts/add_version_headers @@ -40,7 +40,7 @@ header = """/** ---------------------------------------------------------------\ lic_regex = re.compile( - "\/(?:\*|\*\*) -+\n \* ((?:@file: )?[a-z]+\.(?:cpp|h)|\{0\})\n(?: \*[ a-zA-Z0-9_.,\-()<>@]*\n)+ \* -+\n \*/", re.MULTILINE) + "\/(?:\*|\*\*) -+\n \* ((?:@file: )?[a-z0-9]+\.(?:cpp|h)|\{0\})\n(?: \*[ a-zA-Z0-9_.,\-()<>@]*\n)+ \* -+\n \*/\n\n", re.MULTILINE) class HeaderUpdate(object): @@ -77,11 +77,13 @@ class HeaderUpdate(object): src = f.read() f.seek(0) if lic_regex.match(src): - print("Updating {}: ".format( - os.path.basename(filePath)), end="") - src = lic_regex.sub(header.format( + other_src = lic_regex.sub(header.format( os.path.basename(filePath)), src) - print("done") + if other_src != src: + print("Updating {}: ".format( + os.path.basename(filePath)), end="") + src = other_src + print("done") else: print("Adding {}: ".format( os.path.basename(filePath)), end="") diff --git a/tests/activetest.cpp b/tests/activetest.cpp index cebf90d3..3d561283 100644 --- a/tests/activetest.cpp +++ b/tests/activetest.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * activetest.cpp +/** --------------------------------------------------------------------------- + * @file: activetest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/tests/logtest.cpp b/tests/logtest.cpp index 74a71057..e1010754 100644 --- a/tests/logtest.cpp +++ b/tests/logtest.cpp @@ -1,13 +1,11 @@ -/* ---------------------------------------------------------------------------- - * logtest.cpp +/** --------------------------------------------------------------------------- + * @file: logtest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ - - #include #include diff --git a/tests/matrixtest.cpp b/tests/matrixtest.cpp index be2ca186..1e316502 100644 --- a/tests/matrixtest.cpp +++ b/tests/matrixtest.cpp @@ -1,13 +1,11 @@ -/* ---------------------------------------------------------------------------- - * matrixtest.cpp +/** --------------------------------------------------------------------------- + * @file: matrixtest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ - - #include #include diff --git a/tests/particlebodytest.cpp b/tests/particlebodytest.cpp index 511e3ef5..09277826 100644 --- a/tests/particlebodytest.cpp +++ b/tests/particlebodytest.cpp @@ -1,13 +1,11 @@ -/* ---------------------------------------------------------------------------- - * particlebodytest.cpp +/** --------------------------------------------------------------------------- + * @file: particlebodytest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ - - #include #include diff --git a/tests/rendertest.cpp b/tests/rendertest.cpp index a0452ab4..74476ef8 100644 --- a/tests/rendertest.cpp +++ b/tests/rendertest.cpp @@ -1,19 +1,13 @@ -/* ---------------------------------------------------------------------------- - * rendertest.cpp +/** --------------------------------------------------------------------------- + * @file: rendertest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ - - #include "rendertest.h" -RenderTest::RenderTest(std::string sprite) : sprite_(sprite) -{ -} +RenderTest::RenderTest(std::string sprite) : sprite_(sprite) {} -void RenderTest::render() -{ -} +void RenderTest::render() {} diff --git a/tests/rendertest.h b/tests/rendertest.h index f6ed36c6..db0e06e2 100644 --- a/tests/rendertest.h +++ b/tests/rendertest.h @@ -1,13 +1,11 @@ -/* ---------------------------------------------------------------------------- - * rendertest.h +/** --------------------------------------------------------------------------- + * @file: rendertest.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ - - #include class RenderTest diff --git a/tests/simplegame.cpp b/tests/simplegame.cpp index 99796f08..08f9f8c5 100644 --- a/tests/simplegame.cpp +++ b/tests/simplegame.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * simplegame.cpp +/** --------------------------------------------------------------------------- + * @file: simplegame.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/tests/spritesheettest.cpp b/tests/spritesheettest.cpp index 2ece61bf..fcfc842c 100644 --- a/tests/spritesheettest.cpp +++ b/tests/spritesheettest.cpp @@ -1,13 +1,11 @@ -/* ---------------------------------------------------------------------------- - * spritesheettest.cpp +/** --------------------------------------------------------------------------- + * @file: spritesheettest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ - - /** @file */ #include diff --git a/tests/structtest.cpp b/tests/structtest.cpp index 13a2c591..99752abb 100644 --- a/tests/structtest.cpp +++ b/tests/structtest.cpp @@ -1,8 +1,16 @@ -#include +/** --------------------------------------------------------------------------- + * @file: structtest.cpp + * + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + #include +#include -#include #include +#include TEST(StructTest, ColourDefault) { @@ -15,7 +23,7 @@ TEST(StructTest, ColourDefault) TEST(StructTest, ColourConstructor) { - int r = rand()%255, g = rand()%255, b = rand() % 255, a = rand() % 255; + int r = rand() % 255, g = rand() % 255, b = rand() % 255, a = rand() % 255; yage::Colour c(r, g, b, a); ASSERT_EQ(c.r, r); diff --git a/tests/syncqueuetest.cpp b/tests/syncqueuetest.cpp index db347854..1d7d8037 100644 --- a/tests/syncqueuetest.cpp +++ b/tests/syncqueuetest.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * syncqueuetest.cpp +/** --------------------------------------------------------------------------- + * @file: syncqueuetest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/tests/threadtest.cpp b/tests/threadtest.cpp index 9ea46e62..0527665a 100644 --- a/tests/threadtest.cpp +++ b/tests/threadtest.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * threadtest.cpp +/** --------------------------------------------------------------------------- + * @file: threadtest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. @@ -17,9 +17,7 @@ int main() std::cout << "n before: " << n << "\n"; - auto f = [&] () { - n = 8; - }; + auto f = [&]() { n = 8; }; std::thread t1(f); diff --git a/tests/vector3test.cpp b/tests/vector3test.cpp index daab02af..570a5c10 100644 --- a/tests/vector3test.cpp +++ b/tests/vector3test.cpp @@ -1,13 +1,37 @@ -/* ---------------------------------------------------------------------------- - * vector3test.cpp +/** --------------------------------------------------------------------------- + * @file: vector3test.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- - * vector3test.cpp +/** --------------------------------------------------------------------------- + * @file: vector3test.cpp + * + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + +/** --------------------------------------------------------------------------- + * @file: vector3test.cpp + * + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + +/** --------------------------------------------------------------------------- + * @file: vector3test.cpp + * + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + +/** --------------------------------------------------------------------------- + * @file: vector3test.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. @@ -17,8 +41,8 @@ #include #include -#include #include +#include using namespace yage; @@ -60,9 +84,7 @@ TEST(Vector3, Assigning_z) ASSERT_EQ(vec.z, vec[2]); } -TEST(Vector3, Addition) -{ -} +TEST(Vector3, Addition) {} int main(int argc, char **argv) { diff --git a/tests/vector4test.cpp b/tests/vector4test.cpp index fd67d802..53554a25 100644 --- a/tests/vector4test.cpp +++ b/tests/vector4test.cpp @@ -1,13 +1,37 @@ -/* ---------------------------------------------------------------------------- - * vector4test.cpp +/** --------------------------------------------------------------------------- + * @file: vector4test.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- - * vector4test.cpp +/** --------------------------------------------------------------------------- + * @file: vector4test.cpp + * + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + +/** --------------------------------------------------------------------------- + * @file: vector4test.cpp + * + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + +/** --------------------------------------------------------------------------- + * @file: vector4test.cpp + * + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + +/** --------------------------------------------------------------------------- + * @file: vector4test.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/tests/windowtest.cpp b/tests/windowtest.cpp index 53ff3e9c..40b7e664 100644 --- a/tests/windowtest.cpp +++ b/tests/windowtest.cpp @@ -1,15 +1,13 @@ -/* ---------------------------------------------------------------------------- - * windowtest.cpp +/** --------------------------------------------------------------------------- + * @file: windowtest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ - - -#include #include +#include TEST(Window, Open) { diff --git a/tests/yagetest.cpp b/tests/yagetest.cpp index 2e961327..a599eba2 100644 --- a/tests/yagetest.cpp +++ b/tests/yagetest.cpp @@ -1,23 +1,21 @@ -/* ---------------------------------------------------------------------------- - * yagetest.cpp +/** --------------------------------------------------------------------------- + * @file: yagetest.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ - - -#include #include +#include TEST(YAGE, InitQuit) { try { yage::init(); yage::quit(); - } catch(std::runtime_error e) { -// ASSERT_TRUE(false); + } catch (std::runtime_error e) { + // ASSERT_TRUE(false); } } diff --git a/yage/core/camera2d.cpp b/yage/core/camera2d.cpp index a2d40a78..89d41ab5 100644 --- a/yage/core/camera2d.cpp +++ b/yage/core/camera2d.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * camera2d.cpp +/** --------------------------------------------------------------------------- + * @file: camera2d.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/camera2d.h b/yage/core/camera2d.h index 5d2fc8a2..db941aee 100644 --- a/yage/core/camera2d.h +++ b/yage/core/camera2d.h @@ -1,13 +1,5 @@ -/* ---------------------------------------------------------------------------- - * camera2d.h - * - * Copyright (c) 2017 Yann Herklotz Grave - * MIT License, see LICENSE file for more details. - * ---------------------------------------------------------------------------- - */ - -/* ---------------------------------------------------------------------------- - * camera2d.h +/** --------------------------------------------------------------------------- + * @file: camera2d.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/glslprogram.cpp b/yage/core/glslprogram.cpp index 4772d50e..769eb4eb 100644 --- a/yage/core/glslprogram.cpp +++ b/yage/core/glslprogram.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * glslprogram.cpp +/** --------------------------------------------------------------------------- + * @file: glslprogram.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. @@ -159,8 +159,6 @@ void GlslProgram::unuse() glUseProgram(0); } -void GlslProgram::defaultSetup() -{ -} +void GlslProgram::defaultSetup() {} } // namespace yage diff --git a/yage/core/glslprogram.h b/yage/core/glslprogram.h index 50b2a7de..729ed427 100644 --- a/yage/core/glslprogram.h +++ b/yage/core/glslprogram.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * glslprogram.h +/** --------------------------------------------------------------------------- + * @file: glslprogram.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/imageloader.cpp b/yage/core/imageloader.cpp index 45424799..fb4d1e44 100644 --- a/yage/core/imageloader.cpp +++ b/yage/core/imageloader.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * imageloader.cpp +/** --------------------------------------------------------------------------- + * @file: imageloader.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/imageloader.h b/yage/core/imageloader.h index ca68bd58..bc041dc6 100644 --- a/yage/core/imageloader.h +++ b/yage/core/imageloader.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * imageloader.h +/** --------------------------------------------------------------------------- + * @file: imageloader.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/inputmanager.cpp b/yage/core/inputmanager.cpp index 7f4e121a..1f324b9e 100644 --- a/yage/core/inputmanager.cpp +++ b/yage/core/inputmanager.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * inputmanager.cpp +/** --------------------------------------------------------------------------- + * @file: inputmanager.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/inputmanager.h b/yage/core/inputmanager.h index 4b74ed90..e8dd153a 100644 --- a/yage/core/inputmanager.h +++ b/yage/core/inputmanager.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * inputmanager.h +/** --------------------------------------------------------------------------- + * @file: inputmanager.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/iomanager.cpp b/yage/core/iomanager.cpp index 33286d5d..3d9ea7cb 100644 --- a/yage/core/iomanager.cpp +++ b/yage/core/iomanager.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * iomanager.cpp +/** --------------------------------------------------------------------------- + * @file: iomanager.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/iomanager.h b/yage/core/iomanager.h index 14ad2d16..6c623adf 100644 --- a/yage/core/iomanager.h +++ b/yage/core/iomanager.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * iomanager.h +/** --------------------------------------------------------------------------- + * @file: iomanager.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/logger.cpp b/yage/core/logger.cpp index 355de5bc..4690fadc 100644 --- a/yage/core/logger.cpp +++ b/yage/core/logger.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * logger.cpp +/** --------------------------------------------------------------------------- + * @file: logger.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/logger.h b/yage/core/logger.h index 44c35227..95af73b0 100644 --- a/yage/core/logger.h +++ b/yage/core/logger.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * logger.h +/** --------------------------------------------------------------------------- + * @file: logger.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/loglevel.h b/yage/core/loglevel.h index ca763321..eb9ff5f8 100644 --- a/yage/core/loglevel.h +++ b/yage/core/loglevel.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * loglevel.h +/** --------------------------------------------------------------------------- + * @file: loglevel.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/logmessage.cpp b/yage/core/logmessage.cpp index 172cef4b..1ae16fba 100644 --- a/yage/core/logmessage.cpp +++ b/yage/core/logmessage.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * logmessage.cpp +/** --------------------------------------------------------------------------- + * @file: logmessage.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/logmessage.h b/yage/core/logmessage.h index 75a8cf47..ef7fd8a5 100644 --- a/yage/core/logmessage.h +++ b/yage/core/logmessage.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * logmessage.h +/** --------------------------------------------------------------------------- + * @file: logmessage.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/logsink.cpp b/yage/core/logsink.cpp index 2f59d620..36d7038b 100644 --- a/yage/core/logsink.cpp +++ b/yage/core/logsink.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * logsink.cpp +/** --------------------------------------------------------------------------- + * @file: logsink.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/logsink.h b/yage/core/logsink.h index b597fc24..63f95655 100644 --- a/yage/core/logsink.h +++ b/yage/core/logsink.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * logsink.h +/** --------------------------------------------------------------------------- + * @file: logsink.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/picopng.h b/yage/core/picopng.h index 9b2cb081..d868fa43 100644 --- a/yage/core/picopng.h +++ b/yage/core/picopng.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * picopng.h +/** --------------------------------------------------------------------------- + * @file: picopng.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/resourcemanager.cpp b/yage/core/resourcemanager.cpp index 3fefc4f5..f841222b 100644 --- a/yage/core/resourcemanager.cpp +++ b/yage/core/resourcemanager.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * resourcemanager.cpp +/** --------------------------------------------------------------------------- + * @file: resourcemanager.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/resourcemanager.h b/yage/core/resourcemanager.h index 8fc6a16e..369bf40f 100644 --- a/yage/core/resourcemanager.h +++ b/yage/core/resourcemanager.h @@ -1,16 +1,16 @@ -/* ---------------------------------------------------------------------------- - * resourcemanager.h +/** --------------------------------------------------------------------------- + * @file: resourcemanager.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- - * resourcemanager.h +/** --------------------------------------------------------------------------- + * @file: resourcemanager.h * - * Copyright (c) 2017 Yann Herklotz Grave -- MIT License - * See file LICENSE for more details + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. * ---------------------------------------------------------------------------- */ diff --git a/yage/core/sprite.cpp b/yage/core/sprite.cpp index 041281d3..a663c379 100644 --- a/yage/core/sprite.cpp +++ b/yage/core/sprite.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * sprite.cpp +/** --------------------------------------------------------------------------- + * @file: sprite.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/sprite.h b/yage/core/sprite.h index 9cba1daf..0287fe10 100644 --- a/yage/core/sprite.h +++ b/yage/core/sprite.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * sprite.h +/** --------------------------------------------------------------------------- + * @file: sprite.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/spritebatch.cpp b/yage/core/spritebatch.cpp index 98213467..2159aeec 100644 --- a/yage/core/spritebatch.cpp +++ b/yage/core/spritebatch.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * spritebatch.cpp +/** --------------------------------------------------------------------------- + * @file: spritebatch.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/spritebatch.h b/yage/core/spritebatch.h index d90d6d05..fa93c5cb 100644 --- a/yage/core/spritebatch.h +++ b/yage/core/spritebatch.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * spritebatch.h +/** --------------------------------------------------------------------------- + * @file: spritebatch.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. @@ -94,8 +94,8 @@ public: // adds a sprite to the sprite batch to be rendered later void draw(const yage::Vector4f &destination_rect, - const yage::Vector4f &uv_rect, GLuint texture, const Colour &colour, - float depth); + const yage::Vector4f &uv_rect, GLuint texture, + const Colour &colour, float depth); // render the batch void render(); diff --git a/yage/core/spritesheet.cpp b/yage/core/spritesheet.cpp index f61b668a..7fbd19e9 100644 --- a/yage/core/spritesheet.cpp +++ b/yage/core/spritesheet.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * spritesheet.cpp +/** --------------------------------------------------------------------------- + * @file: spritesheet.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/spritesheet.h b/yage/core/spritesheet.h index 6ae8d266..7d7c2fcf 100644 --- a/yage/core/spritesheet.h +++ b/yage/core/spritesheet.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * spritesheet.h +/** --------------------------------------------------------------------------- + * @file: spritesheet.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. @@ -11,8 +11,8 @@ #ifndef YAGE_SPRITESHEET_H #define YAGE_SPRITESHEET_H -/** @todo think of removing this, by, for example, using a pointer - * This could be more efficient when copying the texture out of the +/** @todo think of removing this, by, for example, using a pointer + * This could be more efficient when copying the texture out of the * spritesheet. */ #include "texture.h" diff --git a/yage/core/texture.h b/yage/core/texture.h index 85f74647..2eae8bf4 100644 --- a/yage/core/texture.h +++ b/yage/core/texture.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * texture.h +/** --------------------------------------------------------------------------- + * @file: texture.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/texturecache.cpp b/yage/core/texturecache.cpp index d94340ff..f9468dbb 100644 --- a/yage/core/texturecache.cpp +++ b/yage/core/texturecache.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * texturecache.cpp +/** --------------------------------------------------------------------------- + * @file: texturecache.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/texturecache.h b/yage/core/texturecache.h index a9a18693..58dcd4eb 100644 --- a/yage/core/texturecache.h +++ b/yage/core/texturecache.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * texturecache.h +/** --------------------------------------------------------------------------- + * @file: texturecache.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/vertex.h b/yage/core/vertex.h index f81b4f42..4cd095a9 100644 --- a/yage/core/vertex.h +++ b/yage/core/vertex.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * vertex.h +/** --------------------------------------------------------------------------- + * @file: vertex.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/window.cpp b/yage/core/window.cpp index 3508e835..9696f2bb 100644 --- a/yage/core/window.cpp +++ b/yage/core/window.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * window.cpp +/** --------------------------------------------------------------------------- + * @file: window.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/core/window.h b/yage/core/window.h index 57e21ae4..c350955e 100644 --- a/yage/core/window.h +++ b/yage/core/window.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * window.h +/** --------------------------------------------------------------------------- + * @file: window.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/math/matrix.h b/yage/math/matrix.h index 90a763cf..ac612385 100644 --- a/yage/math/matrix.h +++ b/yage/math/matrix.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * matrix.h +/** --------------------------------------------------------------------------- + * @file: matrix.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/body.cpp b/yage/physics/body.cpp index b5283d76..d04eecfd 100644 --- a/yage/physics/body.cpp +++ b/yage/physics/body.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * body.cpp +/** --------------------------------------------------------------------------- + * @file: body.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/body.h b/yage/physics/body.h index 312ceb58..0a6bbe42 100644 --- a/yage/physics/body.h +++ b/yage/physics/body.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * body.h +/** --------------------------------------------------------------------------- + * @file: body.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/collider.h b/yage/physics/collider.h index fe070fa6..220c785d 100644 --- a/yage/physics/collider.h +++ b/yage/physics/collider.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * collider.h +/** --------------------------------------------------------------------------- + * @file: collider.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/collisionbody.h b/yage/physics/collisionbody.h index 62f12ade..c779feae 100644 --- a/yage/physics/collisionbody.h +++ b/yage/physics/collisionbody.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * collisionbody.h +/** --------------------------------------------------------------------------- + * @file: collisionbody.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/particlebody.cpp b/yage/physics/particlebody.cpp index 91078d45..dc950ae6 100644 --- a/yage/physics/particlebody.cpp +++ b/yage/physics/particlebody.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * particlebody.cpp +/** --------------------------------------------------------------------------- + * @file: particlebody.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/particlebody.h b/yage/physics/particlebody.h index 336c0bd0..2e7a4f88 100644 --- a/yage/physics/particlebody.h +++ b/yage/physics/particlebody.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * particlebody.h +/** --------------------------------------------------------------------------- + * @file: particlebody.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/physics.h b/yage/physics/physics.h index fb42b257..64dcd95f 100644 --- a/yage/physics/physics.h +++ b/yage/physics/physics.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * physics.h +/** --------------------------------------------------------------------------- + * @file: physics.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/rectanglecollider.cpp b/yage/physics/rectanglecollider.cpp index ea70611f..e1b3adff 100644 --- a/yage/physics/rectanglecollider.cpp +++ b/yage/physics/rectanglecollider.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * rectanglecollider.cpp +/** --------------------------------------------------------------------------- + * @file: rectanglecollider.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/rectanglecollider.h b/yage/physics/rectanglecollider.h index 62d1033c..ba3bdead 100644 --- a/yage/physics/rectanglecollider.h +++ b/yage/physics/rectanglecollider.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * rectanglecollider.h +/** --------------------------------------------------------------------------- + * @file: rectanglecollider.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/rigidbody.cpp b/yage/physics/rigidbody.cpp index ea58efeb..1a7ae2ec 100644 --- a/yage/physics/rigidbody.cpp +++ b/yage/physics/rigidbody.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * rigidbody.cpp +/** --------------------------------------------------------------------------- + * @file: rigidbody.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/physics/rigidbody.h b/yage/physics/rigidbody.h index cbf01109..dae9f8e5 100644 --- a/yage/physics/rigidbody.h +++ b/yage/physics/rigidbody.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * rigidbody.h +/** --------------------------------------------------------------------------- + * @file: rigidbody.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/util/active.cpp b/yage/util/active.cpp index 1516b7d3..0eaeeb80 100644 --- a/yage/util/active.cpp +++ b/yage/util/active.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * active.cpp +/** --------------------------------------------------------------------------- + * @file: active.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/util/active.h b/yage/util/active.h index b7137a47..d1d9ba4c 100644 --- a/yage/util/active.h +++ b/yage/util/active.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * active.h +/** --------------------------------------------------------------------------- + * @file: active.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/util/syncqueue.h b/yage/util/syncqueue.h index ab9204e3..f1c7d65d 100644 --- a/yage/util/syncqueue.h +++ b/yage/util/syncqueue.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * syncqueue.h +/** --------------------------------------------------------------------------- + * @file: syncqueue.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/yage.cpp b/yage/yage.cpp index 80333766..597a4613 100644 --- a/yage/yage.cpp +++ b/yage/yage.cpp @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * yage.cpp +/** --------------------------------------------------------------------------- + * @file: yage.cpp * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. diff --git a/yage/yage.h b/yage/yage.h index f15b9ad0..36729214 100644 --- a/yage/yage.h +++ b/yage/yage.h @@ -1,5 +1,5 @@ -/* ---------------------------------------------------------------------------- - * yage.h +/** --------------------------------------------------------------------------- + * @file: yage.h * * Copyright (c) 2017 Yann Herklotz Grave * MIT License, see LICENSE file for more details. -- cgit From b885965a6375f98d6bec63a43233461f9f42006d Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 20 Dec 2017 17:39:48 +0000 Subject: Added default shaders, update version script --- CMakeLists.txt | 3 +- docs/Doxyfile | 2 +- scripts/update_version | 38 ++++++++++++++++++ tests/simplegame.cpp | 8 +--- yage/core/glslprogram.cpp | 99 +++++++++++++++++++++++++++++++++++------------ yage/core/glslprogram.h | 10 +++-- yage/yage.h | 1 - 7 files changed, 123 insertions(+), 38 deletions(-) create mode 100755 scripts/update_version diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fd23f7e..0ea75fa1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0) # yage library cmakelists.txt project(yage - VERSION 0.3.1.0 + VERSION 0.1.3.0 LANGUAGES CXX) if(NOT DEFINED UNIT_TESTS) @@ -55,5 +55,4 @@ if(UNIT_TESTS) make_test(syncqueuetest 1) make_test(activetest 1) make_test(structtest ${SIMULATION_RUNS}) - make_test(defaultfiletest ${SIMULATION_RUNS}) endif() diff --git a/docs/Doxyfile b/docs/Doxyfile index 3e499988..10422fba 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "YAGE" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v0.3.1 +PROJECT_NUMBER = v0.1.3 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/scripts/update_version b/scripts/update_version new file mode 100755 index 00000000..9c618fa6 --- /dev/null +++ b/scripts/update_version @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# ----------------------------------------------------------------------------- +# @file: add_version_headers +# +# Copyright (c) 2017 Yann Herklotz Grave +# MIT License, see LICENSE file for more details. +# ----------------------------------------------------------------------------- + + +import os +import re +import sys + + +def main(argv): + cwd = os.path.join(os.getcwd(), argv[2]) + cmake = os.path.join(cwd, "CMakeLists.txt") + doxyfile = os.path.join(cwd, "docs", "Doxyfile") + + with open(cmake, "r+") as f_: + src = f_.read() + f_.seek(0) + src = re.sub(r"(project\(\w+\s+VERSION\s+)[0-9.]+", r"\g<1>{0}.0".format(argv[1]), src, re.MULTILINE) + f_.write(src) + f_.truncate() + + with open(doxyfile, "r+") as f_: + src = f_.read() + f_.seek(0) + src = re.sub(r"(PROJECT_NUMBER\s+=\s+v)[0-9.]+", r"\g<1>{0}".format(argv[1]), src, re.MULTILINE) + f_.write(src) + f_.truncate() + + return 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/tests/simplegame.cpp b/tests/simplegame.cpp index 08f9f8c5..d4c7b266 100644 --- a/tests/simplegame.cpp +++ b/tests/simplegame.cpp @@ -22,13 +22,7 @@ int main() window.create("Simple Game", 800, 640); SpriteBatch sp; - program.compileShaders( - "/home/yannherklotz/Github/YAGE/resources/defaultshader.vert", - "/home/yannherklotz/Github/YAGE/resources/defaultshader.frag"); - program.addAttribute("vertex_position"); - program.addAttribute("vertex_colour"); - program.addAttribute("vertex_uv"); - program.linkShaders(); + program.defaultSetup(); Texture fountain = ResourceManager::getTexture("/home/yannherklotz/Github/YAGE/tests/" diff --git a/yage/core/glslprogram.cpp b/yage/core/glslprogram.cpp index 769eb4eb..c47de808 100644 --- a/yage/core/glslprogram.cpp +++ b/yage/core/glslprogram.cpp @@ -17,7 +17,7 @@ namespace yage GlslProgram::~GlslProgram() { - // cleanup all the shaders and the program + /// cleans up all the shaders and the program if (fragment_shader_id_ != 0) { glDeleteShader(fragment_shader_id_); } @@ -31,26 +31,11 @@ GlslProgram::~GlslProgram() } } -void GlslProgram::compileShader(const GLuint &shader, - const std::string &file_path) +void GlslProgram::compileShader(GLuint shader, const std::string &shaderContent) { - // get a string with the input from the shader file - std::ifstream file(file_path); - if (!file.is_open()) { - throw std::runtime_error("Failed to open '" + file_path + "'"); - } - - std::string content = ""; - std::string line; - - while (std::getline(file, line)) { - content += line + "\n"; - } - file.close(); - // cast source to a c string to get the address of it and input it for // compilation - const auto *vertex_source = (const GLchar *)content.c_str(); + const auto *vertex_source = (const GLchar *)shaderContent.c_str(); glShaderSource(shader, 1, &vertex_source, nullptr); glCompileShader(shader); @@ -67,13 +52,38 @@ void GlslProgram::compileShader(const GLuint &shader, glGetShaderInfoLog(shader, max_length, &max_length, &error_log[0]); std::string error_log_str((const char *)&error_log[0]); - throw std::runtime_error("Couldn't compile " + file_path + " : " + + std::string shaderName; + if (shader == vertex_shader_id_) + shaderName = "vertex shader"; + else + shaderName = "fragment shader"; + + throw std::runtime_error("Couldn't compile the " + shaderName + " : " + error_log_str); } } -void GlslProgram::compileShaders(const std::string &vertex_shader_path, - const std::string &fragment_shader_path) +void GlslProgram::compileShaderFromFile(GLuint shader, + const std::string &file_path) +{ + // get a string with the input from the shader file + std::ifstream file(file_path); + if (!file.is_open()) { + throw std::runtime_error("Failed to open '" + file_path + "'"); + } + + std::string content = ""; + std::string line; + + while (std::getline(file, line)) { + content += line + "\n"; + } + file.close(); + + compileShader(shader, content); +} + +void GlslProgram::initShaderId() { // create the program that will be run on GPU program_id_ = glCreateProgram(); @@ -89,10 +99,26 @@ void GlslProgram::compileShaders(const std::string &vertex_shader_path, if (fragment_shader_id_ == 0) { throw std::runtime_error("Fragment shader failed to be created"); } +} + +void GlslProgram::compileShaders(const std::string &vertexShader, + const std::string fragmentShader) +{ + initShaderId(); + + compileShader(vertex_shader_id_, vertexShader); + compileShader(fragment_shader_id_, fragmentShader); +} + +void GlslProgram::compileShadersFromFile( + const std::string &vertex_shader_path, + const std::string &fragment_shader_path) +{ + initShaderId(); // compile the two shaders - compileShader(vertex_shader_id_, vertex_shader_path); - compileShader(fragment_shader_id_, fragment_shader_path); + compileShaderFromFile(vertex_shader_id_, vertex_shader_path); + compileShaderFromFile(fragment_shader_id_, fragment_shader_path); } void GlslProgram::linkShaders() @@ -159,6 +185,31 @@ void GlslProgram::unuse() glUseProgram(0); } -void GlslProgram::defaultSetup() {} +void GlslProgram::defaultSetup() +{ + std::string vertexShader = + "#version 130\n\nin vec2 vertex_position;\nin vec4 vertex_colour;\nin " + "vec2 vertex_uv;\n\nout vec2 fragment_position;\nout vec4 " + "fragment_colour;\nout vec2 fragment_uv;\n\nuniform mat4 P;\n\nvoid " + "main()\n{\n gl_Position.xy = (P*vec4(vertex_position, 0.0, " + "1.0)).xy;\n gl_Position.z = 0.0;\n gl_Position.w = 1.0;\n\n " + "fragment_position = vertex_position;\n fragment_colour = " + "vertex_colour;\n fragment_uv = vec2(vertex_uv.x, " + "1-vertex_uv.y);\n\n}"; + + std::string fragmentShader = + "#version 130\n\nin vec2 fragment_position;\nin vec4 " + "fragment_colour;\nin vec2 fragment_uv;\n\nout vec4 colour;\n\nuniform " + "sampler2D texture_sampler;\n\nvoid main()\n{\n vec4 texture_color " + "= texture(texture_sampler, fragment_uv);\n\n colour = " + "texture_color;\n}"; + + compileShaders(vertexShader, fragmentShader); + addAttribute("vertex_position"); + addAttribute("vertex_colour"); + addAttribute("vertex_uv"); + + linkShaders(); +} } // namespace yage diff --git a/yage/core/glslprogram.h b/yage/core/glslprogram.h index 729ed427..9e49d329 100644 --- a/yage/core/glslprogram.h +++ b/yage/core/glslprogram.h @@ -28,8 +28,10 @@ public: GlslProgram &operator=(GlslProgram &&) = delete; /// compiles vertex and fragment shader - void compileShaders(const std::string &vertex_shader_path, - const std::string &fragment_shader_path); + void compileShaders(const std::string &vertexShader, + const std::string fragmentShader); + void compileShadersFromFile(const std::string &vertex_shader_path, + const std::string &fragment_shader_path); void linkShaders(); void addAttribute(const std::string &attribute_name); GLint getUniformLocation(const std::string &uniform_name); @@ -46,7 +48,9 @@ private: int attribute_index_ = 0; /// compiles one shader - void compileShader(const GLuint &shader, const std::string &file_path); + void compileShader(GLuint shader, const std::string &shaderContent); + void compileShaderFromFile(GLuint shader, const std::string &file_path); + void initShaderId(); }; } // namespace yage diff --git a/yage/yage.h b/yage/yage.h index 36729214..3dd27eb8 100644 --- a/yage/yage.h +++ b/yage/yage.h @@ -15,7 +15,6 @@ #define YAGE_YAGE_H #include "core/camera2d.h" -#include "core/defaultfile.h" #include "core/glslprogram.h" #include "core/imageloader.h" #include "core/inputmanager.h" -- cgit