Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
GameObject Class Reference

#include <GameObject.h>

+ Inheritance diagram for GameObject:
+ Collaboration diagram for GameObject:

Public Member Functions

 GameObject ()
 
virtual ~GameObject () override=default
 
virtual ObjectType GetObjectType () const
 
virtual EntityType GetEntityType () const
 
void SetPosition (Vector &_p)
 
Vector GetPosition () const
 
Vector GetRenderPosition () const
 
void SetSize (float w, float h)
 
void GetSize (float &w, float &h) const
 
SDL_FRect GetBoundingBox () const
 
void SetBoundingbox (const SDL_FRect &box)
 
void SetDynamic (bool b)
 
bool IsDynamic () const
 
virtual void OnEvent (const Message &msg) override
 
void Render ()
 
std::string Save () const
 
bool Load (const std::string &json)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void Process ()
 
uint64_t GetUID () const
 

Static Public Member Functions

static ObjectCreate ()
 

Static Public Attributes

static bool FactoryRegistered = ObjectFactory::Get().Register("GameObject", Create)
 

Protected Attributes

Vector position
 
Vector vRenderPosition
 
float width = 100.0f
 
float height = 150.0f
 
SDL_FRect boundingBox = { 0.0f, 0.0f, 0.0f, 0.0f }
 
bool isDynamic = false
 
- Protected Attributes inherited from Object
uint64_t uid = 0
 

Additional Inherited Members

- Public Attributes inherited from Object
std::string name = "unnamed_object"
 

Detailed Description

Definition at line 32 of file GameObject.h.

Constructor & Destructor Documentation

◆ GameObject()

GameObject::GameObject ( )
inline

Definition at line 37 of file GameObject.h.

References Object::name.

Referenced by Create().

+ Here is the caller graph for this function:

◆ ~GameObject()

virtual GameObject::~GameObject ( )
overridevirtualdefault

Member Function Documentation

◆ Create()

Object * GameObject::Create ( )
static

Definition at line 15 of file GameObject.cpp.

References GameObject().

+ Here is the call graph for this function:

◆ GetBoundingBox()

SDL_FRect GameObject::GetBoundingBox ( ) const
inline

Definition at line 64 of file GameObject.h.

References boundingBox.

Referenced by _Sprite::Render(), and AI_Player::RenderDebug().

+ Here is the caller graph for this function:

◆ GetEntityType()

virtual EntityType GameObject::GetEntityType ( ) const
inlinevirtual

Reimplemented in Npc, and Player.

Definition at line 43 of file GameObject.h.

References None.

Referenced by Save().

+ Here is the caller graph for this function:

◆ GetObjectType()

virtual ObjectType GameObject::GetObjectType ( ) const
inlinevirtual

Definition at line 42 of file GameObject.h.

References Entity.

◆ GetPosition()

Vector GameObject::GetPosition ( ) const
inline

Definition at line 54 of file GameObject.h.

References position.

Referenced by AI_Player::Process(), _Sprite::Render(), and AI_Player::RenderDebug().

+ Here is the caller graph for this function:

◆ GetRenderPosition()

Vector GameObject::GetRenderPosition ( ) const
inline

Definition at line 55 of file GameObject.h.

References vRenderPosition.

◆ GetSize()

void GameObject::GetSize ( float w,
float h 
) const
inline

Definition at line 63 of file GameObject.h.

References GetComponentTypeID_Static(), height, and width.

Referenced by _Sprite::Render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDynamic()

bool GameObject::IsDynamic ( ) const
inline

Definition at line 67 of file GameObject.h.

References isDynamic.

◆ Load()

bool GameObject::Load ( const std::string &  json)

◆ OnEvent()

void GameObject::OnEvent ( const Message msg)
overridevirtual

Reimplemented from Object.

Definition at line 20 of file GameObject.cpp.

◆ Render()

void GameObject::Render ( )
inlinevirtual

Reimplemented from Object.

Definition at line 73 of file GameObject.h.

References Object::name, position, SYSTEM_LOG, Vector::x, and Vector::y.

◆ Save()

std::string GameObject::Save ( ) const

Definition at line 25 of file GameObject.cpp.

References escape_json_string(), GetComponentTypeID_Static(), GetEntityType(), Object::GetUID(), height, isDynamic, Object::name, position, width, Vector::x, and Vector::y.

+ Here is the call graph for this function:

◆ SetBoundingbox()

void GameObject::SetBoundingbox ( const SDL_FRect box)
inline

Definition at line 65 of file GameObject.h.

References boundingBox, and GetComponentTypeID_Static().

Referenced by _Sprite::Render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDynamic()

void GameObject::SetDynamic ( bool  b)
inline

Definition at line 66 of file GameObject.h.

References isDynamic.

◆ SetPosition()

void GameObject::SetPosition ( Vector _p)
inline

Definition at line 48 of file GameObject.h.

References boundingBox, GetComponentTypeID_Static(), height, position, vRenderPosition, and width.

Referenced by AI_Player::Process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetSize()

void GameObject::SetSize ( float  w,
float  h 
)
inline

Definition at line 56 of file GameObject.h.

References boundingBox, GetComponentTypeID_Static(), height, and width.

Referenced by _Sprite::SetSprite().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ boundingBox

SDL_FRect GameObject::boundingBox = { 0.0f, 0.0f, 0.0f, 0.0f }
protected

Definition at line 86 of file GameObject.h.

Referenced by GetBoundingBox(), SetBoundingbox(), SetPosition(), and SetSize().

◆ FactoryRegistered

bool GameObject::FactoryRegistered = ObjectFactory::Get().Register("GameObject", Create)
static

Definition at line 35 of file GameObject.h.

◆ height

float GameObject::height = 150.0f
protected

Definition at line 84 of file GameObject.h.

Referenced by GetSize(), Load(), Save(), SetPosition(), and SetSize().

◆ isDynamic

bool GameObject::isDynamic = false
protected

Definition at line 88 of file GameObject.h.

Referenced by IsDynamic(), Load(), Save(), and SetDynamic().

◆ position

Vector GameObject::position
protected

Definition at line 81 of file GameObject.h.

Referenced by GetPosition(), Load(), Render(), Save(), and SetPosition().

◆ vRenderPosition

Vector GameObject::vRenderPosition
protected

Definition at line 81 of file GameObject.h.

Referenced by GetRenderPosition(), and SetPosition().

◆ width

float GameObject::width = 100.0f
protected

Definition at line 83 of file GameObject.h.

Referenced by GetSize(), Load(), Save(), SetPosition(), and SetSize().


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