在SceneNode中增加main_scene数据,每个添加到当前场景的SceneNode,都会同步Scene数据。

This commit is contained in:
2025-07-24 01:28:16 +08:00
parent f013d8327d
commit 85020572bc
4 changed files with 70 additions and 9 deletions

View File

@@ -2,6 +2,7 @@
#include<hgl/graph/SceneNode.h>
#include<hgl/type/Pool.h>
#include<hgl/io/event/EventDispatcher.h>
namespace hgl::graph
{
@@ -17,6 +18,10 @@ namespace hgl::graph
SceneNode *root_node; ///<场景根节点
protected: // event dispatcher
io::EventDispatcher event_dispatcher; ///<事件分发器
public:
const U8String & GetSceneName()const{return SceneName;} ///<获取场景名称
@@ -27,13 +32,18 @@ namespace hgl::graph
Scene()
{
root_node=new SceneNode;
root_node=new SceneNode(this);
}
virtual ~Scene()
{
SAFE_CLEAR(root_node);
}
io::EventDispatcher *GetEventDispatcher() ///<获取事件分发器
{
return &event_dispatcher;
}
};//class Scene
bool RegisterScene(Scene *sw); ///<注册场景