Potato Engine
Loading...
Searching...
No Matches
PlayerController Class Reference

Main managing class for the player, controlling interactions and non-local behavior. More...

#include <PlayerController.hpp>

Inheritance diagram for PlayerController:
Tickable

Public Member Functions

void Initialize ()
void AssignPlayer (Player *player)
PlayerGetPlayer () const
 Gets assigned Player.
CameraGetCamera () const
 Gets assigned Camera.
virtual void SetupInputBindings ()
 Called automatically to bind player inputs to InputController.
Public Member Functions inherited from Tickable
bool isTicking () const
 Checks if object is ticking.
void SetTicking (bool isEnabled)
 Sets tick state for object.

Protected Member Functions

virtual void Tick (float dt) override
 Update tick event.

Detailed Description

Main managing class for the player, controlling interactions and non-local behavior.

Definition at line 12 of file PlayerController.hpp.

Constructor & Destructor Documentation

◆ PlayerController()

PlayerController::PlayerController ( )

Definition at line 16 of file PlayerController.cpp.

◆ ~PlayerController()

PlayerController::~PlayerController ( )
virtual

Definition at line 88 of file PlayerController.cpp.

Member Function Documentation

◆ Initialize()

void PlayerController::Initialize ( )

Definition at line 20 of file PlayerController.cpp.

◆ AssignPlayer()

void PlayerController::AssignPlayer ( Player * player)

Definition at line 60 of file PlayerController.cpp.

◆ GetPlayer()

Player * PlayerController::GetPlayer ( ) const

Gets assigned Player.

Returns
Player

Definition at line 67 of file PlayerController.cpp.

◆ GetCamera()

Camera * PlayerController::GetCamera ( ) const

Gets assigned Camera.

Returns
Camera

Definition at line 68 of file PlayerController.cpp.

◆ SetupInputBindings()

void PlayerController::SetupInputBindings ( )
virtual

Called automatically to bind player inputs to InputController.

Override to setup bindings:

Keycode::Space,
InputType::Triggered,
"JumpAction",
this,
&PlayerController::DoJump)
);
Interface to manage input binding operations.
virtual void RegisterInputBinding(InputBinding binding)=0
Registers a single binding.
IInputController * GetInputController() const
Gets input controller.
static PotatoEngine & Get()
Global access to engine object.
Wrapper for input bindings.
Note
Always call base method when overriding:
void PlayerControllerClass::SetupInputBindings() {
BasePlayerController::SetupInputBindings();
// ...
}

Definition at line 70 of file PlayerController.cpp.

◆ Tick()

void PlayerController::Tick ( float dt)
overrideprotectedvirtual

Update tick event.

This function is called every tick on the update step. Put all gameplay functionality that should run every update here (custom movement logic, etc.)

Parameters
dtDeltatime; time elapsed since last frame in ms
Note
Always call base method when overriding:
void Class::Tick() {
BaseClass::Tick();
// ...
}

Reimplemented from Tickable.

Definition at line 30 of file PlayerController.cpp.