finish obj loader
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#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;
|
||||
@@ -20,18 +21,22 @@ 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();
|
||||
@@ -40,6 +45,9 @@ int main(int argc, char* argv[]) {
|
||||
if (can_stop) break;
|
||||
}
|
||||
|
||||
spdlog::info("Destroying resources...");
|
||||
engine->shutdown();
|
||||
engine_dll.destroy_instance(engine);
|
||||
|
||||
spdlog::info("Program stop.");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "stopwatch.hpp"
|
||||
#include <print>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace basalt::presenter::stopwatch {
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace basalt::presenter::stopwatch {
|
||||
auto frame_time = static_cast<double>(time_diff.count()) / this->interval;
|
||||
auto fps = 1000.0 / frame_time;
|
||||
// 输出给用户
|
||||
std::print("FPS: {:.2f} Frame Time: {:.4f} ms\n", fps, frame_time);
|
||||
spdlog::info("FPS: {:.2f} Frame Time: {:.4f} ms", fps, frame_time);
|
||||
|
||||
// 把结束时间设置为开始时间继续下一轮循环
|
||||
this->start_point = stop_point;
|
||||
|
||||
Reference in New Issue
Block a user