2018-12-27 17:11:52 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class scheduler final : public module
|
|
|
|
{
|
|
|
|
public:
|
2022-04-25 15:26:51 +01:00
|
|
|
enum pipeline
|
|
|
|
{
|
|
|
|
// Asynchronuous pipeline, disconnected from the game
|
|
|
|
async = 0,
|
2018-12-27 17:11:52 +01:00
|
|
|
|
2022-04-25 15:26:51 +01:00
|
|
|
// The game's rendering pipeline
|
|
|
|
renderer,
|
2019-01-16 16:19:21 +01:00
|
|
|
|
2022-04-25 15:26:51 +01:00
|
|
|
// The game's server thread
|
|
|
|
server,
|
|
|
|
|
|
|
|
// The game's main thread
|
|
|
|
main,
|
|
|
|
|
|
|
|
count,
|
|
|
|
};
|
|
|
|
|
|
|
|
void post_start() override;
|
2019-01-27 02:52:33 +01:00
|
|
|
void post_load() override;
|
2018-12-27 17:11:52 +01:00
|
|
|
void pre_destroy() override;
|
|
|
|
|
2022-04-25 15:26:51 +01:00
|
|
|
static void schedule(const std::function<bool()>& callback, pipeline type = pipeline::async,
|
|
|
|
std::chrono::milliseconds delay = 0ms);
|
|
|
|
static void loop(const std::function<void()>& callback, pipeline type = pipeline::async,
|
|
|
|
std::chrono::milliseconds delay = 0ms);
|
|
|
|
static void once(const std::function<void()>& callback, pipeline type = pipeline::async,
|
|
|
|
std::chrono::milliseconds delay = 0ms);
|
2019-01-16 16:19:21 +01:00
|
|
|
|
2022-04-25 15:26:51 +01:00
|
|
|
private:
|
|
|
|
static void execute(const pipeline type);
|
2019-01-27 02:52:33 +01:00
|
|
|
|
2022-04-25 15:26:51 +01:00
|
|
|
static void r_end_frame_stub();
|
2022-04-25 16:07:29 +01:00
|
|
|
static void g_glass_update_stub();
|
2022-04-25 15:26:51 +01:00
|
|
|
static void main_frame_stub();
|
2018-12-27 17:11:52 +01:00
|
|
|
};
|