1
0
Files
BasaltMeter/BasaltPresenter/Presenter/main.cpp

54 lines
1.6 KiB
C++
Raw Normal View History

2026-01-04 23:11:58 +08:00
#include "dll_loader.hpp"
2026-01-08 19:37:25 +08:00
#include "cmd_client.hpp"
2026-01-09 19:29:39 +08:00
#include "stopwatch.hpp"
2026-01-06 16:27:19 +08:00
#include <basalt/char_types.hpp>
2026-01-08 20:25:33 +08:00
#include <basalt/engine.hpp>
#include <basalt/deliver.hpp>
2026-01-09 22:50:24 +08:00
#include <spdlog/spdlog.h>
2026-01-08 20:25:33 +08:00
namespace engine = ::basalt::shared::engine;
using engine::EngineConfig;
using engine::IEngine;
namespace deliver = ::basalt::shared::deliver;
using deliver::DeliverConfig;
using deliver::IDeliver;
2026-01-04 23:11:58 +08:00
2026-01-08 19:37:25 +08:00
namespace dll_loader = ::basalt::presenter::dll_loader;
using dll_loader::DllKind;
using dll_loader::DllLoader;
using ::basalt::presenter::cmd_client::CmdClient;
2026-01-09 19:29:39 +08:00
using ::basalt::presenter::stopwatch::Stopwatch;
2025-11-25 13:38:17 +08:00
int main(int argc, char* argv[]) {
2026-01-09 22:50:24 +08:00
spdlog::info("Finding plugins...");
2026-01-08 19:37:25 +08:00
auto engine_dll = DllLoader(DllKind::Engine, BSTEXT("BasaltDirectX11Engine"));
auto deliver_dll = DllLoader(DllKind::Deliver, BSTEXT("BasaltPipeDeliver"));
2026-01-06 21:24:47 +08:00
2026-01-08 19:37:25 +08:00
auto client = CmdClient();
2026-01-09 22:50:24 +08:00
spdlog::info("Waiting BasaltTrainer...");
2026-01-08 19:37:25 +08:00
auto payload = client.wait_handshake();
2026-01-06 21:24:47 +08:00
2026-01-09 22:50:24 +08:00
spdlog::info("Allocating resources...");
2026-01-08 20:25:33 +08:00
auto* engine = engine_dll.create_instance<IEngine>();
//auto* deliver = deliver_dll.create_instance<IDeliver>();
2026-01-05 16:51:58 +08:00
2026-01-08 20:25:33 +08:00
EngineConfig engine_config{.headless = false, .width = payload.width, .height = payload.height};
engine->startup(std::move(engine_config));
2026-01-04 23:11:58 +08:00
2026-01-09 22:50:24 +08:00
spdlog::info("Start to running.");
2026-01-09 19:29:39 +08:00
Stopwatch stopwatch(120);
2026-01-04 23:11:58 +08:00
while (true) {
2026-01-08 20:25:33 +08:00
auto req_stop = engine->tick();
2026-01-09 19:29:39 +08:00
stopwatch.tick();
2026-01-08 19:37:25 +08:00
auto can_stop = client.tick(req_stop);
2026-01-06 21:24:47 +08:00
if (can_stop) break;
2026-01-04 23:11:58 +08:00
}
2026-01-09 22:50:24 +08:00
spdlog::info("Destroying resources...");
2026-01-08 20:25:33 +08:00
engine->shutdown();
engine_dll.destroy_instance(engine);
2026-01-09 22:50:24 +08:00
spdlog::info("Program stop.");
2025-11-25 13:38:17 +08:00
}