aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-01-10 18:37:40 +0000
committerYann Herklotz <ymherklotz@gmail.com>2018-01-10 18:37:40 +0000
commit5fe329fe40c296a4a3dce9bc5543419ac954e4b0 (patch)
tree5fac3b692fecc7899f8c746e2116cdf6e2eee7b1
parenta62fbea8d40f623ffcd60eced63f295cd55db084 (diff)
downloadYAGE-5fe329fe40c296a4a3dce9bc5543419ac954e4b0.tar.gz
YAGE-5fe329fe40c296a4a3dce9bc5543419ac954e4b0.zip
[Engine] [Docs] Adding documentation and continuing work on ECS.
-rw-r--r--yage/core/window.cpp5
-rw-r--r--yage/engine/system.h29
-rw-r--r--yage/yage.cpp2
-rw-r--r--yage/yage.h45
4 files changed, 59 insertions, 22 deletions
diff --git a/yage/core/window.cpp b/yage/core/window.cpp
index 84cd66d7..c55b1ad1 100644
--- a/yage/core/window.cpp
+++ b/yage/core/window.cpp
@@ -39,15 +39,10 @@ Window::Window() = default;
Window::~Window()
{
glfwDestroyWindow(window_);
- glfwTerminate();
}
void Window::create(std::string window_name, int width, int height)
{
- if (glfwInit() == GLFW_FALSE) {
- throw runtime_error("GLFW Initialisation failed");
- }
-
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
diff --git a/yage/engine/system.h b/yage/engine/system.h
index c63b4733..32d6fc34 100644
--- a/yage/engine/system.h
+++ b/yage/engine/system.h
@@ -18,21 +18,34 @@ namespace yage
class System
{
public:
- /// Virtual destructor to destroy all the objects that implement this
- /// properly.
+ /**
+ * Virtual destructor to destroy all the objects that implement this
+ * properly.
+ */
virtual ~System() = 0;
- /// Initializes the system. Good practice to have this function instead
- /// using the constructor.
+ /**
+ * Initializes the system. Good practice to have this function instead
+ * using the constructor.
+ */
virtual void init() = 0;
- /// Updates the system at each interval using the time step.
+ /**
+ * Updates the system at each interval using the time step.
+ *
+ * @param dt The time difference between the previous frame and the current one.
+ */
virtual void update(double dt) = 0;
};
-/// Implement the default destructor, but leaving it as purely virtual in the
-/// definition of the abstract class.
-inline yage::System::~System() {}
+/**
+ * Implement the default destructor, but leaving it as purely virtual in the
+ * definition of the abstract class. This is so that the classes that implement
+ * the abstract class have to implement a desctructor, but at the same time,
+ * that there is no undefined behavious when the stack unwinds to the system and
+ * calls the system destructor.
+ */
+inline System::~System() {}
} // namespace yage
diff --git a/yage/yage.cpp b/yage/yage.cpp
index 597a4613..9a015d8c 100644
--- a/yage/yage.cpp
+++ b/yage/yage.cpp
@@ -24,7 +24,7 @@ void glfwErrorCallback(int, const char *description)
void init()
{
glfwSetErrorCallback(glfwErrorCallback);
- if (!glfwInit()) {
+ if (glfwInit() == GLFW_FALSE) {
throw std::runtime_error("GLFW couldn't be initialised");
}
}
diff --git a/yage/yage.h b/yage/yage.h
index c4b5612b..ed21d245 100644
--- a/yage/yage.h
+++ b/yage/yage.h
@@ -9,45 +9,74 @@
#ifndef YAGE_YAGE_H
#define YAGE_YAGE_H
+/**
+ * Core includes
+ */
#include "core/camera.h"
#include "core/iomanager.h"
#include "core/logger.h"
#include "core/resourcemanager.h"
#include "core/spritesheet.h"
#include "core/window.h"
+
+/**
+ * Data structues useful for the game engine and games developed by it
+ */
#include "data/input.h"
#include "data/texture.h"
#include "data/vertex.h"
+
+/**
+ * Math templated implementation of matrices and operations on them.
+ */
#include "math/matrix.h"
+
+/**
+ * Physics implementation however, Box2D
+ */
#include "physics/body.h"
#include "physics/particlebody.h"
#include "physics/rectanglecollider.h"
#include "physics/rigidbody.h"
+
+/**
+ * Rendering implementations for spritebatching and default shapes.
+ */
#include "render/drawable.h"
#include "render/shader.h"
#include "render/spritebatch.h"
-/** Project namespace.
+/**
+ * Engine that includes a Entity Component System to organize the data and make
+ * it more flexible and efficient.
+ */
+#include "engine/engine.h"
+
+/**
+ * Project namespace.
*
* Avoids collision as all the classes and global functions are wrapped in.
- * it.
*/
namespace yage
{
+/**
+ *
+ */
extern void glfwErrorCallback(int, const char *);
-/** Initializes yage.
- *
- * This is only there to initialize glfw.
+/**
+ * Initializes YAGE.
*
- * @return Returns true if the initialization was successful.
+ * This is there to initialize GLFW, which is the current
+ * window manager that is used with OpenGL.
*/
extern void init();
-/** Quit and cleanup yage
+/**
+ * Quit and cleanup YAGE.
*
- * glfw needs to clean itself up.
+ * This also cleans up GLFW after it was initialized.
*/
extern void quit();