本文整理汇总了C++中Drawable::decrement_refcount方法的典型用法代码示例。如果您正苦于以下问题:C++ Drawable::decrement_refcount方法的具体用法?C++ Drawable::decrement_refcount怎么用?C++ Drawable::decrement_refcount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drawable
的用法示例。
在下文中一共展示了Drawable::decrement_refcount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: destroy_drawables
/**
* \brief Destroys from Lua all drawable objects created
* by this script.
*/
void LuaContext::destroy_drawables() {
std::set<Drawable*>::iterator it;
for (it = drawables.begin(); it != drawables.end(); ++it) {
Drawable* drawable = *it;
drawable->decrement_refcount();
if (drawable->get_refcount() == 0) {
delete drawable;
}
}
drawables.clear();
drawables_to_remove.clear();
}
示例2: update_drawables
/**
* \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();
}