MetaCore/tools/MetaCoreWindowProbe.cpp

66 lines
1.7 KiB
C++

#include <iostream>
#include <string>
#if METACORE_HAS_PANDA3D
#include <pandaFramework.h>
#include <windowProperties.h>
#include <windows.h>
#include <filesystem>
#endif
namespace {
void log_step(const std::string& message) {
std::cout << "[MetaCoreWindowProbe] " << message << std::endl;
}
}
int main() {
#ifdef METACORE_HAS_PANDA3D
log_step("Panda backend compile flag is enabled.");
const auto panda_bin = std::filesystem::path(METACORE_PANDA3D_ROOT_PATH) / "bin";
if (std::filesystem::exists(panda_bin)) {
SetDllDirectoryW(panda_bin.wstring().c_str());
log_step("DLL search path set to " + panda_bin.string());
} else {
log_step("Panda bin path not found: " + panda_bin.string());
}
log_step("Creating PandaFramework");
PandaFramework framework;
log_step("Calling open_framework()");
framework.open_framework();
log_step("Setting MetaCore probe window title");
framework.set_window_title("MetaCore Window Probe");
WindowProperties props;
props.set_size(960, 540);
props.set_title("MetaCore Window Probe");
log_step("Calling open_window()");
WindowFramework* window = framework.open_window(props, 0);
if (window == nullptr) {
log_step("open_window() returned null");
framework.close_framework();
return 2;
}
log_step("Window opened successfully");
framework.do_frame(nullptr);
log_step("Frame pumped successfully");
framework.close_window(window);
log_step("Window closed successfully");
framework.close_framework();
log_step("Framework closed successfully");
return 0;
#else
log_step("Panda backend is not enabled in this build.");
return 1;
#endif
}