17#ifndef _FGE_C_SCENE_HPP_INCLUDED
18#define _FGE_C_SCENE_HPP_INCLUDED
20#include "FastEngine/fge_extern.hpp"
22#include "FastEngine/C_callback.hpp"
23#include "FastEngine/C_commandHandler.hpp"
24#include "FastEngine/C_propertyList.hpp"
25#include "FastEngine/graphic/C_renderTarget.hpp"
26#include "FastEngine/network/C_identity.hpp"
27#include "FastEngine/object/C_object.hpp"
31#include <unordered_map>
33#define FGE_SCENE_PLAN_HIDE_BACK (FGE_SCENE_PLAN_MIDDLE - 4)
34#define FGE_SCENE_PLAN_BACK (FGE_SCENE_PLAN_MIDDLE - 2)
35#define FGE_SCENE_PLAN_MIDDLE \
40#define FGE_SCENE_PLAN_TOP (FGE_SCENE_PLAN_MIDDLE + 2)
41#define FGE_SCENE_PLAN_GUI (FGE_SCENE_PLAN_MIDDLE + 4)
42#define FGE_SCENE_PLAN_HIGH_TOP (FGE_SCENE_PLAN_MIDDLE + 6)
43#define FGE_SCENE_PLAN_DEFAULT FGE_SCENE_PLAN_MIDDLE
45#define FGE_SCENE_BAD_SID std::numeric_limits<fge::ObjectSid>::max()
46#define FGE_SCENE_BAD_PLANDEPTH std::numeric_limits<fge::ObjectPlanDepth>::max()
47#define FGE_SCENE_BAD_PLAN std::numeric_limits<fge::ObjectPlan>::max()
49#define FGE_SCENE_LIMIT_NAMESIZE 200
51#define FGE_NEWOBJECT(objectType_, ...) \
59#define FGE_NEWOBJECT_PTR(objectPtr_) \
77using ObjectPlanDepth = uint32_t;
78using ObjectPlan = uint16_t;
79using ObjectSid = uint32_t;
80using ObjectPtr = std::unique_ptr<fge::Object>;
98 enum class Events : uint8_t
106 using Events_t = std::underlying_type_t<Events>;
128using ObjectTypes_t = std::underlying_type_t<ObjectTypes>;
130static_assert(
sizeof(fge::ObjectSid) ==
sizeof(uint32_t),
"fge::ObjectSid must be the same size as uint32_t");
131static_assert(
static_cast<ObjectTypes_t
>(ObjectTypes::_MAX_) <= 4,
132 "Too many ObjectTypes, DefaultSIDRanges must change");
133enum class DefaultSIDRanges : ObjectSid
137 MASK = ObjectSid{0x3} << MASK_POS,
139 POS_NULL = ObjectSid{
static_cast<ObjectTypes_t
>(ObjectTypes::INVALID)} << MASK_POS,
140 POS_OBJECT = ObjectSid{
static_cast<ObjectTypes_t
>(ObjectTypes::OBJECT)} << MASK_POS,
141 POS_DECAY = ObjectSid{
static_cast<ObjectTypes_t
>(ObjectTypes::DECAY)} << MASK_POS,
142 POS_GUI = ObjectSid{
static_cast<ObjectTypes_t
>(ObjectTypes::GUI)} << MASK_POS
144using DefaultSIDRanges_t = std::underlying_type_t<DefaultSIDRanges>;
146enum ObjectContextFlags : uint32_t
148 OBJ_CONTEXT_NETWORK = 1 << 0,
149 OBJ_CONTEXT_DETACHED = 1 << 1,
151 OBJ_CONTEXT_NONE = 0,
152 OBJ_CONTEXT_DEFAULT = OBJ_CONTEXT_NONE
172 inline ObjectData() :
173 g_boundScene(
nullptr),
176 g_sid(FGE_SCENE_BAD_SID),
177 g_plan(FGE_SCENE_PLAN_DEFAULT),
178 g_type(fge::ObjectTypes::INVALID),
180 g_planDepth(FGE_SCENE_BAD_PLANDEPTH),
181 g_requireForceClientsCheckup(
true)
184 fge::ObjectPtr&& newObj,
185 fge::ObjectSid newSid = FGE_SCENE_BAD_SID,
186 fge::ObjectPlan newPlan = FGE_SCENE_PLAN_DEFAULT,
188 g_boundScene(boundScene),
190 g_object(std::move(newObj)),
195 g_planDepth(FGE_SCENE_BAD_PLANDEPTH),
196 g_requireForceClientsCheckup(
true)
229 template<
class TObject>
232 return reinterpret_cast<TObject*
>(this->g_object.get());
241 [[nodiscard]]
inline fge::ObjectSid
getSid()
const {
return this->g_sid; }
250 [[nodiscard]]
inline fge::ObjectPlan
getPlan()
const {
return this->g_plan; }
270 inline void setPlanDepth(fge::ObjectPlanDepth depth)
const { this->g_planDepth = depth; }
284 [[nodiscard]]
inline fge::ObjectPlanDepth
getPlanDepth()
const {
return this->g_planDepth; }
291 inline void setParent(fge::ObjectDataShared
const&
object)
const
295 this->g_parent = object;
307 [[nodiscard]]
inline fge::ObjectDataWeak
getParent()
const {
return this->g_parent; }
314 [[nodiscard]]
inline bool isBound()
const {
return this->g_boundScene !=
nullptr; }
322 [[nodiscard]]
inline bool isClass(std::string_view
const className)
const
324 return this->g_object->getClassName() == className;
334 [[nodiscard]]
inline bool operator==(fge::ObjectSid
const& sid)
const {
return this->g_sid == sid; }
351 [[nodiscard]]
static inline bool isValid(fge::ObjectDataShared
const& data) {
return data && data->isBound(); }
359 [[nodiscard]]
static inline fge::ObjectDataShared
isValid(fge::ObjectDataWeak
const& data)
361 if (
auto dataShared = data.lock())
363 return dataShared->isBound() ? dataShared :
nullptr;
371 fge::ObjectPtr g_object;
372 fge::ObjectSid g_sid;
373 fge::ObjectPlan g_plan;
377 mutable fge::ObjectPlanDepth g_planDepth;
378 mutable fge::ObjectDataWeak g_parent;
381 bool g_requireForceClientsCheckup;
387using ObjectDataWeak = std::weak_ptr<fge::ObjectData>;
388using ObjectDataShared = std::shared_ptr<fge::ObjectData>;
389using ObjectContainer = std::list<fge::ObjectDataShared>;
390using ObjectPlanDataMap = std::map<fge::ObjectPlan, fge::ObjectContainer::iterator>;
397class FGE_API ObjectContainerHashMap
400 using Map = std::unordered_map<ObjectSid, ObjectContainer::iterator>;
402 ObjectContainerHashMap() =
default;
403 explicit ObjectContainerHashMap(ObjectContainer& objects);
404 ObjectContainerHashMap(ObjectContainerHashMap
const& r) =
delete;
405 ObjectContainerHashMap(ObjectContainerHashMap&& r)
noexcept =
default;
406 ~ObjectContainerHashMap() =
default;
408 ObjectContainerHashMap& operator=(ObjectContainerHashMap
const& r) =
delete;
409 ObjectContainerHashMap& operator=(ObjectContainerHashMap&& r)
noexcept =
default;
412 void reMap(ObjectContainer& objects);
435 [[nodiscard]]
bool newObject(ObjectSid sid, ObjectContainer::iterator it);
443 [[nodiscard]] std::optional<ObjectContainer::iterator> find(ObjectSid sid);
444 [[nodiscard]] std::optional<ObjectContainer::const_iterator> find(ObjectSid sid)
const;
445 [[nodiscard]] fge::ObjectContainer::value_type retrieve(ObjectSid sid)
const;
446 [[nodiscard]]
bool contains(ObjectSid sid)
const;
448 [[nodiscard]] std::size_t size()
const;
467 using NetworkEventQueue = std::queue<fge::SceneNetEvent>;
468 using UpdateCount = uint16_t;
475 enum UpdateFlags : uint32_t
478 INCREMENT_UPDATE_COUNT = 1 << 0
482 explicit Scene(std::string sceneName);
488 Scene& operator=(
Scene&& r)
noexcept =
delete;
496 inline std::string
const&
getName()
const {
return this->g_name; }
504 if (name.size() <= FGE_SCENE_LIMIT_NAMESIZE)
506 this->g_name = std::move(name);
526 fge::DeltaTime
const& deltaTime,
527 std::underlying_type_t<UpdateFlags> flags = UpdateFlags::INCREMENT_UPDATE_COUNT);
531 fge::DeltaTime
const& deltaTime,
532 std::underlying_type_t<UpdateFlags> flags = UpdateFlags::NONE);
564#ifndef FGE_DEF_SERVER
612 fge::ObjectPlan _plan{FGE_SCENE_PLAN_DEFAULT};
613 fge::ObjectSid _sid{FGE_SCENE_BAD_SID};
642 fge::ObjectPlan plan = FGE_SCENE_PLAN_DEFAULT,
643 fge::ObjectSid sid = FGE_SCENE_BAD_SID,
648 template<
class TObject,
class... TArgs>
651 static_assert(std::is_base_of_v<fge::Object, TObject>,
"TObject must be a child of fge::Object");
652 auto object = this->
newObject(std::make_unique<TObject>(std::forward<TArgs>(args)...), parameters._plan,
653 parameters._sid, parameters._type, parameters._silent, parameters._contextFlags);
656 template<
class TObject,
class... TArgs>
657 inline TObject* newObject(TArgs&&... args)
659 static_assert(std::is_base_of_v<fge::Object, TObject>,
"TObject must be a child of fge::Object");
660 auto object = this->newObject(std::make_unique<TObject>(std::forward<TArgs>(args)...));
661 return object ?
object->template getObject<TObject>() : nullptr;
663 template<
class TObject>
664 inline TObject* newObject()
666 static_assert(std::is_base_of_v<fge::Object, TObject>,
"TObject must be a child of fge::Object");
667 auto object = this->newObject(std::make_unique<TObject>());
668 return object ?
object->template getObject<TObject>() : nullptr;
684 fge::ObjectDataShared
newObject(fge::ObjectDataShared
const& objectData,
bool silent =
false);
698 fge::ObjectDataShared
duplicateObject(fge::ObjectSid sid, fge::ObjectSid newSid = FGE_SCENE_BAD_SID);
810 fge::ObjectDataShared
getObject(fge::ObjectSid sid)
const;
865 std::size_t
getAllObj_ByZone(fge::RectFloat
const& zone, fge::ObjectContainer& buff)
const;
867#ifndef FGE_DEF_SERVER
887 fge::ObjectContainer& buff)
const;
925 fge::ObjectContainer& buff)
const;
946 fge::ObjectContainer& buff)
const;
972 std::size_t
getAllObj_ByTag(std::string_view tag_name, fge::ObjectContainer& buff)
const;
993#ifndef FGE_DEF_SERVER
1071 inline bool isValid(fge::ObjectSid sid)
const {
return this->
find(sid) != this->g_objects.cend(); }
1153 std::optional<fge::net::Error>
1281 inline fge::ObjectDataShared operator[](fge::ObjectSid sid)
const {
return this->
getObject(sid); }
1392 inline fge::ObjectContainer::const_iterator begin()
const {
return this->g_objects.begin(); }
1393 inline fge::ObjectContainer::const_iterator end()
const {
return this->g_objects.end(); }
1394 inline fge::ObjectContainer::const_reverse_iterator rbegin()
const {
return this->g_objects.rbegin(); }
1395 inline fge::ObjectContainer::const_reverse_iterator rend()
const {
return this->g_objects.rend(); }
1403 fge::ObjectContainer::const_iterator
find(fge::ObjectSid sid)
const;
1417 fge::ObjectContainer::const_iterator
findPlan(fge::ObjectPlan plan)
const;
1458 struct PerClientSync
1460 inline explicit PerClientSync(UpdateCount updateCount) :
1461 _lastUpdateCount(updateCount)
1464 UpdateCount _lastUpdateCount;
1465 NetworkEventQueue _networkEvents;
1467 using PerClientSyncMap = std::unordered_map<fge::net::Identity, PerClientSync, fge::net::IdentityHash>;
1469 void hash_updatePlanDataMap(fge::ObjectPlan plan, fge::ObjectContainer::iterator whoIterator,
bool isLeaving);
1470 fge::ObjectContainer::iterator hash_getInsertionIteratorFromPlanDataMap(fge::ObjectPlan plan);
1474 NetworkEventQueue g_sceneNetworkEvents;
1475 PerClientSyncMap g_perClientSyncs;
1476 bool g_enableNetworkEventsFlag;
1481 uint16_t g_updateCount;
1483 fge::ObjectContainer::iterator g_updatedObjectIterator;
1485 fge::ObjectContainer g_objects;
1487 fge::ObjectPlanDataMap g_planDataMap;
This class is used to handle callbacks in a safe way.
Definition C_callback.hpp:189
Definition C_childObjectsAccessor.hpp:43
CommandHandler is a class that can be used to handle commands.
Definition C_commandHandler.hpp:55
A class to handle "flags" for an enum type.
Definition C_flag.hpp:104
This class is a wrapper for SDL events.
Definition C_event.hpp:59
A class to handle highest priority selection of GUI elements.
Definition C_guiElement.hpp:235
A hash map to have direct access to an Object in a Scene.
Definition C_scene.hpp:398
void delObject(ObjectSid sid)
Announce the deletion of an Object.
bool newSid(ObjectSid oldSid, ObjectSid newSid)
Announce a new SID for an Object.
bool newObject(ObjectSid sid, ObjectContainer::iterator it)
Announce a new Object in the hash map.
fge::Object * getObject() const
Get the Object pointer.
Definition C_scene.hpp:222
void setParent(fge::ObjectDataShared const &object) const
Set an parent object.
Definition C_scene.hpp:291
void clearParent() const
Clear the parent object.
Definition C_scene.hpp:301
fge::ObjectSid getSid() const
Get the SID of the Object.
Definition C_scene.hpp:241
fge::ObjectDataWeak getParent() const
Get the parent object.
Definition C_scene.hpp:307
static bool isValid(fge::ObjectDataShared const &data)
check if the provided shared pointer Object is valid.
Definition C_scene.hpp:351
bool isBound() const
Check if the Object is bound to a Scene.
Definition C_scene.hpp:314
fge::ObjectTypes getType() const
Get the type of the Object.
Definition C_scene.hpp:262
fge::ObjectPlanDepth getPlanDepth() const
Get the plan depth of the Object.
Definition C_scene.hpp:284
static fge::ObjectDataShared isValid(fge::ObjectDataWeak const &data)
check if the provided weak pointer Object is valid.
Definition C_scene.hpp:359
fge::ObjectPlan getPlan() const
Get the plan of the Object.
Definition C_scene.hpp:250
bool operator==(fge::ObjectSid const &sid) const
Comparison with another SID.
Definition C_scene.hpp:334
fge::Scene * getScene() const
Get the current bound Scene.
Definition C_scene.hpp:216
bool isClass(std::string_view const className) const
Check if the Object is a specific class.
Definition C_scene.hpp:322
fge::Object * releaseObject()
Release the Object handled by the smart pointer.
Definition C_scene.hpp:209
void setPlanDepth(fge::ObjectPlanDepth depth) const
Set the plan depth of the Object.
Definition C_scene.hpp:270
TObject * getObject() const
Get the Object pointer and cast it.
Definition C_scene.hpp:230
bool operator==(fge::Object const *ptr) const
Comparison with another object pointer.
Definition C_scene.hpp:340
The Object class is the base class for all objects in the engine.
Definition C_object.hpp:102
Definition C_view.hpp:156
A class that map a string to a Property.
Definition C_propertyList.hpp:35
The RenderStates class contains all the information needed to render something.
Definition C_renderStates.hpp:412
Definition C_renderTarget.hpp:56
A scene contain a collection of object and handle them.
Definition C_scene.hpp:465
bool loadFromFile(std::filesystem::path const &path)
Load all the Scene data from a json file.
virtual fge::ObjectSid generateSid(fge::ObjectSid wanted_sid, fge::ObjectTypes type) const
Generate an SID based on the provided wanted SID.
fge::ObjectDataShared newObject(fge::ObjectPtr &&newObject, fge::ObjectPlan plan=fge::ObjectPlan { 100 }, fge::ObjectSid sid=std::numeric_limits< fge::ObjectSid >::max(), fge::ObjectTypes type=fge::ObjectTypes::OBJECT, bool silent=false, fge::EnumFlags< ObjectContextFlags > contextFlags=OBJ_CONTEXT_DEFAULT)
Add a new Object in the Scene.
void setName(std::string name)
Set the name of the Scene.
Definition C_scene.hpp:502
fge::CallbackHandler< fge::Scene & > _onDelayedUpdate
Event called only once after a Scene update.
Definition C_scene.hpp:1455
void clear()
Clear the Scene.
void updateAllPlanDepth(fge::ObjectPlan plan)
update the ObjectPlanDepth for every objects inside the same plan
bool isWatchingEvent() const
Check if the Scene is currently watching events. ".
void update(fge::RenderTarget &target, fge::Event &event, fge::DeltaTime const &deltaTime, std::underlying_type_t< UpdateFlags > flags=UpdateFlags::NONE)
Update of the Scene.
uint16_t getUpdateCount() const
Return the number of update.
void clearNetEventsQueue(fge::net::Identity const &id)
Clear Scene network events queue for the specified client.
void updateAllPlanDepth()
update the ObjectPlanDepth for every objects
fge::ObjectDataShared getFirstObj_ByPosition(fge::Vector2f const &pos) const
Get the first Object with a position.
std::optional< fge::net::Error > unpackModification(fge::net::Packet const &pck, UpdateCountRange &range, bool ignoreUpdateCount=false)
Unpack all modification of received data packet from a server.
fge::ObjectDataShared duplicateObject(fge::ObjectSid sid, fge::ObjectSid newSid=std::numeric_limits< fge::ObjectSid >::max())
Duplicate the provided Object SID.
fge::CallbackContext getCallbackContext() const
Get the callback context of this Scene.
fge::ObjectDataShared getFirstObj_ByClass(std::string_view class_name) const
Get the first Object that match a provided class name.
fge::Object * getObjectPtr(fge::ObjectSid sid) const
Get an Object pointer with his SID.
bool pushEvent(fge::SceneNetEvent const &netEvent, fge::net::Identity const &id)
Manually push a Scene related event for a specified client.
void forceCheckClient(fge::net::Identity const &id)
Force every network type modification flag to be true for a specified client net::Identity.
fge::ObjectDataShared getFirstObj_ByLocalZone(fge::RectInt const &zone, fge::RenderTarget const &target) const
Get the first Object within a local zone.
std::size_t getObjectSize() const
Get total Object stored in this Scene.
Definition C_scene.hpp:837
void signalObject(fge::ObjectSid sid, int8_t signal)
Signal an Object over the network.
fge::ObjectSid getSid(fge::Object const *ptr) const
Get the SID of the provided Object pointer.
std::size_t getAllObj_ByZone(fge::RectFloat const &zone, fge::ObjectContainer &buff) const
Get all Object within a zone (or rectangle).
bool saveInFile(std::filesystem::path const &path)
Save all the Scene with its Object in a file.
fge::ObjectDataShared getFirstObj_FromLocalZone(fge::RectInt const &zone, fge::RenderTarget const &target) const
Get the first Object within a local zone.
std::optional< fge::net::Error > unpack(fge::net::Packet const &pck, bool clearObjects=true)
Unpack all the received data of a serverside Scene.
void forceUncheckClient(fge::net::Identity const &id)
Force every network type modification flag to be false for a specified client net::Identity.
fge::RenderTarget * getLinkedRenderTarget()
Get the RenderTarget linked to this Scene (non-const).
bool setObject(fge::ObjectSid sid, fge::ObjectPtr &&newObject)
Set a new Object pointer in place of the provided one.
fge::CallbackHandler< fge::Scene &, fge::ObjectPlan > _onPlanUpdate
Event called when a change in the plan is detected.
Definition C_scene.hpp:1447
virtual void saveCustomData(nlohmann::json &jsonObject)
Save some user defined custom data.
Definition C_scene.hpp:1352
void clientsCheckup(fge::net::ClientList const &clients, bool force=false)
Do a clients checkup.
std::size_t delAllObject(bool ignoreGuiObject)
Delete every Object in the Scene.
virtual void loadCustomData(nlohmann::json &jsonObject)
Load some user defined custom data.
Definition C_scene.hpp:1363
bool delObject(fge::ObjectSid sid)
Delete the Object provided with his SID.
std::size_t getAllObj_ByClass(std::string_view class_name, fge::ObjectContainer &buff) const
Get all Object with the same class name.
fge::ObjectDataShared transferObject(fge::ObjectSid sid, fge::Scene &newScene)
Transfer the specified Object to another Scene.
fge::ObjectContainer::const_iterator findPlan(fge::ObjectPlan plan) const
Find an Object with the specified plan.
void clearPerClientSyncData()
Remove all network clients related data.
void packModification(fge::net::Packet &pck, fge::net::Identity const &id)
Pack all modification in a net::Packet for a net::Client.
void packNeededUpdate(fge::net::Packet &pck)
Pack object that need an explicit update from the server.
fge::ObjectDataShared getObject(fge::ObjectSid sid) const
Get an Object with his SID.
std::size_t getAllObj_FromLocalZone(fge::RectInt const &zone, fge::RenderTarget const &target, fge::ObjectContainer &buff) const
Get all Object within a local zone (or rectangle).
bool isValid(fge::ObjectSid sid) const
Check if the SID correspond to an Object in this Scene.
Definition C_scene.hpp:1071
fge::net::NetworkTypeHandler _netList
Definition C_scene.hpp:1424
std::size_t getAllObj_ByLocalPosition(fge::Vector2i const &pos, fge::RenderTarget const &target, fge::ObjectContainer &buff) const
Get all Object with a local position.
void setLinkedRenderTarget(fge::RenderTarget *target)
Link a RenderTarget to the Scene.
fge::RenderTarget const * getLinkedRenderTarget() const
Get the RenderTarget linked to this Scene.
fge::ObjectContainer::const_iterator find(fge::ObjectSid sid) const
Find an Object with the specified SID.
bool setObjectSid(fge::ObjectSid sid, fge::ObjectSid newSid)
Set the Object with a new SID.
bool setObjectPlanTop(fge::ObjectSid sid)
Set an Object on top of his plan.
fge::View const * getRelatedView() const
Get the related view of the scene.
void setCallbackContext(fge::CallbackContext context)
Set the callback context of this Scene.
fge::PropertyList _properties
Definition C_scene.hpp:1430
fge::ObjectDataShared getFirstObj_ByZone(fge::RectFloat const &zone) const
Get the first Object within a zone.
fge::CallbackHandler< fge::Scene &, fge::ObjectDataShared const & > _onObjectRemoved
Event called when an Object has been removed.
Definition C_scene.hpp:1439
void draw(fge::RenderTarget &target, fge::RenderStates const &states=fge::RenderStates{}) const
Draw the Scene.
fge::CallbackHandler< fge::Scene &, fge::ObjectDataShared const & > _onObjectAdded
Event called when a new Object has been added.
Definition C_scene.hpp:1437
void packWatchedEvent(fge::net::Packet &pck, fge::net::Identity const &id)
Pack all Scene related events for a specified client.
std::optional< fge::net::Error > unpackNeededUpdate(fge::net::Packet const &pck, fge::net::Identity const &id)
Unpack client object that require an explicit update.
std::size_t getAllObj_FromLocalPosition(fge::Vector2i const &pos, fge::RenderTarget const &target, fge::ObjectContainer &buff) const
Get all Object with a local position.
fge::ObjectPlanDepth updatePlanDepth(fge::ObjectSid sid)
update the ObjectPlanDepth for one object
fge::ObjectContainer::const_iterator find(fge::Object const *ptr) const
Find an Object with the specified Object pointer.
std::size_t getAllObj_ByLocalZone(fge::RectInt const &zone, fge::RenderTarget const &target, fge::ObjectContainer &buff) const
Get all Object within a local zone (or rectangle).
fge::ObjectDataShared getFirstObj_ByTag(std::string_view tag_name) const
Get the first Object that match a provided tag.
fge::ObjectDataShared getFirstObj_FromLocalPosition(fge::Vector2i const &pos, fge::RenderTarget const &target) const
Get the first Object with a local position.
fge::CallbackHandler< fge::Scene const &, fge::RenderTarget & > _onDraw
Event called when the Scene is about to be drawn.
Definition C_scene.hpp:1434
void pushEvent(fge::SceneNetEvent const &netEvent)
Manually push a Scene related event for every clients.
void delUpdatedObject()
Delete the actual updated Object.
void pack(fge::net::Packet &pck, fge::net::Identity const &id)
Pack all the Scene data in a Packet for a net::Client.
bool setObjectPlan(fge::ObjectSid sid, fge::ObjectPlan newPlan)
Set a new Object plan.
bool setObjectPlanBot(fge::ObjectSid sid)
Set an Object in the bottom of his plan.
void watchEvent(bool on)
Start to watch Scene related event or not.
std::string const & getName() const
Get the name of the Scene.
Definition C_scene.hpp:496
std::optional< fge::net::Error > unpackWatchedEvent(fge::net::Packet const &pck)
Unpack all Scene related events from a server.
std::size_t getAllObj_ByTag(std::string_view tag_name, fge::ObjectContainer &buff) const
Get all Object that contain the provided tag.
fge::ObjectDataShared getObject(fge::Object const *ptr) const
Get an Object with his pointer.
fge::ObjectDataShared getUpdatedObject() const
Get the actual updated Object.
fge::ObjectDataShared newObject(fge::ObjectDataShared const &objectData, bool silent=false)
Add a new Object in the Scene.
fge::ObjectDataShared getFirstObj_ByLocalPosition(fge::Vector2i const &pos, fge::RenderTarget const &target) const
Get the first Object with a local position.
std::size_t getAllObj_ByPosition(fge::Vector2f const &pos, fge::ObjectContainer &buff) const
Get all Object with a position.
void clearNetEventsQueue()
Clear Scene network events queue for all clients.
Define a camera in a 2D scene.
Definition C_view.hpp:49
A list of clients used by a server.
Definition C_clientList.hpp:60
A regroupment of network types.
Definition C_networkType.hpp:690
Definition C_packet.hpp:52
ObjectTypes
Represent different Object type.
Definition C_scene.hpp:119
Definition C_scene.hpp:83
Structure that represent an network event related to Scene.
Definition C_scene.hpp:97
Parameters for the newObject method.
Definition C_scene.hpp:611
Definition C_scene.hpp:470
A class to represent a client or server identity with an IP address and a port.
Definition C_identity.hpp:31