/** * \brief Registers a drawable object created by this script. * \param drawable a drawable object */ void LuaContext::add_drawable(const DrawablePtr& drawable) { Debug::check_assertion(!has_drawable(drawable), "This drawable object is already registered"); drawables.insert(drawable); }
/** * \brief Unregisters a drawable object created by this script. * \param drawable a drawable object */ void LuaContext::remove_drawable(const DrawablePtr& drawable) { Debug::check_assertion(has_drawable(drawable), "This drawable object was not created by Lua"); drawables_to_remove.insert(drawable); }
/** * \brief Registers a drawable object created by this script. * \param drawable a drawable object */ void LuaContext::add_drawable(Drawable* drawable) { Debug::check_assertion(!has_drawable(drawable), "This drawable object is already registered"); RefCountable::ref(drawable); drawables.insert(drawable); }
/** * \brief Registers a drawable object created by this script. * \param drawable a drawable object */ void LuaContext::add_drawable(Drawable* drawable) { Debug::check_assertion(!has_drawable(drawable), "This drawable object is already registered"); drawable->increment_refcount(); drawables.insert(drawable); }
/** * \brief Updates all drawable objects created by this script. */ void LuaContext::update_drawables() { // Update all drawables. for (const DrawablePtr& drawable: drawables) { if (has_drawable(drawable)) { drawable->update(); } } // Remove the ones that should be removed. drawables_to_remove.clear(); }
/** * \brief Updates all drawable objects created by this script. */ void LuaContext::update_drawables() { // Update all drawables. std::set<Drawable*>::iterator it; for (it = drawables.begin(); it != drawables.end(); ++it) { Drawable* drawable = *it; if (has_drawable(drawable)) { drawable->update(); } } // Remove the ones that should be removed. for (it = drawables_to_remove.begin(); it != drawables_to_remove.end(); ++it) { Drawable* drawable = *it; drawables.erase(drawable); RefCountable::unref(drawable); } drawables_to_remove.clear(); }
/** * \brief Updates all drawable objects created by this script. */ void LuaContext::update_drawables() { // Update all drawables. std::set<Drawable*>::iterator it; for (it = drawables.begin(); it != drawables.end(); ++it) { Drawable* drawable = *it; if (has_drawable(drawable)) { drawable->update(); } } // Remove the ones that should be removed. for (it = drawables_to_remove.begin(); it != drawables_to_remove.end(); ++it) { Drawable* drawable = *it; drawables.erase(drawable); drawable->decrement_refcount(); if (drawable->get_refcount() == 0) { delete drawable; } } drawables_to_remove.clear(); }