13 changed files with 365 additions and 276 deletions
Binary file not shown.
@ -1,8 +0,0 @@ |
|||||||
#pragma once |
|
||||||
|
|
||||||
#define RCCPPUSER_USE_PRECOMPILED_HEADER 0 |
|
||||||
#define RCCPPUSER_USE_EXCEPTIONS 1 |
|
||||||
#define RCCPPUSER_USE_RTTI 1 |
|
||||||
#define RCCPPUSER_USE_DEBUG_NEW 0 |
|
||||||
#define RCCPPUSER_USE_VLD 0 |
|
||||||
#define RCCPPUSER_USE_IMGUI 0 |
|
@ -1,27 +1,38 @@ |
|||||||
#include <drogon/drogon.h> |
#include "imgui.h" |
||||||
#include <iostream> |
#include "imgui_impl_glfw.h" |
||||||
|
#include "imgui_impl_opengl3.h" |
||||||
using namespace drogon; |
|
||||||
|
|
||||||
int main() |
int main() |
||||||
{ |
{ |
||||||
try |
// 初始化窗口和渲染上下文(例如GLFW+OpenGL)
|
||||||
{ |
glfwInit(); |
||||||
// 设置日志级别
|
GLFWwindow *window = glfwCreateWindow(1280, 720, "ImGui Demo", NULL, NULL); |
||||||
drogon::app().setLogLevel(trantor::Logger::kTrace); |
|
||||||
drogon::app().registerBeginningAdvice([]() |
|
||||||
{ LOG_INFO << "Drogon application starting..."; }); |
|
||||||
|
|
||||||
// 加载配置
|
// 初始化ImGui
|
||||||
drogon::app().loadConfigFile("./config.json"); |
ImGui::CreateContext(); |
||||||
|
ImGui_ImplGlfw_InitForOpenGL(window, true); |
||||||
|
ImGui_ImplOpenGL3_Init("#version 130"); |
||||||
|
|
||||||
// 启动服务
|
while (!glfwWindowShouldClose(window)) |
||||||
drogon::app().run(); |
|
||||||
} |
|
||||||
catch (const std::exception &e) |
|
||||||
{ |
{ |
||||||
std::cerr << "Error: " << e.what() << std::endl; |
// 开始新帧
|
||||||
return 1; |
ImGui_ImplOpenGL3_NewFrame(); |
||||||
|
ImGui_ImplGlfw_NewFrame(); |
||||||
|
ImGui::NewFrame(); |
||||||
|
|
||||||
|
// 创建UI
|
||||||
|
ImGui::Begin("Demo Window"); |
||||||
|
ImGui::Text("Hello, world!"); |
||||||
|
if (ImGui::Button("Save")) |
||||||
|
{ |
||||||
|
// 按钮点击处理
|
||||||
|
} |
||||||
|
ImGui::End(); |
||||||
|
|
||||||
|
// 渲染
|
||||||
|
ImGui::Render(); |
||||||
|
glClear(GL_COLOR_BUFFER_BIT); |
||||||
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); |
||||||
|
glfwSwapBuffers(window); |
||||||
} |
} |
||||||
return 0; |
|
||||||
} |
} |
@ -1,65 +0,0 @@ |
|||||||
{ |
|
||||||
"openapi": "3.0.0", |
|
||||||
"info": { |
|
||||||
"title": "CppServerProject API", |
|
||||||
"version": "1.0.0", |
|
||||||
"description": "A sample C++ backend server with Swagger documentation" |
|
||||||
}, |
|
||||||
"paths": { |
|
||||||
"/hello": { |
|
||||||
"get": { |
|
||||||
"summary": "Hello World", |
|
||||||
"description": "Returns a simple greeting", |
|
||||||
"responses": { |
|
||||||
"200": { |
|
||||||
"description": "Successful response", |
|
||||||
"content": { |
|
||||||
"text/plain": { |
|
||||||
"schema": { |
|
||||||
"type": "string", |
|
||||||
"example": "Hello, World!" |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
}, |
|
||||||
"/api/info": { |
|
||||||
"get": { |
|
||||||
"summary": "Get API info", |
|
||||||
"description": "Returns basic API information", |
|
||||||
"responses": { |
|
||||||
"200": { |
|
||||||
"description": "Successful response", |
|
||||||
"content": { |
|
||||||
"application/json": { |
|
||||||
"schema": { |
|
||||||
"$ref": "#/components/schemas/ApiInfo" |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
}, |
|
||||||
"components": { |
|
||||||
"schemas": { |
|
||||||
"ApiInfo": { |
|
||||||
"type": "object", |
|
||||||
"properties": { |
|
||||||
"status": { |
|
||||||
"type": "string" |
|
||||||
}, |
|
||||||
"version": { |
|
||||||
"type": "string" |
|
||||||
}, |
|
||||||
"message": { |
|
||||||
"type": "string" |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue