2025-11-14 16:22:42 +08:00
|
|
|
|
// Vivid2D.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
|
|
|
|
|
//
|
|
|
|
|
|
|
2025-11-14 20:39:01 +08:00
|
|
|
|
#ifdef VIVID_2D_MYDLL_API
|
|
|
|
|
|
#undef VIVID_2D_MYDLL_API
|
|
|
|
|
|
#endif
|
|
|
|
|
|
#define VIVID_2D_MYDLL_API __declspec(dllexport)
|
|
|
|
|
|
|
2025-11-14 16:22:42 +08:00
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
#include <glm/vec2.hpp>
|
2025-11-14 20:39:01 +08:00
|
|
|
|
#include <systems/RenderSystem.h>
|
2025-11-14 16:22:42 +08:00
|
|
|
|
|
|
|
|
|
|
int main() {
|
2025-11-14 20:39:01 +08:00
|
|
|
|
// ----------------------------------------------------
|
|
|
|
|
|
// GLM 向量操作 (与 RenderSystem 无关,保持原样)
|
|
|
|
|
|
// ----------------------------------------------------
|
2025-11-14 16:22:42 +08:00
|
|
|
|
glm::vec2 position(100.0f, 200.0f);
|
|
|
|
|
|
glm::vec2 velocity(5.0f, -2.0f);
|
|
|
|
|
|
position += velocity;
|
|
|
|
|
|
std::cout << "New Position: (" << position.x << ", " << position.y << ")" << std::endl;
|
2025-11-14 20:39:01 +08:00
|
|
|
|
std::cout << "---------------------------------------" << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------
|
|
|
|
|
|
// RenderSystem 静态方法调用 (无需实例化)
|
|
|
|
|
|
// ----------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
// 1. 初始化日志系统 (假设已实现)
|
|
|
|
|
|
std::cout << "Initializing RenderSystem Logging..." << std::endl;
|
|
|
|
|
|
RenderSystem::InitializeLogging();
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 开始渲染线程初始化阶段 (假设已实现)
|
|
|
|
|
|
RenderSystem::beginInitialization();
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 记录一个渲染指令到队列中
|
|
|
|
|
|
std::cout << "Recording a clear color command..." << std::endl;
|
|
|
|
|
|
// 这是一个 lambda 函数,捕获了要执行的 GL 命令
|
|
|
|
|
|
RenderSystem::recordRenderCall([]() {
|
|
|
|
|
|
// 在实际的 RenderSystem 实现中,这会调用 glClearColor(1.0f, 0.5f, 0.0f, 1.0f);
|
|
|
|
|
|
std::cout << "-> (Render Thread) Executing glClearColor(Orange)" << std::endl;
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 4. 执行队列中的渲染指令
|
|
|
|
|
|
std::cout << "Replaying render queue (" << RenderSystem::getQueueSize() << " calls)..." << std::endl;
|
|
|
|
|
|
RenderSystem::replayQueue(); // 假设这个调用会执行上面的 lambda
|
|
|
|
|
|
|
|
|
|
|
|
// 5. 结束初始化阶段
|
|
|
|
|
|
RenderSystem::finishInitialization();
|
|
|
|
|
|
|
|
|
|
|
|
// 6. 关闭日志系统 (确保日志被刷新)
|
|
|
|
|
|
std::cout << "Shutting down RenderSystem Logging." << std::endl;
|
|
|
|
|
|
RenderSystem::ShutdownLogging();
|
2025-11-14 16:22:42 +08:00
|
|
|
|
|
|
|
|
|
|
return 0;
|
2025-11-14 20:39:01 +08:00
|
|
|
|
}
|