#ifndef TILE_INIT_H
#define TILE_INIT_H

#pragma once

#include <functional>

namespace tile {
int Start(int argc,
          char **argv,
          std::function<int(int, char **)> cb,
          bool single_thread      = false,
          bool enable_crash_catch = true);

void WaitForQuitSignal();
bool CheckForQuitSignal();

void InitializeBasicRuntime();
void TerminateBasicRuntime();

void Init(int argc = 0, char **argv = nullptr, std::function<int(int, char **)> cb = nullptr);
void Uninit();
}// namespace tile

#define TILE_MAIN(func)                                                                                                \
    int main(int argc, char *argv[]) { return ::tile::Start(argc, argv, func); }

#define TILE_LIB_INIT(...) ::tile::Init(__VA_ARGS__);
#define TILE_LIB_UNINIT() ::tile::Uninit();

#endif// TILE_INIT_H
