コード例 #1
0
ファイル: DrawableApi.cpp プロジェクト: Codex-NG/solarus
/**
 * \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);
}
コード例 #2
0
ファイル: DrawableApi.cpp プロジェクト: Codex-NG/solarus
/**
 * \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);
}
コード例 #3
0
ファイル: DrawableAPI.cpp プロジェクト: abenavente406/solarus
/**
 * \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);
}
コード例 #4
0
ファイル: DrawableAPI.cpp プロジェクト: ElAleyo/solarus
/**
 * \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);
}
コード例 #5
0
ファイル: DrawableApi.cpp プロジェクト: Codex-NG/solarus
/**
 * \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();
}
コード例 #6
0
ファイル: DrawableAPI.cpp プロジェクト: abenavente406/solarus
/**
 * \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();
}
コード例 #7
0
ファイル: DrawableAPI.cpp プロジェクト: ElAleyo/solarus
/**
 * \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();
}