1 #ifndef DENGINE_GAMEOBJECT_H 2 #define DENGINE_GAMEOBJECT_H 7 #include<bits/stdc++.h> 9 #include "../Universal.h" 83 void SetPos(
float xPos,
float yPos);
101 auto it = std::find(
tags.begin(),
tags.end(), tag);
102 if(it ==
tags.end()) {
112 auto it = std::find(
tags.begin(),
tags.end(), tag);
113 return it ==
tags.end();
120 auto it = std::find(
tags.begin(),
tags.end(), tag);
121 if(it ==
tags.end()) {
139 #endif //DENGINE_GAMEOBJECT_H std::vector< std::string > tags
Definition: GameObject.h:135
A base object for a game The gameobject can be considered the most basic building block of a game...
Definition: GameObject.h:19
SDL_Rect box
A rect denoting the object's position in space.
Definition: GameObject.h:75
std::string GetName()
Returns the object's name.
Definition: GameObject.cpp:12
GameObject(std::string objectName)
Definition: GameObject.cpp:8
virtual void Render()
Performs render on all attached components.
Definition: GameObject.cpp:54
virtual void NotifyCollision(GameObject &other)
Definition: GameObject.cpp:66
void RemoveTag(std::string tag)
Remove tag from game object.
Definition: GameObject.h:119
bool HasTag(std::string tag)
Check if game object has a tag.
Definition: GameObject.h:111
bool HasComponent(std::string name)
Does it have a component?
Definition: GameObject.cpp:16
void RemoveComponent(Component *component)
Removes a component from the GameObject.
Definition: GameObject.cpp:26
Gameobject component that asssists in adding additional functionality.
Definition: Component.h:14
virtual void Start()
Called on object instantiation.
Definition: GameObject.cpp:30
std::vector< class Component * > components
A vector containing any components that may be on the GameObject.
Definition: GameObject.h:130
std::string name
A string containing the object name.
Definition: GameObject.h:134
void AddTag(std::string tag)
Add a tag to the game object.
Definition: GameObject.h:100
void SetPos(float xPos, float yPos)
Set position.
Definition: GameObject.cpp:61
std::weak_ptr< Component > GetComponentByName(std::string name)
Get a reference to a component.
Definition: GameObject.cpp:44
The namespace containing the engine's code.
Definition: Collider.h:9
virtual void Update()
Runs every frame performing any required logic.
Definition: GameObject.cpp:37
void AddComponent(Component *component)
Adds a component to the GameObject.
Definition: GameObject.cpp:22