i6engine
1.0
|
#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/api/facades/ObjectFacade.h>
Public Member Functions | |
ObjectFacade () | |
Constructor for ObjectFacade. More... | |
~ObjectFacade () | |
GOPtr | getObject (const int64_t guid) const |
It returns a pointer to the GameObject with GUID guid. If there is no GameObject with GUID guid, NULL is returned. More... | |
std::unordered_map< int64_t, GOPtr > | getGOMap () const |
It returns _GOList. More... | |
std::vector< GOPtr > | getAllObjectsOfType (const std::string &types) const |
returns a vector with all GameObjects of the given type More... | |
std::vector< GOPtr > | getAllObjectsOfType (const std::vector< std::string > &types) const |
returns a vector with all GameObjects of the given type More... | |
void | deleteAllObjectsOfType (const std::string &type) const |
deletes all Objects of a given type More... | |
void | createObject (const std::string &gTemplate, const objects::GOTemplate &tmpl, uint64_t uuid, const bool sender) const |
creates a new Object More... | |
void | cleanUpAll () const |
For every GameObject in _GOMap deleteObject will be called. More... | |
void | loadLevel (const std::string &file, const std::string &flags) const |
loads a level from an xml file only using the objects with given flags More... | |
void | loadLevel (const std::string &file, const std::string &flags, const std::string &resourcesFile) const |
loads a level from an xml file only using the objects with given flags and preloads resources specified in resourcesFile More... | |
void | loadLevel (const std::string &file, const std::string &flags, const std::function< void(uint16_t)> &callback) const |
loads a level from an xml file only using the objects with given flags calls callback when progress changes with current value and maximum value the first fifty percent are always the preload of the resources (in this case instant finished), the second fifty percent are the real level More... | |
void | loadLevel (const std::string &file, const std::string &flags, const std::string &resourcesFile, const std::function< void(uint16_t)> &callback) const |
loads a level from an xml file only using the objects with given flags and preloads resources specified in resourcesFile calls callback when progress changes with current value and maximum value the first fifty percent are always the preload of the resources, the second fifty percent are the real level More... | |
void | addTicker (const WeakComPtr &c) |
registers a component to be ticked in every Frame More... | |
void | removeTicker (int64_t c) |
unregisters the component More... | |
uint32_t | getFrameTime () const |
returns duration of one frame of the Object SubSystem More... | |
void | registerCTemplate (const std::string &GOCType, const createGOCCallback &fn) const |
Registers the given Create method and the GOCType in the callback map of the factory. More... | |
void | createGO (const std::string &gTemplate, const objects::GOTemplate &tmpl, uint64_t uuid, const bool sender, const boost::function< void(GOPtr)> &func) const |
creates a new GameObject of that type and calls given callback from object thread after creation is done More... | |
void | createComponent (int64_t goid, int64_t coid, const std::string &component, const attributeMap ¶ms) const |
creates a new Component for given GameObject More... | |
void | createComponentCallback (int64_t goid, int64_t coid, const std::string &component, const attributeMap ¶ms, const boost::function< void(ComPtr)> &callback) const |
creates a new Component for given GameObject, calls callback from object thread when Component is created and initialized More... | |
void | updateGOMap (const std::unordered_map< int64_t, GOPtr > &GOMap) |
updates the GOMap with current state in ObjectSubsystem More... | |
void | setFrametime (uint32_t frametime) |
sets the frametime for this subsystem in the facade, so you can see it from outside the subsystem More... | |
void | sendConditionalMessage (const GameMessage::Ptr &m, const boost::function< bool(const GOPtr &)> &f, bool sync, uint32_t compFamID) const |
sends the given message to all GameObjects fullfilling the given condition function More... | |
void | registerNotifyCallback (const boost::function< void(int64_t)> &f) |
register callback for notifying IDs, call only from ObjectController More... | |
void | notifyNewID (int64_t id) |
notifies new id in subsystem More... | |
void | registerAddTickerCallback (const boost::function< void(const WeakComPtr &)> &func) |
registers callback for addTicker, call only by Object Subsystem More... | |
void | registerRemoveTickerCallback (const boost::function< void(int64_t)> &func) |
registers callback for removeTicker, call only by Object Subsystem More... | |
void | resetSubSystem () const |
resets the subsystem to it's defaults More... | |
void | pause () const |
pauses the subsystem More... | |
void | unpause () const |
unpauses the subsystem More... | |
void | setGOTemplates (const std::map< std::string, objects::GOTemplate > &templates) |
sets all available GOTemplates don't use, only for Object Subsystem More... | |
std::map< std::string, objects::GOTemplate > | getGOTemplates () const |
returns all available GOTemplates More... | |
void | allowComponentsTicking (bool allowTicking) const |
sets whether newly created Components shall be able to tick per default or not per default Components ticking is allowed, but some cases like the level editor want to disable ticking More... | |
Definition at line 47 of file ObjectFacade.h.
i6e::api::ObjectFacade::ObjectFacade | ( | ) |
Constructor for ObjectFacade.
i6e::api::ObjectFacade::~ObjectFacade | ( | ) |
void i6e::api::ObjectFacade::addTicker | ( | const WeakComPtr & | c | ) |
registers a component to be ticked in every Frame
void i6e::api::ObjectFacade::allowComponentsTicking | ( | bool | allowTicking | ) | const |
sets whether newly created Components shall be able to tick per default or not per default Components ticking is allowed, but some cases like the level editor want to disable ticking
void i6e::api::ObjectFacade::cleanUpAll | ( | ) | const |
For every GameObject in _GOMap deleteObject will be called.
void i6e::api::ObjectFacade::createComponent | ( | int64_t | goid, |
int64_t | coid, | ||
const std::string & | component, | ||
const attributeMap & | params | ||
) | const |
creates a new Component for given GameObject
goid | GameObject id |
coid | id for the Component |
component | registered string for create method |
params | attributeMap for this Component |
void i6e::api::ObjectFacade::createComponentCallback | ( | int64_t | goid, |
int64_t | coid, | ||
const std::string & | component, | ||
const attributeMap & | params, | ||
const boost::function< void(ComPtr)> & | callback | ||
) | const |
creates a new Component for given GameObject, calls callback from object thread when Component is created and initialized
goid | GameObject id |
coid | id for the Component |
component | registered string for create method |
params | attributeMap for this Component |
callback | callback that is called after Component is created and initialized |
void i6e::api::ObjectFacade::createGO | ( | const std::string & | gTemplate, |
const objects::GOTemplate & | tmpl, | ||
uint64_t | uuid, | ||
const bool | sender, | ||
const boost::function< void(GOPtr)> & | func | ||
) | const |
creates a new GameObject of that type and calls given callback from object thread after creation is done
Calls the appropriate create-function and returns the new GameObject. It is automatically stored in the ObjectManager, thus manually deleting the object shouldn't be necessary. param[in] name the string used to identify a template. param[in] params a list of pair<std::string, std::string> used to parameterize the creation process param[in] func callback to be called with the new GameObject param[in] sender true if this GameObject should be synchronized in multiplayer games
void i6e::api::ObjectFacade::createObject | ( | const std::string & | gTemplate, |
const objects::GOTemplate & | tmpl, | ||
uint64_t | uuid, | ||
const bool | sender | ||
) | const |
creates a new Object
[in] | gTemplate | template name |
[in] | params | parameter map |
[in] | sender | whether this GameObject should have a NetworkSenderComponent |
void i6e::api::ObjectFacade::deleteAllObjectsOfType | ( | const std::string & | type | ) | const |
deletes all Objects of a given type
std::vector<GOPtr> i6e::api::ObjectFacade::getAllObjectsOfType | ( | const std::string & | types | ) | const |
returns a vector with all GameObjects of the given type
[in] | types | the list of types given in one string, using ; as delimiter |
std::vector<GOPtr> i6e::api::ObjectFacade::getAllObjectsOfType | ( | const std::vector< std::string > & | types | ) | const |
returns a vector with all GameObjects of the given type
[in] | types | the list of types given as a vector |
uint32_t i6e::api::ObjectFacade::getFrameTime | ( | ) | const |
returns duration of one frame of the Object SubSystem
std::unordered_map<int64_t, GOPtr> i6e::api::ObjectFacade::getGOMap | ( | ) | const |
It returns _GOList.
|
inline |
returns all available GOTemplates
Definition at line 251 of file ObjectFacade.h.
GOPtr i6e::api::ObjectFacade::getObject | ( | const int64_t | guid | ) | const |
It returns a pointer to the GameObject with GUID guid. If there is no GameObject with GUID guid, NULL is returned.
[in] | GameObjectID |
|
inline |
loads a level from an xml file only using the objects with given flags
Definition at line 105 of file ObjectFacade.h.
|
inline |
loads a level from an xml file only using the objects with given flags and preloads resources specified in resourcesFile
Definition at line 112 of file ObjectFacade.h.
|
inline |
loads a level from an xml file only using the objects with given flags calls callback when progress changes with current value and maximum value the first fifty percent are always the preload of the resources (in this case instant finished), the second fifty percent are the real level
Definition at line 121 of file ObjectFacade.h.
void i6e::api::ObjectFacade::loadLevel | ( | const std::string & | file, |
const std::string & | flags, | ||
const std::string & | resourcesFile, | ||
const std::function< void(uint16_t)> & | callback | ||
) | const |
loads a level from an xml file only using the objects with given flags and preloads resources specified in resourcesFile calls callback when progress changes with current value and maximum value the first fifty percent are always the preload of the resources, the second fifty percent are the real level
void i6e::api::ObjectFacade::notifyNewID | ( | int64_t | id | ) |
notifies new id in subsystem
void i6e::api::ObjectFacade::pause | ( | ) | const |
pauses the subsystem
void i6e::api::ObjectFacade::registerAddTickerCallback | ( | const boost::function< void(const WeakComPtr &)> & | func | ) |
registers callback for addTicker, call only by Object Subsystem
void i6e::api::ObjectFacade::registerCTemplate | ( | const std::string & | GOCType, |
const createGOCCallback & | fn | ||
) | const |
Registers the given Create method and the GOCType in the callback map of the factory.
[in] | GOCType | of type std::string |
[in] | fn | of type createGOCCallback |
void i6e::api::ObjectFacade::registerNotifyCallback | ( | const boost::function< void(int64_t)> & | f | ) |
register callback for notifying IDs, call only from ObjectController
void i6e::api::ObjectFacade::registerRemoveTickerCallback | ( | const boost::function< void(int64_t)> & | func | ) |
registers callback for removeTicker, call only by Object Subsystem
void i6e::api::ObjectFacade::removeTicker | ( | int64_t | c | ) |
unregisters the component
void i6e::api::ObjectFacade::resetSubSystem | ( | ) | const |
resets the subsystem to it's defaults
void i6e::api::ObjectFacade::sendConditionalMessage | ( | const GameMessage::Ptr & | m, |
const boost::function< bool(const GOPtr &)> & | f, | ||
bool | sync, | ||
uint32_t | compFamID | ||
) | const |
sends the given message to all GameObjects fullfilling the given condition function
m | Message to send |
f | condition function |
sync | true iff messages should go to all clients |
compFamID | sends the message to the component of this family ID if the GameObject has it. If this is empty the message is send to the GameObject. |
|
inline |
sets the frametime for this subsystem in the facade, so you can see it from outside the subsystem
Definition at line 194 of file ObjectFacade.h.
|
inline |
sets all available GOTemplates don't use, only for Object Subsystem
Definition at line 244 of file ObjectFacade.h.
void i6e::api::ObjectFacade::unpause | ( | ) | const |
unpauses the subsystem
void i6e::api::ObjectFacade::updateGOMap | ( | const std::unordered_map< int64_t, GOPtr > & | GOMap | ) |
updates the GOMap with current state in ObjectSubsystem