t7x/src/client/component/scheduler.hpp

39 lines
1.0 KiB
C++
Raw Normal View History

2022-05-21 06:04:08 -04:00
#pragma once
namespace scheduler
{
enum pipeline
{
// Asynchronuous pipeline, disconnected from the game
async = 0,
// The game's rendering pipeline
renderer,
// The game's server thread
server,
// The game's main thread
main,
// Dvars are done loading from the config file
dvars_loaded,
2022-05-21 06:04:08 -04:00
count,
};
static const bool cond_continue = false;
static const bool cond_end = true;
void execute(const pipeline type);
2022-05-21 06:04:08 -04:00
void schedule(const std::function<bool()>& callback, pipeline type = pipeline::async,
2022-05-23 11:57:45 -04:00
std::chrono::milliseconds delay = 0ms);
2022-05-21 06:04:08 -04:00
void loop(const std::function<void()>& callback, pipeline type = pipeline::async,
2022-05-23 11:57:45 -04:00
std::chrono::milliseconds delay = 0ms);
2022-05-21 06:04:08 -04:00
void once(const std::function<void()>& callback, pipeline type = pipeline::async,
2022-05-23 11:57:45 -04:00
std::chrono::milliseconds delay = 0ms);
2022-05-21 06:04:08 -04:00
void on_game_initialized(const std::function<void()>& callback, pipeline type = pipeline::async,
2022-05-23 11:57:45 -04:00
std::chrono::milliseconds delay = 0ms);
}