Ember
Loading...
Searching...
No Matches
BehaviorTreeScene.h
Go to the documentation of this file.
1#pragma once
2
4#include "Core/Node.h"
7#include "Scenes/IScene.h"
9#include <functional>
10#include <memory>
11#include <string>
12#include <vector>
13#include <wx/wx.h>
14
21class BehaviorTreeScene : public IScene {
22 public:
23 // Callback type for node selection events
24 using NodeSelectionCallback = std::function<void(EmberCore::ITreeNode *)>;
25
31 BehaviorTreeScene(wxWindow *parent, const wxString &title = "Behavior Tree");
32
33 virtual ~BehaviorTreeScene();
34
35 // IScene interface implementation
36 wxPanel *GetPanel() override { return m_panel; }
37 wxString GetTitle() const override { return m_title; }
38 wxString GetSceneType() const override { return "BehaviorTree"; }
39 void OnActivated() override;
40 void OnDeactivated() override;
41 void Refresh() override;
42 bool HasUnsavedChanges() const override { return m_hasUnsavedChanges; }
43 bool Save() override;
44
45 // Behavior tree specific methods
50 void SetBehaviorTree(std::shared_ptr<EmberCore::Node> root);
51
56 void SetBehaviorTree(std::shared_ptr<EmberCore::ITreeStructure> tree);
57
63
69
75
80
85 void SetTitle(const wxString &title);
86
92
97 void SetCanvasBackgroundColor(const wxColour &color);
98
99 // Non-copyable
102
103 private:
104 void CreateLayout();
105
106 // UI components
107 wxPanel *m_panel;
109
110 // Data
111 std::shared_ptr<EmberCore::Node> m_behaviorTreeRoot; // Legacy storage for backward compatibility
112 std::shared_ptr<EmberCore::ITreeStructure> m_treeAdapter; // Adapter for abstraction layer
113 wxString m_title;
115
116 // Callbacks
118};
NodeSelectionCallback m_nodeSelectionCallback
EmberCore::ITreeStructure * GetAbstractedTree() const
Get the abstracted tree structure.
EmberCore::TreeVisualization * GetTreeVisualization() const
Get the tree visualization component.
BehaviorTreeScene(wxWindow *parent, const wxString &title="Behavior Tree")
Construct a new BehaviorTreeScene.
std::shared_ptr< EmberCore::ITreeStructure > m_treeAdapter
wxString GetTitle() const override
Get the display title for this scene.
wxPanel * GetPanel() override
Get the main panel widget for this scene.
void OnDeactivated() override
Called when this scene is no longer the active tab.
void CreateSampleBehaviorTree()
Create a sample behavior tree for testing/demo purposes.
std::shared_ptr< EmberCore::Node > m_behaviorTreeRoot
BehaviorTreeScene(const BehaviorTreeScene &)=delete
void Refresh() override
Called when the scene should refresh its display.
EmberCore::Node * GetBehaviorTree() const
Get the behavior tree root node (legacy interface)
bool HasUnsavedChanges() const override
Check if this scene has unsaved changes.
void SetNodeSelectionCallback(NodeSelectionCallback callback)
Set callback for node selection events.
void OnActivated() override
Called when this scene becomes the active tab.
void SetTitle(const wxString &title)
Set the title of this scene.
BehaviorTreeScene & operator=(const BehaviorTreeScene &)=delete
void SetCanvasBackgroundColor(const wxColour &color)
Set the canvas background color.
EmberCore::TreeVisualization * m_treeVisualization
void SetBehaviorTree(std::shared_ptr< EmberCore::Node > root)
Set the behavior tree for this scene using legacy Node interface.
wxString GetSceneType() const override
Get a unique identifier for this scene type.
bool Save() override
Save the scene (if applicable)
std::function< void(EmberCore::ITreeNode *)> NodeSelectionCallback
Abstract interface for tree nodes that can be visualized.
Definition ITreeNode.h:31
Abstract interface for tree structures that can be visualized.
Represents a node in a behavior tree structure.
Definition Node.h:20
Tree visualization panel that renders behavior trees in a grid-based layout.
Abstract interface for different scene types in the MainPanel.
Definition IScene.h:25