cangine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Private Attributes | List of all members
cangine::CameraComponent Class Reference

Component marking its game object as the active camera. More...

#include <camera_component.hpp>

Inheritance diagram for cangine::CameraComponent:
Inheritance graph
[legend]
Collaboration diagram for cangine::CameraComponent:
Collaboration graph
[legend]

Public Member Functions

 CameraComponent (GameObject *gameObject=nullptr)
 Constructs the camera component and registers it as active.
 
- Public Member Functions inherited from cangine::IComponent
 IComponent (GameObject *gameObject=nullptr)
 Constructs the component, optionally bound to a game object.
 
virtual ~IComponent ()
 
GameObject * getGameObject () const
 Returns the game object this component is attached to.
 
virtual void firstFrame ()
 Called once before the first frame update.
 
virtual void frame (double deltaTime)
 Called every frame to update the component.
 
virtual void onMouseEvent (const MouseEvent *e)
 Called when a mouse event is dispatched to the owning object.
 

Static Public Member Functions

static CameraComponent * getInstance ()
 Returns the active camera component.
 

Static Private Attributes

static CameraComponent * instance = nullptr
 Singleton instance (the active camera).
 

Additional Inherited Members

- Public Attributes inherited from cangine::IComponent
bool isUnique = true
 If true, only one of this component type may exist per object.
 

Detailed Description

Component marking its game object as the active camera.

Exposes a singleton accessor so renderers can locate the current camera.

Constructor & Destructor Documentation

◆ CameraComponent()

cangine::CameraComponent::CameraComponent ( GameObject *  gameObject = nullptr)

Constructs the camera component and registers it as active.

Parameters
gameObjectOwning game object.

Member Function Documentation

◆ getInstance()

CameraComponent * cangine::CameraComponent::getInstance ( )
static

Returns the active camera component.

Returns
Pointer to the active CameraComponent.

Member Data Documentation

◆ instance

CameraComponent * cangine::CameraComponent::instance = nullptr
staticprivate

Singleton instance (the active camera).


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