Botcraft 1.21.4
Loading...
Searching...
No Matches
BehaviourRenderer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <any>
4#include <string>
5
6#if USE_IMGUI
7#include <memory>
8#include <vector>
9#include <mutex>
10#include <map>
11
13
14namespace ax
15{
16 namespace NodeEditor
17 {
18 struct EditorContext;
19 struct Config;
20 }
21}
22
23namespace Botcraft
24{
25 class BaseNode;
26
27 namespace Renderer
28 {
29 struct ImNode;
30
32 {
33 public:
36
37 void Init();
38 void RenderNodes();
39 void RenderBlackboard();
40 void CleanUp();
41
42 void SetCurrentBehaviourTree(const BaseNode* root);
44 void BehaviourStartTick();
45 void BehaviourEndTick(const bool b);
46 void BehaviourTickChild(const size_t i);
47 bool IsBehaviourPaused() const;
48
49 void ResetBlackboard();
50 void UpdateBlackboardValue(const std::string& key, const std::any& value);
51 void RemoveBlackboardValue(const std::string& key);
52
53 private:
54 void RenderNode(const size_t index);
55 void NavigateToActiveNode() const;
56
57 private:
58 ax::NodeEditor::EditorContext* context;
59 std::unique_ptr<ax::NodeEditor::Config> config;
60 std::vector<std::unique_ptr<ImNode>> nodes;
61 mutable std::mutex nodes_mutex;
62
65 bool paused;
66 bool step;
67
69 mutable std::mutex blackboard_mutex;
70 };
71 }
72}
73#else
74namespace Botcraft
75{
76 class BaseNode;
77 namespace Renderer
78 {
79 class BehaviourRenderer
80 {
81 public:
82 void SetCurrentBehaviourTree(const BaseNode* root) {}
83 void ResetBehaviourState() {}
84 void BehaviourStartTick() {}
85 void BehaviourEndTick(const bool b) {}
86 void BehaviourTickChild(const size_t i) {}
87 bool IsBehaviourPaused() const { return false; }
88
89 void ResetBlackboard() {}
90 void UpdateBlackboardValue(const std::string& key, const std::any& value) {}
91 void RemoveBlackboardValue(const std::string& key) {}
92
93 };
94 }
95}
96#endif
ax::NodeEditor::EditorContext * context
void SetCurrentBehaviourTree(const BaseNode *root)
std::vector< std::unique_ptr< ImNode > > nodes
std::unique_ptr< ax::NodeEditor::Config > config
void UpdateBlackboardValue(const std::string &key, const std::any &value)
void RemoveBlackboardValue(const std::string &key)
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45
A class to hold data to be drawn on ImNode context.