Add clear methods to relevant context objects
This commit is contained in:
parent
8516718882
commit
0fb12bdc32
@ -236,7 +236,7 @@ namespace game
|
||||
MessageBoxA(nullptr, string.data(), nullptr, 0);
|
||||
}), "alert");
|
||||
|
||||
const auto level_id = *game::native::levelEntityId;
|
||||
const auto level_id = *native::levelEntityId;
|
||||
chai->add_global(chaiscript::var(entity(context, level_id)), "level");
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +94,12 @@ namespace game
|
||||
return {listener.id};
|
||||
}
|
||||
|
||||
void event_handler::clear()
|
||||
{
|
||||
this->event_listeners_.clear();
|
||||
this->generic_event_listeners_.clear();
|
||||
}
|
||||
|
||||
void event_handler::remove(const event_listener_handle& handle)
|
||||
{
|
||||
for (auto task : this->event_listeners_)
|
||||
|
@ -42,6 +42,8 @@ namespace game
|
||||
event_listener_handle add_event_listener(event_listener listener);
|
||||
event_listener_handle add_event_listener(generic_event_listener listener);
|
||||
|
||||
void clear();
|
||||
|
||||
private:
|
||||
context* context_;
|
||||
std::atomic_int64_t current_listener_id_ = 0;
|
||||
|
@ -56,6 +56,11 @@ namespace game
|
||||
}
|
||||
}
|
||||
|
||||
void scheduler::clear()
|
||||
{
|
||||
this->tasks_.clear();
|
||||
}
|
||||
|
||||
task_handle scheduler::add(const std::function<void()>& callback, const long long milliseconds,
|
||||
const bool is_volatile)
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ namespace game
|
||||
explicit scheduler(context* context);
|
||||
|
||||
void run_frame();
|
||||
void clear();
|
||||
|
||||
private:
|
||||
context* context_;
|
||||
|
Loading…
Reference in New Issue
Block a user