Nox Engine
 
Loading...
Searching...
No Matches
Controller Struct Reference

Translates keyboard input (WASD) into entity movement. More...

#include <Controller.h>

Inheritance diagram for Controller:
Inheritance graph
Collaboration diagram for Controller:
Collaboration graph

Public Member Functions

void init () override
 Initializes the controller, grabbing the entity's Transform and Collider.
 
void updateKeyDown (SDL_Keycode key)
 Updates the state when a key is pressed down.
 
void updateKeyUp (SDL_Keycode key)
 Updates the state when a key is released.
 
void update () override
 Calculates and applies velocity to the Transform based on current key states.
 
void reload () override
 Resets the controller's state.
 
- Public Member Functions inherited from Component
virtual void draw ()
 Called once per frame after update. Used for rendering.
 

Additional Inherited Members

- Public Attributes inherited from Component
Entityentity
 Pointer to the entity that owns this component.
 

Detailed Description

Translates keyboard input (WASD) into entity movement.

Reads keyboard state changes and updates the entity's Transform component's velocity.

Member Function Documentation

◆ init()

void Controller::init ( )
overridevirtual

Initializes the controller, grabbing the entity's Transform and Collider.

Reimplemented from Component.

Here is the call graph for this function:

◆ reload()

void Controller::reload ( )
overridevirtual

Resets the controller's state.

Reimplemented from Component.

Here is the call graph for this function:

◆ update()

void Controller::update ( )
overridevirtual

Calculates and applies velocity to the Transform based on current key states.

Reimplemented from Component.

Here is the call graph for this function:

◆ updateKeyDown()

void Controller::updateKeyDown ( SDL_Keycode  key)

Updates the state when a key is pressed down.

Parameters
keyThe SDL_Keycode of the pressed key.
Here is the call graph for this function:

◆ updateKeyUp()

void Controller::updateKeyUp ( SDL_Keycode  key)

Updates the state when a key is released.

Parameters
keyThe SDL_Keycode of the released key.
Here is the call graph for this function:

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