#include #include #include "server/server.h" #include "client/client.h" #include "common/themes.h" PLATFORM platform=LINUX; std::string androidpackage="kn.kinfuyuki.forespend"; inline const char* COMMONCONFIG(){return "common.tdf";} tiny::ErrorLevel tiny::level{4}; int main(int argc, char** argv) { enginend::program* game; tiny::startup("forespend","0.03g-rewrite"); bool isserver = false; if (argc>1) { for (int i=1;iboot(); std::atomic running{true}; std::thread tickthread([game, &running]() { double tickrate=1.0/game->tickrate; auto lasttick=std::chrono::high_resolution_clock::now(); while (running) { auto now=std::chrono::high_resolution_clock::now(); double elapsed=std::chrono::duration_cast>(now-lasttick).count(); if (elapsed>=tickrate) { game->tick(); lasttick=now; } else { std::this_thread::sleep_for(std::chrono::duration(tickrate-elapsed)); } } }); double framerate=1.0/game->framerate; auto lastframe=std::chrono::high_resolution_clock::now(); while (!WindowShouldClose()) { auto now=std::chrono::high_resolution_clock::now(); double elapsed=std::chrono::duration_cast>(now-lastframe).count(); if (elapsed>=framerate) { game->draw(); lastframe=now; } else { WaitTime(framerate-elapsed); } } game->exit(); return 0; }