Radium Engine  1.5.0
SystemDisplay.cpp
1 #include <Engine/Rendering/RenderObjectManager.hpp>
2 #include <Engine/Scene/SystemDisplay.hpp>
3 namespace Ra {
4 namespace Engine {
5 namespace Scene {
6 
7 SystemEntity::SystemEntity() : Entity( "System Display Entity" ) {
8  /*
9  addComponent(new UiComponent(nullptr));
10  addComponent(new DebugComponent(nullptr));
11  */
12  new UiComponent( this );
13  new DebugComponent( this );
14 }
15 
16 UiComponent* SystemEntity::uiCmp() {
17  SystemEntity* instance = getInstance();
18  CORE_ASSERT( instance->getTransformAsMatrix() == Core::Matrix4::Identity(),
19  "Transform has been changed !" );
20  return static_cast<UiComponent*>( instance->getComponent( "UI" ) );
21 }
22 
23 #ifndef RA_DISABLE_DEBUG_DISPLAY
24 DebugComponent* SystemEntity::dbgCmp() {
25  SystemEntity* instance = getInstance();
26  CORE_ASSERT( instance->getTransformAsMatrix() == Core::Matrix4::Identity(),
27  "Transform has been changed !" );
28  return static_cast<DebugComponent*>( instance->getComponent( "Debug" ) );
29 }
30 
31 Rendering::RenderObject* DebugComponent::getRenderObject( Core::Utils::Index idx ) {
32  return getRoMgr()->getRenderObject( idx ).get();
33 }
34 #endif
35 
36 RA_SINGLETON_IMPLEMENTATION( SystemEntity );
37 
38 } // namespace Scene
39 } // namespace Engine
40 } // namespace Ra
Component for debug drawing.
Component * getComponent(const std::string &name)
Get component with a given name.
Definition: Entity.cpp:40
Component for UI drawing.
Definition: Cage.cpp:3