diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-02-13 19:14:33 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-02-13 19:14:33 +0000 |
commit | 49af8b16ae3f9e6579656ed10f815e9c465557d0 (patch) | |
tree | 1dff4aea6a59c466ea6a6f15ad7f5e2ac69f5b37 /yage/entity/system.h | |
parent | e9bd903761605c7619a235edddf07c3a0b963968 (diff) | |
download | YAGE-49af8b16ae3f9e6579656ed10f815e9c465557d0.tar.gz YAGE-49af8b16ae3f9e6579656ed10f815e9c465557d0.zip |
[entity] Starting work on entity system.
Diffstat (limited to 'yage/entity/system.h')
-rw-r--r-- | yage/entity/system.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/yage/entity/system.h b/yage/entity/system.h new file mode 100644 index 00000000..9100fa17 --- /dev/null +++ b/yage/entity/system.h @@ -0,0 +1,57 @@ +/** --------------------------------------------------------------------------- + * @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; + + /** + * Destroy the system and the components that are contained in it. + */ + virtual void destroy() = 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 |