Peoplemon  0.1.0
Peoplemon 3 game source documentation
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
editor::component::ConversationTree Class Reference

Special component that renders a clickable tree view of a conversation. More...

#include <ConversationTree.hpp>

+ Inheritance diagram for editor::component::ConversationTree:

Classes

struct  Edge
 
struct  Node
 

Public Types

using Ptr = std::shared_ptr< ConversationTree >
 
using ClickCb = std::function< void(unsigned int)>
 Called when a node is clicked. More...
 

Public Member Functions

void update (const std::vector< core::file::Conversation::Node > &nodes)
 Updates the rendered tree with the new nodes. More...
 
void setSelected (unsigned int i)
 Set the selected node index. More...
 
const std::vector< Node > & getNodes () const
 Used by the renderer component. More...
 
const std::vector< Edge > & getEdges () const
 Used by the renderer component. More...
 
unsigned int getSelectedNode () const
 Used by the renderer component. More...
 
unsigned int getTreeVersion () const
 Used by the renderer component. More...
 
const glm::vec2 & getCamCenter () const
 Used by the renderer component. More...
 
float getCamZoom () const
 Used by the renderer component. More...
 
bool shouldHighlightSelectedNode () const
 Used by the renderer component. More...
 

Static Public Member Functions

static Ptr create (const ClickCb &clickCb)
 Construct a new Conversation Tree component. More...
 

Static Public Attributes

static constexpr float NodeRadius = 60.f
 
static constexpr float NodeRadiusSquared = NodeRadius * NodeRadius
 
static constexpr float NodePadding = 100.f
 
static constexpr float Spacing = NodeRadius * 2.f + NodePadding
 

Detailed Description

Special component that renders a clickable tree view of a conversation.

Definition at line 18 of file ConversationTree.hpp.

Member Typedef Documentation

◆ ClickCb

using editor::component::ConversationTree::ClickCb = std::function<void(unsigned int)>

Called when a node is clicked.

Definition at line 46 of file ConversationTree.hpp.

◆ Ptr

Definition at line 20 of file ConversationTree.hpp.

Member Function Documentation

◆ create()

ConversationTree::Ptr editor::component::ConversationTree::create ( const ClickCb clickCb)
static

Construct a new Conversation Tree component.

Parameters
clickCbCallback for when a node is clicked

Definition at line 30 of file ConversationTree.cpp.

◆ getCamCenter()

const glm::vec2& editor::component::ConversationTree::getCamCenter ( ) const
inline

Used by the renderer component.

Definition at line 92 of file ConversationTree.hpp.

◆ getCamZoom()

float editor::component::ConversationTree::getCamZoom ( ) const
inline

Used by the renderer component.

Definition at line 97 of file ConversationTree.hpp.

◆ getEdges()

const std::vector<Edge>& editor::component::ConversationTree::getEdges ( ) const
inline

Used by the renderer component.

Definition at line 77 of file ConversationTree.hpp.

◆ getNodes()

const std::vector<Node>& editor::component::ConversationTree::getNodes ( ) const
inline

Used by the renderer component.

Definition at line 72 of file ConversationTree.hpp.

◆ getSelectedNode()

unsigned int editor::component::ConversationTree::getSelectedNode ( ) const
inline

Used by the renderer component.

Definition at line 82 of file ConversationTree.hpp.

◆ getTreeVersion()

unsigned int editor::component::ConversationTree::getTreeVersion ( ) const
inline

Used by the renderer component.

Definition at line 87 of file ConversationTree.hpp.

◆ setSelected()

void editor::component::ConversationTree::setSelected ( unsigned int  i)

Set the selected node index.

Parameters
iIndex of the selected node

Definition at line 75 of file ConversationTree.cpp.

◆ shouldHighlightSelectedNode()

bool editor::component::ConversationTree::shouldHighlightSelectedNode ( ) const
inline

Used by the renderer component.

Definition at line 102 of file ConversationTree.hpp.

◆ update()

void editor::component::ConversationTree::update ( const std::vector< core::file::Conversation::Node > &  nodes)

Updates the rendered tree with the new nodes.

Parameters
nodesThe new tree to render

Definition at line 116 of file ConversationTree.cpp.

Member Data Documentation

◆ NodePadding

constexpr float editor::component::ConversationTree::NodePadding = 100.f
staticconstexpr

Definition at line 24 of file ConversationTree.hpp.

◆ NodeRadius

constexpr float editor::component::ConversationTree::NodeRadius = 60.f
staticconstexpr

Definition at line 22 of file ConversationTree.hpp.

◆ NodeRadiusSquared

constexpr float editor::component::ConversationTree::NodeRadiusSquared = NodeRadius * NodeRadius
staticconstexpr

Definition at line 23 of file ConversationTree.hpp.

◆ Spacing

constexpr float editor::component::ConversationTree::Spacing = NodeRadius * 2.f + NodePadding
staticconstexpr

Definition at line 25 of file ConversationTree.hpp.


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