Advertisement
Zgragselus

Base component class

May 14th, 2023
806
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #ifndef __COMPONENT__H__
  2. #define __COMPONENT__H__
  3.  
  4. #include "Core/Memory/Memory.h"
  5. #include "Core/Util/String.h"
  6.  
  7. namespace Engine
  8. {
  9.     // Toplevel component class used as a base-class for Entity-components
  10.     class __declspec(align(16)) Component
  11.     {
  12.     private:
  13.         static std::string mComponentName;
  14.  
  15.     protected:
  16.         Component() = default;
  17.  
  18.     public:
  19.         virtual ~Component() {}
  20.  
  21.         static std::string& GetName() { return mComponentName; }
  22.  
  23.         virtual bool Editor(std::string& prev, std::string& next) = 0;
  24.  
  25.         virtual std::string Serialize() = 0;
  26.  
  27.         virtual void Deserialize(const std::string&) = 0;
  28.  
  29.         virtual void Update(float deltaTime) = 0;
  30.  
  31.         ALIGNED_NEW_DELETE("Engine::Component")
  32.     };
  33. }
  34.  
  35. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement