Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Olympe::NodeStyleRegistry Class Reference

Singleton providing NodeStyle descriptors per NodeType. More...

#include <NodeStyleRegistry.h>

+ Collaboration diagram for Olympe::NodeStyleRegistry:

Public Member Functions

const NodeStyleGetStyle (NodeType type) const
 Returns the style for the given node type.
 
const NodeStyleGetStyleByTaskID (const std::string &taskId) const
 Returns the style to use for an atomic-task node identified by ID.
 
const NodeStyleGetStyleByVSTypeName (const std::string &vsTypeName) const
 Returns the style for a VS node type identified by string.
 

Static Public Member Functions

static NodeStyleRegistryGet ()
 Returns the singleton instance.
 
static ImU32 GetExecPinColor ()
 Colour for execution-flow (exec) pins — white.
 
static ImU32 GetDataPinColor ()
 Colour for data pins — green.
 

Private Member Functions

 NodeStyleRegistry ()
 

Private Attributes

NodeStyle m_defaultStyle
 
std::unordered_map< int, NodeStylem_styles
 Key is the underlying int value of NodeType.
 
std::unordered_map< std::string, NodeStylem_vsStyles
 Key is the VS type name string (TaskNodeType as string).
 

Detailed Description

Singleton providing NodeStyle descriptors per NodeType.

Usage:

ImNodes::PushColorStyle(ImNodesCol_TitleBar, style.headerColor);
ImNodes::PushColorStyle(ImNodesCol_TitleBarHovered, style.headerHoveredColor);
ImNodes::PushColorStyle(ImNodesCol_TitleBarSelected, style.headerSelectedColor);
ImNodes::BeginNode(id);
// ...
ImNodes::EndNode();
ImNodes::PopColorStyle();
ImNodes::PopColorStyle();
ImNodes::PopColorStyle();
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
const NodeStyle & GetStyle(NodeType type) const
Returns the style for the given node type.
static NodeStyleRegistry & Get()
Returns the singleton instance.
Visual descriptor for a single node type.
ImU32 headerColor
Title-bar background colour (ImNodes TitleBar colour slot).
ImU32 headerSelectedColor
Title-bar colour when the node is selected.
ImU32 headerHoveredColor
Title-bar colour when the node is hovered.

For exec-flow pins use GetExecPinColor(); for data pins GetDataPinColor().

Definition at line 63 of file NodeStyleRegistry.h.

Constructor & Destructor Documentation

◆ NodeStyleRegistry()

Olympe::NodeStyleRegistry::NodeStyleRegistry ( )
private

Member Function Documentation

◆ Get()

NodeStyleRegistry & Olympe::NodeStyleRegistry::Get ( )
static

Returns the singleton instance.

Definition at line 20 of file NodeStyleRegistry.cpp.

Referenced by Olympe::NodeGraphPanel::RenderGraph(), Olympe::AI::BTNodePalette::RenderNodeButton(), Olympe::NodeGraphPanel::RenderNodePinsAndContent(), and Olympe::NodeGraphShared::RenderNodeVisual().

+ Here is the caller graph for this function:

◆ GetDataPinColor()

ImU32 Olympe::NodeStyleRegistry::GetDataPinColor ( )
static

Colour for data pins — green.

Definition at line 416 of file NodeStyleRegistry.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ GetExecPinColor()

ImU32 Olympe::NodeStyleRegistry::GetExecPinColor ( )
static

Colour for execution-flow (exec) pins — white.

Definition at line 411 of file NodeStyleRegistry.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ GetStyle()

const NodeStyle & Olympe::NodeStyleRegistry::GetStyle ( NodeType  type) const

Returns the style for the given node type.

Falls back to the default grey style for unknown types.

Definition at line 386 of file NodeStyleRegistry.cpp.

References GetComponentTypeID_Static(), m_defaultStyle, and m_styles.

Referenced by Olympe::NodeGraphPanel::RenderGraph(), Olympe::AI::BTNodePalette::RenderNodeButton(), Olympe::NodeGraphPanel::RenderNodePinsAndContent(), and Olympe::NodeGraphShared::RenderNodeVisual().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetStyleByTaskID()

const NodeStyle & Olympe::NodeStyleRegistry::GetStyleByTaskID ( const std::string &  taskId) const

Returns the style to use for an atomic-task node identified by ID.

Currently returns the BT_Action style for all task IDs.

Definition at line 398 of file NodeStyleRegistry.cpp.

References Olympe::BT_Action, GetComponentTypeID_Static(), m_defaultStyle, and m_styles.

+ Here is the call graph for this function:

◆ GetStyleByVSTypeName()

const NodeStyle & Olympe::NodeStyleRegistry::GetStyleByVSTypeName ( const std::string &  vsTypeName) const

Returns the style for a VS node type identified by string.

Used by the VS graph renderer which uses TaskNodeType, not the legacy NodeType enum.

Parameters
vsTypeNameString form of TaskNodeType (e.g. "EntryPoint", "Branch", "Delay").
Returns
NodeStyle for the given type, or default grey if unknown.

Definition at line 374 of file NodeStyleRegistry.cpp.

References GetComponentTypeID_Static(), m_defaultStyle, and m_vsStyles.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_defaultStyle

NodeStyle Olympe::NodeStyleRegistry::m_defaultStyle
private

Definition at line 101 of file NodeStyleRegistry.h.

Referenced by GetStyle(), GetStyleByTaskID(), and GetStyleByVSTypeName().

◆ m_styles

std::unordered_map<int, NodeStyle> Olympe::NodeStyleRegistry::m_styles
private

Key is the underlying int value of NodeType.

Definition at line 104 of file NodeStyleRegistry.h.

Referenced by GetStyle(), GetStyleByTaskID(), and NodeStyleRegistry().

◆ m_vsStyles

std::unordered_map<std::string, NodeStyle> Olympe::NodeStyleRegistry::m_vsStyles
private

Key is the VS type name string (TaskNodeType as string).

Definition at line 107 of file NodeStyleRegistry.h.

Referenced by GetStyleByVSTypeName(), and NodeStyleRegistry().


The documentation for this class was generated from the following files: