Oxygen Engine
Modern C++ 3D Engine using OpenGL
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages Concepts
oe::component::Component Class Reference

Scene component that can be attached to an entity. More...

#include <OxygenEngine/scene/component/component.h>

Inheritance diagram for oe::component::Component:
[legend]

Public Member Functions

virtual void onUpdate (const double, const int8_t=0)
 Run actions on entity update.
 

Public Attributes

bool is_active = true
 Toggle to check if the Component is active, actual meaning heavily depends of the component type.
 

Detailed Description

Scene component that can be attached to an entity.

Example usage:

// Entity definition
class MyEntity;
class MyEntityComponent : public oe::component::EntityComponent<MyEntity>
{
public:
MyEntity& getXXX()
{
return static_cast<MyEntity&>(*_entity);
}
};
class MyEntity : public oe::component::HasComponents<MyEntity, MyEntityComponent>
{
// ...
}
// Somewhere in your application
MyEntity e;
e.getComponents().add<ExampleComponent>(...);
// In the update loop
e.getComponents().update(...);
Component bound to a specific entity.
Definition component.h:80
Util class to add components handling to an entity.
Definition component.h:311

Member Function Documentation

◆ onUpdate()

virtual void oe::component::Component::onUpdate ( const double  ,
const int8_t  = 0 
)
inlinevirtual

Run actions on entity update.

The flags value is not used by OxygenEngine, but you can use it to implement differents levels of update For example, other engines uses functions such as BeforeUpdate, PreUpdate, PostUpdate, LateUpdate, etc

Here, it would translates to using custom flags values

Parameters
deltaseconds since last call of this function
flagscustom flags

Reimplemented in oe::component::node::Debug, oe::component::Lighting, and oe::scene::component::node::Camera.

Member Data Documentation

◆ is_active

bool oe::component::Component::is_active = true

Toggle to check if the Component is active, actual meaning heavily depends of the component type.

This allow you to "freeze" the component or prevent any updates

Note
In built-in components, the actual behavior varies (check components specific documentation for more)

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