25 #ifndef __I6ENGINE_API_OBJECTFACADE_H__
26 #define __I6ENGINE_API_OBJECTFACADE_H__
28 #include <condition_variable>
31 #include <unordered_map>
44 typedef utils::sharedPtr<GameObject, GameObject>
GOPtr;
62 GOPtr getObject(
const int64_t guid)
const;
68 std::unordered_map<int64_t, GOPtr> getGOMap()
const;
75 std::vector<GOPtr> getAllObjectsOfType(
const std::string & types)
const;
82 std::vector<GOPtr> getAllObjectsOfType(
const std::vector<std::string> & types)
const;
87 void deleteAllObjectsOfType(
const std::string & type)
const;
95 void createObject(
const std::string & gTemplate,
const objects::GOTemplate & tmpl, uint64_t uuid,
const bool sender)
const;
100 void cleanUpAll()
const;
105 void loadLevel(
const std::string & file,
const std::string & flags)
const {
106 loadLevel(file, flags,
"", [](uint16_t) {});
112 void loadLevel(
const std::string & file,
const std::string & flags,
const std::string & resourcesFile)
const {
113 loadLevel(file, flags, resourcesFile, [](uint16_t) {});
121 void loadLevel(
const std::string & file,
const std::string & flags,
const std::function<
void(uint16_t)> & callback)
const {
122 loadLevel(file, flags,
"", callback);
130 void loadLevel(
const std::string & file,
const std::string & flags,
const std::string & resourcesFile,
const std::function<
void(uint16_t)> & callback)
const;
135 void addTicker(
const WeakComPtr & c);
140 void removeTicker(int64_t c);
145 uint32_t getFrameTime()
const;
153 void registerCTemplate(
const std::string & GOCType,
const createGOCCallback & fn)
const;
164 void createGO(
const std::string & gTemplate,
const objects::GOTemplate & tmpl, uint64_t uuid,
const bool sender,
const boost::function<
void(GOPtr)> & func)
const;
173 void createComponent(int64_t goid, int64_t coid,
const std::string & component,
const attributeMap & params)
const;
183 void createComponentCallback(int64_t goid, int64_t coid,
const std::string & component,
const attributeMap & params,
const boost::function<
void(
ComPtr)> & callback)
const;
189 void updateGOMap(
const std::unordered_map<int64_t, GOPtr> & GOMap);
203 void sendConditionalMessage(
const GameMessage::Ptr & m,
const boost::function<
bool(
const GOPtr &)> & f,
bool sync, uint32_t compFamID)
const;
208 void registerNotifyCallback(
const boost::function<
void(int64_t)> & f);
213 void notifyNewID(int64_t
id);
218 void registerAddTickerCallback(
const boost::function<
void(
const WeakComPtr &)> & func);
223 void registerRemoveTickerCallback(
const boost::function<
void(int64_t)> & func);
228 void resetSubSystem()
const;
238 void unpause()
const;
244 void setGOTemplates(
const std::map<std::string, objects::GOTemplate> & templates) {
245 _templateList = templates;
252 return _templateList;
259 void allowComponentsTicking(
bool allowTicking)
const;
265 std::unordered_map<int64_t, GOPtr> _GOMap;
270 mutable std::mutex _lock;
277 boost::function<void(int64_t)> _notify;
279 boost::function<void(const WeakComPtr &)> _addTicker;
280 boost::function<void(int64_t)> _removeTicker;
282 mutable std::mutex _loadLevelLock;
283 mutable std::condition_variable _loadLevelCondVar;
285 std::map<std::string, objects::GOTemplate> _templateList;
utils::sharedPtr< GameObject, GameObject > GOPtr
void setGOTemplates(const std::map< std::string, objects::GOTemplate > &templates)
sets all available GOTemplates don't use, only for Object Subsystem
#define ISIXE_MODULES_API
void setFrametime(uint32_t frametime)
sets the frametime for this subsystem in the facade, so you can see it from outside the subsystem ...
boost::shared_ptr< Message > Ptr
std::map< std::string, std::string > attributeMap
A shared pointer counting references and adds objects being not referenced any more to an internal li...
internal representation of all GameObject templates
utils::weakPtr< Component > WeakComPtr
boost::function< ComPtr(const int64_t, const attributeMap &)> createGOCCallback
std::map< std::string, objects::GOTemplate > getGOTemplates() const
returns all available GOTemplates
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 c...
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 specifi...
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