aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--CMakeLists.txt7
-rw-r--r--docs/Doxyfile20
-rw-r--r--include/YAGE/Math/matrix.hpp66
-rw-r--r--include/YAGE/Physics/body.hpp8
-rw-r--r--include/YAGE/Physics/collider.hpp9
-rw-r--r--include/YAGE/camera2d.hpp1
-rw-r--r--include/YAGE/glslprogram.hpp21
-rw-r--r--include/YAGE/sprite.hpp5
-rw-r--r--include/YAGE/spritebatch.hpp23
-rw-r--r--include/YAGE/texturecache.hpp1
-rw-r--r--include/YAGE/window.hpp23
-rw-r--r--src/body.cpp3
-rw-r--r--src/camera2d.cpp3
-rw-r--r--src/glslprogram.cpp3
-rw-r--r--src/texturecache.cpp3
-rw-r--r--todolist.org (renamed from issues.org)0
17 files changed, 112 insertions, 88 deletions
diff --git a/.gitignore b/.gitignore
index b0c9aa66..9b5a28d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,10 @@
# general directories to ignore
bin/
build/
+build_clang/
+build_gcc/
+build_debug/
+build_release/
CMakeFiles/
Testing/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0dc4535..23efffdb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,13 +13,6 @@ set(YAGE_VERSION
# set standard
set(CMAKE_CXX_STANDARD 14)
-if ( CMAKE_COMPILER_IS_GNUCC )
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
-endif ( CMAKE_COMPILER_IS_GNUCC )
-if ( MSVC )
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
-endif ( MSVC )
-
# set the test sources
set(YAGE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)
set(YAGE_TEST_DIR ${PROJECT_SOURCE_DIR}/test)
diff --git a/docs/Doxyfile b/docs/Doxyfile
index 07f310d7..dfc94dcd 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 =
+PROJECT_NUMBER = 0.02
# 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
@@ -187,7 +187,7 @@ SHORT_NAMES = NO
# description.)
# The default value is: NO.
-JAVADOC_AUTOBRIEF = NO
+JAVADOC_AUTOBRIEF = YES
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
@@ -207,7 +207,7 @@ QT_AUTOBRIEF = NO
# not recognized any more.
# The default value is: NO.
-MULTILINE_CPP_IS_BRIEF = NO
+MULTILINE_CPP_IS_BRIEF = YES
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
# documentation from any documented member that it re-implements.
@@ -447,7 +447,7 @@ EXTRACT_PRIVATE = NO
# scope will be included in the documentation.
# The default value is: NO.
-EXTRACT_PACKAGE = NO
+EXTRACT_PACKAGE = YES
# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
# included in the documentation.
@@ -486,7 +486,7 @@ EXTRACT_ANON_NSPACES = NO
# section is generated. This option has no effect if EXTRACT_ALL is enabled.
# The default value is: NO.
-HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_MEMBERS = YES
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy. If set
@@ -494,7 +494,7 @@ HIDE_UNDOC_MEMBERS = NO
# has no effect if EXTRACT_ALL is enabled.
# The default value is: NO.
-HIDE_UNDOC_CLASSES = NO
+HIDE_UNDOC_CLASSES = YES
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO, these declarations will be
@@ -1223,7 +1223,7 @@ HTML_COLORSTYLE_GAMMA = 80
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_TIMESTAMP = NO
+HTML_TIMESTAMP = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
@@ -1266,7 +1266,7 @@ GENERATE_DOCSET = NO
# The default value is: Doxygen generated docs.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
-DOCSET_FEEDNAME = "Doxygen generated docs"
+DOCSET_FEEDNAME = "YAGE docs"
# This tag specifies a string that should uniquely identify the documentation
# set bundle. This should be a reverse domain-name style string, e.g.
@@ -1274,7 +1274,7 @@ DOCSET_FEEDNAME = "Doxygen generated docs"
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
-DOCSET_BUNDLE_ID = org.doxygen.Project
+DOCSET_BUNDLE_ID = com.yannherklotz.YAGE
# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
# the documentation publisher. This should be a reverse domain-name style
@@ -1288,7 +1288,7 @@ DOCSET_PUBLISHER_ID = org.doxygen.Publisher
# The default value is: Publisher.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
-DOCSET_PUBLISHER_NAME = Publisher
+DOCSET_PUBLISHER_NAME = "Yann Herklotz Grave"
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp
index 87347f60..2aca04db 100644
--- a/include/YAGE/Math/matrix.hpp
+++ b/include/YAGE/Math/matrix.hpp
@@ -6,17 +6,18 @@
* ----------------------------------------------------------------------------
*/
-/** \file matrix.hpp
- * \brief Templated matrix class
+
+/** \file matrix.hpp Templated matrix class
*
* Matrix
* ======
-
+ *
* This is a very general matrix class that can then be inherited by
* vectors and other similar data structures to minimize code
* density.
*/
+
#ifndef YAGE_MATH_MATRIX_HPP
#define YAGE_MATH_MATRIX_HPP
@@ -27,14 +28,14 @@
#include <string>
#include <vector>
+
namespace yage
{
template<int Rows, int Cols, class Type> class Matrix;
-/** \namespace detail
- * \brief Detail namespace
- *
+/** \internal Namespace for internal details.
+ *
* Detail Namespace
* ================
*
@@ -43,6 +44,14 @@ template<int Rows, int Cols, class Type> class Matrix;
namespace detail
{
+/** \internal Internal Row class used by the Matrix class to return the
+ * internal data structure of the Matrix.
+ *
+ * Row
+ * ===
+ *
+ * Internal Row class to return a value in the row of the matrix.
+ */
template<int Rows, int Cols, class Type> class Row
{
private:
@@ -68,8 +77,7 @@ public:
} // detail
-/** \class Matrix
- * \brief Base matrix class
+/** Base Matrix class used by other similar classes.
*
* Matrix class
* ============
@@ -82,22 +90,31 @@ template<int Rows=4, int Cols=4, class Type=double> class Matrix
// friended with the row class so that it can access protected member data
friend class detail::Row<Rows, Cols, Type>;
protected:
+ /// Vector containing the data of the matrix
std::vector<Type> data_;
public:
+ /// Initializes the size of the data_ vector
Matrix<Rows, Cols, Type>() : data_(Rows*Cols) {}
-
+
+ /// Returns the row size of the Matrix
int rowSize() const
{
return Rows;
}
+ /// Returns the column size of the Matrixxs
int colSize() const
{
return Cols;
}
- // returns the row in a row matrix
+ /** Return the row specified row as a Matrix with only one row
+ *
+ * \param[in] row Row number to be returned
+ *
+ * Returns the row that is specified by the row variables.
+ */
Matrix<1, Cols, Type> getRow(int row) const
{
Matrix<1, Cols, Type> rowMatrix;
@@ -166,15 +183,6 @@ public:
return detail::Row<Rows, Cols, Type>((Matrix<Rows, Cols, Type>*)this, row);
}
- Matrix<Rows, Cols, Type>& operator=(const Matrix<Rows, Cols, Type> &other)
- {
- if(this!=&other)
- {
- data_=other.data_;
- }
- return *this;
- }
-
Matrix<Rows, Cols, Type>& operator+=(const Matrix<Rows, Cols, Type> &rhs)
{
std::vector<Type> out;
@@ -329,6 +337,10 @@ public:
}
};
+/** 2D Vector class.
+ *
+ * Two dimensional vector class.
+ */
template<class Type=double> class Vector2 : public Vector<2, Type>
{
public:
@@ -363,11 +375,17 @@ public:
}
};
+/// Definition of a 2D vector.
typedef Vector2<double> Vector2d;
+/** Namespace containing functions that operate on matrices. */
namespace matrix
{
+/** Transposes a matrix and returns the result
+ *
+ * \param[in] m input matrix.
+ */
template<int M, int N, class T> Matrix<N, M, T> transpose(const Matrix<M, N, T> &m)
{
Matrix<N, M, T> trans;
@@ -381,6 +399,10 @@ template<int M, int N, class T> Matrix<N, M, T> transpose(const Matrix<M, N, T>
return trans;
}
+/** Returns the dot product between two vectors
+ *
+ * \param[in] m1,m2 Input matrices.
+ */
template<int R, class T> T dot(const Matrix<R, 1, T> &m1, const Matrix<R, 1, T> &m2)
{
T sum=0;
@@ -391,6 +413,12 @@ template<int R, class T> T dot(const Matrix<R, 1, T> &m1, const Matrix<R, 1, T>
return sum;
}
+/** Multiplies two matrices together.
+ *
+ * \param[in] m1,m2 Matrix inputs
+ *
+ * Requires the two matrices to be compatible with multiplication.
+ */
template<int M, int N, int P, int Q, class T>
Matrix<M, Q, T> multiply(const Matrix<M, N, T> &m1, const Matrix<P, Q, T> &m2)
{
diff --git a/include/YAGE/Physics/body.hpp b/include/YAGE/Physics/body.hpp
index 49406278..b0869779 100644
--- a/include/YAGE/Physics/body.hpp
+++ b/include/YAGE/Physics/body.hpp
@@ -6,8 +6,8 @@
* ----------------------------------------------------------------------------
*/
-#ifndef YAGE_BODY_HPP
-#define YAGE_BODY_HPP
+#ifndef YAGE_PHYSICS_BODY_HPP
+#define YAGE_PHYSICS_BODY_HPP
#include "Math/matrix.hpp"
@@ -39,8 +39,6 @@ protected:
Vector2d force_=Vector2d(0, 0);
public:
- virtual ~Body();
-
// apply force to the object and update the velocity
virtual void applyForce(const Vector2d &force)=0;
virtual void update()=0;
@@ -55,6 +53,6 @@ protected:
bool gravity=false);
};
-} // yage
+} // namespace yage
#endif
diff --git a/include/YAGE/Physics/collider.hpp b/include/YAGE/Physics/collider.hpp
index 86b2a0c3..716b7d4c 100644
--- a/include/YAGE/Physics/collider.hpp
+++ b/include/YAGE/Physics/collider.hpp
@@ -6,8 +6,8 @@
* ----------------------------------------------------------------------------
*/
-#ifndef YAGE_COLLIDER_HPP
-#define YAGE_COLLIDER_HPP
+#ifndef YAGE_PHYSICS_COLLIDER_HPP
+#define YAGE_PHYSICS_COLLIDER_HPP
#include <glm/glm.hpp>
@@ -28,9 +28,6 @@ protected:
public:
Collider(const glm::vec2 &position, const glm::vec2 &size) : position_(position), size_(size) {}
- // virtual deconstructor for classes that inherits
- virtual ~Collider() {}
-
// function that checks if two colliders are colliding
virtual bool collides(const Collider &collider) const=0;
@@ -38,6 +35,6 @@ public:
virtual bool inside(const glm::vec2 &point) const=0;
};
-} // yage
+} // namespace yage
#endif
diff --git a/include/YAGE/camera2d.hpp b/include/YAGE/camera2d.hpp
index 400cfe02..4c44ccaf 100644
--- a/include/YAGE/camera2d.hpp
+++ b/include/YAGE/camera2d.hpp
@@ -28,7 +28,6 @@ private:
public:
Camera2D(int screen_width=1280, int screen_height=720);
- virtual ~Camera2D();
// update camera location
void update(GlslProgram &program);
diff --git a/include/YAGE/glslprogram.hpp b/include/YAGE/glslprogram.hpp
index 28222ede..70f30b73 100644
--- a/include/YAGE/glslprogram.hpp
+++ b/include/YAGE/glslprogram.hpp
@@ -19,19 +19,24 @@ namespace yage
class GlslProgram
{
private:
- // compiled shader program id
- GLuint program_id_ = 0;
- GLuint vertex_shader_id_ = 0;
- GLuint fragment_shader_id_ = 0;
- int attribute_index_ = 0;
+ /// compiled shader program id
+ GLuint program_id_=0;
+ GLuint vertex_shader_id_=0;
+ GLuint fragment_shader_id_=0;
+ int attribute_index_=0;
- // compiles one shader
+ /// compiles one shader
void compileShader(const GLuint &shader, const std::string &file_path);
public:
- GlslProgram();
+ GlslProgram()=default;
+ GlslProgram(const GlslProgram&)=delete;
+ GlslProgram(GlslProgram&&)=delete;
~GlslProgram();
- // compiles vertex and fragment shader
+ GlslProgram& operator=(const GlslProgram&)=delete;
+ GlslProgram& operator=(GlslProgram&&)=delete;
+
+ /// compiles vertex and fragment shader
void compileShaders(const std::string &vertex_shader_path, const std::string &fragment_shader_path);
void linkShaders();
void addAttribute(const std::string &attribute_name);
diff --git a/include/YAGE/sprite.hpp b/include/YAGE/sprite.hpp
index 9e5aca8b..cddc0e26 100644
--- a/include/YAGE/sprite.hpp
+++ b/include/YAGE/sprite.hpp
@@ -29,8 +29,13 @@ private:
Texture texture_;
public:
Sprite();
+ Sprite(const Sprite&)=delete;
+ Sprite(Sprite&&)=delete;
~Sprite();
+ Sprite& operator=(const Sprite&)=delete;
+ Sprite& operator=(Sprite&&)=delete;
+
void init(float x, float y, float width, float height, const std::string &texture_path);
void draw();
};
diff --git a/include/YAGE/spritebatch.hpp b/include/YAGE/spritebatch.hpp
index 61efd0aa..a3007bbf 100644
--- a/include/YAGE/spritebatch.hpp
+++ b/include/YAGE/spritebatch.hpp
@@ -36,12 +36,12 @@ private:
public:
Glyph(GLuint texture, float depth, const Vertex &top_left, const Vertex &top_right, const Vertex &bottom_right, const Vertex &bottom_left);
- inline GLuint texture() const { return texture_; }
- inline float depth() const { return depth_; }
- inline Vertex top_left() const { return top_left_; }
- inline Vertex top_right() const { return top_right_; }
- inline Vertex bottom_right() const { return bottom_right_; }
- inline Vertex bottom_left() const { return bottom_left_; }
+ GLuint texture() const { return texture_; }
+ float depth() const { return depth_; }
+ Vertex top_left() const { return top_left_; }
+ Vertex top_right() const { return top_right_; }
+ Vertex bottom_right() const { return bottom_right_; }
+ Vertex bottom_left() const { return bottom_left_; }
};
class RenderBatch
@@ -58,9 +58,9 @@ public:
RenderBatch(GLint offset, GLsizei num_vertices, GLuint texture);
// getters
- inline GLint offset() const { return offset_; }
- inline GLsizei num_vertices() const { return num_vertices_; }
- inline GLuint texture() const { return texture_; }
+ GLint offset() const { return offset_; }
+ GLsizei num_vertices() const { return num_vertices_; }
+ GLuint texture() const { return texture_; }
};
class SpriteBatch
@@ -78,8 +78,13 @@ private:
// member functions
public:
SpriteBatch();
+ SpriteBatch(const SpriteBatch&)=delete;
+ SpriteBatch(SpriteBatch&&)=delete;
~SpriteBatch();
+ SpriteBatch& operator=(const SpriteBatch&)=delete;
+ SpriteBatch& operator=(SpriteBatch&&)=delete;
+
// initialize vaos and vbos
void init();
void begin();
diff --git a/include/YAGE/texturecache.hpp b/include/YAGE/texturecache.hpp
index 158f81ee..ac318230 100644
--- a/include/YAGE/texturecache.hpp
+++ b/include/YAGE/texturecache.hpp
@@ -22,7 +22,6 @@ private:
std::unordered_map<std::string, Texture> texture_map_;
public:
TextureCache();
- ~TextureCache();
Texture getTexture(const std::string &texture_path);
};
diff --git a/include/YAGE/window.hpp b/include/YAGE/window.hpp
index 98ba2592..beefae3d 100644
--- a/include/YAGE/window.hpp
+++ b/include/YAGE/window.hpp
@@ -28,25 +28,28 @@ enum WindowFlags : unsigned
// window wrapper around SDL_Window pointer
class Window
{
-public: // member variables
private:
- // window handle
+ /// window handle
SDL_Window *window_=nullptr;
-public: // member functions
+public:
Window();
- // destroys the window handle
- ~Window();
+ Window(const Window&)=delete;
+ Window(Window&&)=delete;
+ /// destroys the window handle
+ ~Window();
- // create the window, initialize the handle and update the width and height
+ Window& operator=(const Window&)=delete;
+ Window& operator=(Window&&)=delete;
+
+ /// create the window, initialize the handle and update the width and height
void create(const std::string &window_name, int width, int height, unsigned flags=WindowFlags::SHOWN);
- // swap the buffer
+ /// swap the buffer
void swapBuffer();
- // clear buffer
+ /// clear buffer
void clearBuffer();
-private:
};
-} // yage
+} // namespace yage
#endif
diff --git a/src/body.cpp b/src/body.cpp
index 524a92ee..ad92b0ca 100644
--- a/src/body.cpp
+++ b/src/body.cpp
@@ -13,9 +13,6 @@ namespace yage
const double Body::GRAVITY=-9.81;
-Body::~Body()
-{}
-
double Body::xPosition() const
{
return position_[0];
diff --git a/src/camera2d.cpp b/src/camera2d.cpp
index 0b60b7c6..88b468de 100644
--- a/src/camera2d.cpp
+++ b/src/camera2d.cpp
@@ -19,9 +19,6 @@ Camera2D::Camera2D(int screen_width, int screen_height) :
ortho_matrix_(glm::ortho(0.f, (float)screen_width, 0.f, (float)screen_height))
{}
-Camera2D::~Camera2D()
-{}
-
void Camera2D::update(GlslProgram &program)
{
if(matrix_needs_update_)
diff --git a/src/glslprogram.cpp b/src/glslprogram.cpp
index acb81f56..18fee54e 100644
--- a/src/glslprogram.cpp
+++ b/src/glslprogram.cpp
@@ -15,9 +15,6 @@
namespace yage
{
-GlslProgram::GlslProgram()
-{}
-
GlslProgram::~GlslProgram()
{
// cleanup all the shaders and the program
diff --git a/src/texturecache.cpp b/src/texturecache.cpp
index bc48c4e0..6d10b209 100644
--- a/src/texturecache.cpp
+++ b/src/texturecache.cpp
@@ -15,9 +15,6 @@ namespace yage
TextureCache::TextureCache()
{}
-TextureCache::~TextureCache()
-{}
-
Texture TextureCache::getTexture(const std::string &texture_path)
{
auto itr = texture_map_.find(texture_path);
diff --git a/issues.org b/todolist.org
index e660e362..e660e362 100644
--- a/issues.org
+++ b/todolist.org