54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
#include "dll_loader.hpp"
|
|
#include "cmd_client.hpp"
|
|
#include "stopwatch.hpp"
|
|
#include <basalt/char_types.hpp>
|
|
#include <basalt/engine.hpp>
|
|
#include <basalt/deliver.hpp>
|
|
#include <spdlog/spdlog.h>
|
|
|
|
namespace engine = ::basalt::shared::engine;
|
|
using engine::EngineConfig;
|
|
using engine::IEngine;
|
|
namespace deliver = ::basalt::shared::deliver;
|
|
using deliver::DeliverConfig;
|
|
using deliver::IDeliver;
|
|
|
|
namespace dll_loader = ::basalt::presenter::dll_loader;
|
|
using dll_loader::DllKind;
|
|
using dll_loader::DllLoader;
|
|
|
|
using ::basalt::presenter::cmd_client::CmdClient;
|
|
using ::basalt::presenter::stopwatch::Stopwatch;
|
|
|
|
int main(int argc, char* argv[]) {
|
|
spdlog::info("Finding plugins...");
|
|
auto engine_dll = DllLoader(DllKind::Engine, BSTEXT("BasaltDirectX11Engine"));
|
|
auto deliver_dll = DllLoader(DllKind::Deliver, BSTEXT("BasaltPipeDeliver"));
|
|
|
|
auto client = CmdClient();
|
|
spdlog::info("Waiting BasaltTrainer...");
|
|
auto payload = client.wait_handshake();
|
|
|
|
spdlog::info("Allocating resources...");
|
|
auto* engine = engine_dll.create_instance<IEngine>();
|
|
//auto* deliver = deliver_dll.create_instance<IDeliver>();
|
|
|
|
EngineConfig engine_config{.headless = false, .width = payload.width, .height = payload.height};
|
|
engine->startup(std::move(engine_config));
|
|
|
|
spdlog::info("Start to running.");
|
|
Stopwatch stopwatch(120);
|
|
while (true) {
|
|
auto req_stop = engine->tick();
|
|
stopwatch.tick();
|
|
auto can_stop = client.tick(req_stop);
|
|
if (can_stop) break;
|
|
}
|
|
|
|
spdlog::info("Destroying resources...");
|
|
engine->shutdown();
|
|
engine_dll.destroy_instance(engine);
|
|
|
|
spdlog::info("Program stop.");
|
|
}
|