godot-cpp-utils
A collection of utility classes, functions and macros for use with Godot and GDExtension.
Loading...
Searching...
No Matches
utils::IPlayer Class Referenceabstract

Interface required for player nodes. More...

#include <player.hpp>

Public Member Functions

virtual void setup_player_input (PlayerInput *input)=0
 Called by GameRoot3D when this player is instantiated or assigned a new PlayerInput.
 
virtual gd::Node * to_node ()=0
 Convert IPlayer instance to node.
 
virtual void spawn_at_position (gd::Transform3D const &at)=0
 Spawn the player at a given transform, usually the global transform of a SpawnPoint3D.
 
uint32_t get_player_id ()
 Returns the player id assigned to this instance.
 

Private Attributes

std::optional< uint32_t > player_id {std::nullopt}
 

Friends

class GameRoot3D
 

Detailed Description

Interface required for player nodes.

Use multiple inheritance and implement IPlayer to make a regular node usable as a player with GameRoot3D.

Member Function Documentation

◆ setup_player_input()

virtual void utils::IPlayer::setup_player_input ( PlayerInput input)
pure virtual

Called by GameRoot3D when this player is instantiated or assigned a new PlayerInput.

Use PlayerInput::listen_to to register input callbacks. There's no need to keep the input pointer around. As the instance is managed by the GameRoot3D.


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