Data wrapper representing an Object in a Scene.
More...
#include <C_scene.hpp>
|
static bool | isValid (fge::ObjectDataShared const &data) |
| check if the provided shared pointer Object is valid.
|
|
static fge::ObjectDataShared | isValid (fge::ObjectDataWeak const &data) |
| check if the provided weak pointer Object is valid.
|
|
Data wrapper representing an Object in a Scene.
This is the class used to store data relating to an Object in a Scene. There is :
- the bound scene of the object.
- the object.
- the SID of the object
- the plan of the object
- the type of the object
- the plan depth of the object
◆ clearParent()
void fge::ObjectData::clearParent |
( |
| ) |
const |
|
inline |
◆ getObject() [1/2]
◆ getObject() [2/2]
template<class TObject >
TObject * fge::ObjectData::getObject |
( |
| ) |
const |
|
inlinenodiscard |
Get the Object pointer and cast it.
- Template Parameters
-
- Returns
- The Object pointer
◆ getParent()
fge::ObjectDataWeak fge::ObjectData::getParent |
( |
| ) |
const |
|
inlinenodiscard |
Get the parent object.
- Returns
- A weak pointer to the parent object
◆ getPlan()
fge::ObjectPlan fge::ObjectData::getPlan |
( |
| ) |
const |
|
inlinenodiscard |
Get the plan of the Object.
The plan determine the draw order of the Object. If the plan is 0, the Object will be drawn first.
- Returns
- The plan of the Object.
◆ getPlanDepth()
fge::ObjectPlanDepth fge::ObjectData::getPlanDepth |
( |
| ) |
const |
|
inlinenodiscard |
Get the plan depth of the Object.
A plan depth is an index representing the position of the object in a plan. If the depth is 0, the object is drawn before everyone else.
The depth plan is generated by the Scene everytime it is drawn.
This data is considered as dynamic, this means that it is local only and generated by the Scene and should not be saved.
- Returns
- The plan depth of the object.
◆ getScene()
Get the current bound Scene.
- Returns
- The bound Scene pointer or nullptr if there is no Scene
◆ getSid()
fge::ObjectSid fge::ObjectData::getSid |
( |
| ) |
const |
|
inlinenodiscard |
Get the SID of the Object.
An SID (for static identifier) is an unique id for every object in your scene.
- Returns
- The SID of the object
◆ getType()
Get the type of the Object.
The type determine how the Object is synchronised on the network.
- TYPE_OBJECT: a normal object that will be synchronised between client and server
- TYPE_DECAY: an object that will be sent from the server but not synchronised
- TYPE_GUI: an object that is client only and will be not destroyed by a full synchronisation
- Returns
- The type of the Object.
◆ isBound()
bool fge::ObjectData::isBound |
( |
| ) |
const |
|
inlinenodiscard |
Check if the Object is bound to a Scene.
- Returns
- true if the Object is bound, false otherwise
◆ isClass()
bool fge::ObjectData::isClass |
( |
std::string_view const | className | ) |
const |
|
inlinenodiscard |
Check if the Object is a specific class.
- Parameters
-
- Returns
- True if the Object is the specified class, False otherwise
◆ isValid() [1/2]
static bool fge::ObjectData::isValid |
( |
fge::ObjectDataShared const & | data | ) |
|
|
inlinestaticnodiscard |
check if the provided shared pointer Object is valid.
For an shared pointer Object to be considered valid he need to not be nullptr and have a bound Scene.
- Parameters
-
- Returns
- true if the Object is valid or false otherwise
◆ isValid() [2/2]
static fge::ObjectDataShared fge::ObjectData::isValid |
( |
fge::ObjectDataWeak const & | data | ) |
|
|
inlinestaticnodiscard |
check if the provided weak pointer Object is valid.
- Parameters
-
- Returns
- The shared pointer Object if valid or nullptr otherwise
◆ operator==() [1/2]
bool fge::ObjectData::operator== |
( |
fge::Object const * | ptr | ) |
const |
|
inlinenodiscard |
Comparison with another object pointer.
- Returns
- True if same address, False otherwise
◆ operator==() [2/2]
bool fge::ObjectData::operator== |
( |
fge::ObjectSid const & | sid | ) |
const |
|
inlinenodiscard |
Comparison with another SID.
- Returns
- True if same SID, False otherwise
◆ releaseObject()
Release the Object handled by the smart pointer.
This method should only be useful if you use a custom Object handler to handle your objects.
- Warning
- This is your responsibility to destroy the Object after a call to this method.
- Returns
- The pointer of the Object
◆ setParent()
void fge::ObjectData::setParent |
( |
fge::ObjectDataShared const & | object | ) |
const |
|
inline |
Set an parent object.
- Parameters
-
◆ setPlanDepth()
void fge::ObjectData::setPlanDepth |
( |
fge::ObjectPlanDepth | depth | ) |
const |
|
inline |
The documentation for this class was generated from the following file: