supertux
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
GameObjectManager Class Referenceabstract
Inheritance diagram for GameObjectManager:
Sector worldmap::WorldMap

Public Member Functions

GameObjectadd_object (std::unique_ptr< GameObject > object)
 Queue an object up to be added to the object list.
 
void clear_objects ()
 
template<typename T , typename... Args>
T & add (Args &&... args)
 
void update (float dt_sec)
 
void draw (DrawingContext &context)
 
const std::vector< std::unique_ptr< GameObject > > & get_objects () const
 
void flush_game_objects ()
 Commit the queued up additions and deletions to the object list.
 
float get_width () const
 
float get_height () const
 
float get_tiles_width () const
 returns the width (in tiles) of a worldmap
 
float get_tiles_height () const
 returns the height (in tiles) of a worldmap
 
virtual bool before_object_add (GameObject &object)=0
 Hook that is called before an object is added to the vector.
 
virtual void before_object_remove (GameObject &object)=0
 Hook that is called before an object is removed from the vector.
 
template<class T >
GameObjectRange< T > get_objects_by_type () const
 
const std::vector< GameObject * > & get_objects_by_type_index (std::type_index type_idx) const
 
template<class T >
T & get_singleton_by_type () const
 
template<class T >
T * get_object_by_uid (const UID &uid) const
 
void request_name_resolve (const std::string &name, std::function< void(UID)> callback)
 Register a callback to be called once the given name can be resolsed to a UID. More...
 
template<class T >
T * get_object_by_name (const std::string &name) const
 
template<class T >
int get_object_count (std::function< bool(const T &)> predicate=nullptr) const
 Get total number of GameObjects of given type.
 
const std::vector< TileMap * > & get_solid_tilemaps () const
 

Static Public Attributes

static bool s_draw_solids_only = false
 

Protected Member Functions

void process_resolve_requests ()
 
template<class T >
T * get_object_by_type () const
 

Member Function Documentation

§ request_name_resolve()

void GameObjectManager::request_name_resolve ( const std::string &  name,
std::function< void(UID)>  callback 
)

Register a callback to be called once the given name can be resolsed to a UID.

Note that this function is only valid in the construction phase, not during draw() or update() calls, use get_object_by_uid() instead.


The documentation for this class was generated from the following files: