void Game::update(){ if (state==playing) seed++; handleStates(); for (auto it = this->actors.begin(); it != actors.end(); it++){ (it->second)->update(); (it->second)->draw(); } auto it = this->actors_add_list.begin(); while (it != actors_add_list.end()){ actors[(*it)->id] = *it; it = actors_add_list.erase(it); } auto cull = actors_cull_list.begin(); while (cull != actors_cull_list.end()){ auto pos = actors.find(*cull); actors.erase(pos); cull = actors_cull_list.erase(cull); } actors_add_list.erase(actors_add_list.begin(), actors_add_list.end()); }
void GameLogic::update(float msec) { ge->out_clearEvents(GameEvents::ET_LOGIC); handleEvents(); handleStates(); ge->in_clearEvents(GameEvents::ET_LOGIC); }