dEngine
Simple 2D C++ game engine
Public Member Functions | Protected Attributes | List of all members
dengine::Component Class Reference

Gameobject component that asssists in adding additional functionality. More...

#include <Component.h>

Inheritance diagram for dengine::Component:
dengine::Collider dengine::InputController dengine::Sprite dengine::SpriteSheet

Public Member Functions

 Component (GameObject &parent)
 Create a new component for a gameobject. More...
 
virtual void NotifyCollision (GameObject &other)
 
std::string GetName ()
 Returns the component's name. More...
 
virtual void Start ()
 Start the object To be called by the GameObject's Start method. This should be called at the beginning of instantiation. More...
 
virtual void Update ()
 
virtual void Render ()
 

Protected Attributes

GameObjectparent
 
std::string name
 

Detailed Description

Gameobject component that asssists in adding additional functionality.

A component adds additional functionality to a Gameobject without being a defining factor of the object. This is an empty class and is meant to be extended upon depending upon the needs of the developer. For some examples see Sprite, SpriteSheet, or other preexisting components

Constructor & Destructor Documentation

◆ Component()

Component::Component ( GameObject parent)

Create a new component for a gameobject.

Parameters
parentThe parent object that this component is on

Member Function Documentation

◆ GetName()

std::string Component::GetName ( )

Returns the component's name.

See also
name

◆ NotifyCollision()

void Component::NotifyCollision ( GameObject other)
virtual

Notify component that a collision has occurred

Parameters
otherReference to the object being collided with

◆ Render()

void Component::Render ( )
virtual

Used for drawing to screen

See also
components

Reimplemented in dengine::SpriteSheet, and dengine::Sprite.

◆ Start()

void Component::Start ( )
virtual

Start the object To be called by the GameObject's Start method. This should be called at the beginning of instantiation.

◆ Update()

void Component::Update ( )
virtual

Runs every frame performing any required logic

See also
components

Reimplemented in dengine::InputController, and dengine::Collider.

Member Data Documentation

◆ name

std::string dengine::Component::name
protected

◆ parent

GameObject& dengine::Component::parent
protected