SwitchGame/source/EngineFrame/Actor/Actor.h

36 lines
913 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include "EngineFrame/Actor/Actor_base.h"
#include "EngineFrame/Component/Component.h"
#include "Tool/IntrusiveList.hpp"
class Scene;
/**
* @brief Actor类继承自Actor_base类
*
* Actor类是一个基础的游戏对象类可以添加到场景中
*/
class Actor : public Actor_base, protected IntrusiveListValue<RefPtr<Actor>>
{
public:
Actor();
~Actor() override;
public:
void Init() override;
void HandleEvents(SDL_Event *e) override;
void Update(float deltaTime) override;
void Render(float deltaTime) override;
void Clear() override;
using IntrusiveListValue<RefPtr<Actor>>::GetNext;
using IntrusiveListValue<RefPtr<Actor>>::GetPrev;
public:
void AddComponent(RefPtr<Component> Component);
public:
Scene *Parent; // 指向父场景的指针表示该Actor所属的场景
private:
IntrusiveList<RefPtr<Component>> m_Components;
};