From 066e5987c515dfc34537d73ca9d2a81ddd1f9e1b Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 21 Oct 2018 13:37:27 +0800 Subject: =?UTF-8?q?*=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Game/je_entity.h | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/libjin/Game/je_entity.h (limited to 'src/libjin/Game/je_entity.h') diff --git a/src/libjin/Game/je_entity.h b/src/libjin/Game/je_entity.h new file mode 100644 index 0000000..29fe8be --- /dev/null +++ b/src/libjin/Game/je_entity.h @@ -0,0 +1,51 @@ +#ifndef __JE_GAME_OBJECT_H +#define __JE_GAME_OBJECT_H + +#include +#include + +#include "../common/je_types.h" + +namespace JinEngine +{ + namespace Game + { + + /// + /// Game object base class. + /// + class Entity + { + public: + virtual ~Entity(); + + void lifecycle(); + + protected: + virtual void onAlive(); + virtual void onUpdate(float dt); + virtual void onDraw(); + virtual void onDie(); + + uint32 layer; // layer where entity belongs + uint32 index; // render index in layer + uint64 tag; // tag of entity + bool mIsVisible; + bool mIsActive; + + }; + + /// + /// Entity list. For quickly adding and removing entities. + /// + typedef std::list EntityList; + + /// + /// Entity set. For searching and keeps entities unique and sorted. + /// + typedef std::set EntitySet; + + } // namespace Game +} // namespace JinEngine + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0