SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
GameObject.h
1#ifndef GameObject_H
2#define GameObject_H
3
4#include "Alarmable/Alarmable.h"
5#include "Collidable/Collidable.h"
6#include "Drawable/Drawable.h"
7#include "Inputable/Inputable.h"
8#include "Updatable/Updatable.h"
9
12
20class GameObject : public Alarmable, public Collidable, public Drawable, public Inputable, public Updatable
21{
22protected:
23 GameObject();
24 GameObject(const GameObject&) = delete;
25 GameObject& operator=(const GameObject&) = delete;
26 virtual ~GameObject();
27
31 void SubmitEntry();
32
36 void SubmitExit();
37
42 virtual void CollisionTerrain() {};
43
44private:
45 friend class GameObjectAttorney;
46
51
56
61
65 void ConnectToScene();
66
71 virtual void SceneEntry() = 0;
72
77
81 virtual void SceneExit() {};
82
83public:
88 bool IsRegistered() const;
89
94 bool IsPendingRegistration() const;
95
100 bool IsPendingDeregistration() const;
101};
102
103#endif
RegistrationState
Enum class representing the registration states of GameObjects.
Definition RegistrationState.h:19
Provides controlled access to the GameObject class for specific classes.
Definition GameObjectAttorney.h:15
Command to handle the entry of a GameObject into the scene.
Definition GameObjectEntryCommand.h:16
Command to handle the exit of a GameObject from the scene.
Definition GameObjectExitCommand.h:16
GameObjectEntryCommand * ptrEntryCmd
Pointer to the entry command for the GameObject.
Definition GameObject.h:55
virtual void CollisionTerrain()
Sets the entry command for the GameObject.
Definition GameObject.h:42
virtual void SceneExit()
Called when the GameObject exits the scene; used for registration management, called by user.
Definition GameObject.h:81
RegistrationState currState
The current registration state of the GameObject.
Definition GameObject.h:50
void DisconnectFromScene()
Disconnects the GameObject from the scene.
Definition GameObject.cpp:44
bool IsRegistered() const
Checks if the GameObject is registered in the scene.
Definition GameObject.cpp:51
void SubmitExit()
Submits the exit command for the GameObject.
Definition GameObject.cpp:27
virtual void SceneEntry()=0
Called when the GameObject enters the scene; used for registration management, called by system on en...
void ConnectToScene()
Connects the GameObject to the scene.
Definition GameObject.cpp:37
void SubmitEntry()
Submits the entry command for the GameObject.
Definition GameObject.cpp:20
bool IsPendingDeregistration() const
Checks if the GameObject is pending deregistration in the scene.
Definition GameObject.cpp:61
bool IsPendingRegistration() const
Checks if the GameObject is pending registration in the scene.
Definition GameObject.cpp:56
GameObjectExitCommand * ptrExitCmd
Pointer to the exit command for the GameObject.
Definition GameObject.h:60