32 lines
		
	
	
		
			776 B
		
	
	
	
		
			C
		
	
	
	
		
		
			
		
	
	
			32 lines
		
	
	
		
			776 B
		
	
	
	
		
			C
		
	
	
	
|  | #pragma once
 | ||
|  | #include "Tool/IntrusiveList.hpp"
 | ||
|  | #include "Tool/RefPtr.h"
 | ||
|  | #include "Tool/RefObject.h"
 | ||
|  | #include "Tool/TagGed.h"
 | ||
|  | 
 | ||
|  | #include <SDL.h>
 | ||
|  | class Actor; | ||
|  | class Component : public RefObject, public TagGed, protected IntrusiveListValue<RefPtr<Component>> | ||
|  | { | ||
|  | private: | ||
|  |     /* data */ | ||
|  |     std::string m_Name; | ||
|  | public: | ||
|  |     Component(/* args */); | ||
|  |     ~Component(); | ||
|  | 
 | ||
|  |     virtual void Init(); | ||
|  |     virtual void HandleEvents(SDL_Event *e); | ||
|  |     virtual void Update(float deltaTime); | ||
|  |     virtual void Render(float deltaTime); | ||
|  |     virtual void Clear(); | ||
|  | 
 | ||
|  |     using IntrusiveListValue<RefPtr<Component>>::GetNext; | ||
|  |     using IntrusiveListValue<RefPtr<Component>>::GetPrev; | ||
|  | 
 | ||
|  |     void SetName(std::string name); | ||
|  | 
 | ||
|  | public: | ||
|  |     Actor *Parent; // 指向父对象的指针,用于访问父对象
 | ||
|  | }; |