aboutsummaryrefslogtreecommitdiffstats
path: root/yage/engine/system.h
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-01-10 18:38:31 +0000
committerYann Herklotz <ymherklotz@gmail.com>2018-01-10 18:38:31 +0000
commit21ebdb0b3206bef69fee2b5f9b34573a516eddb4 (patch)
tree5fac3b692fecc7899f8c746e2116cdf6e2eee7b1 /yage/engine/system.h
parentfe9fa3a98166718171b7687c24c289b4a2b5cf44 (diff)
parent5fe329fe40c296a4a3dce9bc5543419ac954e4b0 (diff)
downloadYAGE-21ebdb0b3206bef69fee2b5f9b34573a516eddb4.tar.gz
YAGE-21ebdb0b3206bef69fee2b5f9b34573a516eddb4.zip
Merge branch 'develop'
Diffstat (limited to 'yage/engine/system.h')
-rw-r--r--yage/engine/system.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/yage/engine/system.h b/yage/engine/system.h
new file mode 100644
index 00000000..32d6fc34
--- /dev/null
+++ b/yage/engine/system.h
@@ -0,0 +1,52 @@
+/** ---------------------------------------------------------------------------
+ * @file: system.h
+ *
+ * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
+ * MIT License, see LICENSE file for more details.
+ * ----------------------------------------------------------------------------
+ */
+
+#ifndef YAGE_ENGINE_SYSTEM_H
+#define YAGE_ENGINE_SYSTEM_H
+
+namespace yage
+{
+
+/**
+ * System interface for the different systems in the engine.
+ */
+class System
+{
+public:
+ /**
+ * 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.
+ */
+ virtual void init() = 0;
+
+ /**
+ * 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. 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
+
+#endif