13 changed files with 365 additions and 276 deletions
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
Subproject commit 73cb76986ce1748eaee5ee6aee9c34a835d52fd5 |
Binary file not shown.
@ -1,8 +0,0 @@
@@ -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 @@
@@ -1,27 +1,38 @@
|
||||
#include <drogon/drogon.h> |
||||
#include <iostream> |
||||
|
||||
using namespace drogon; |
||||
#include "imgui.h" |
||||
#include "imgui_impl_glfw.h" |
||||
#include "imgui_impl_opengl3.h" |
||||
|
||||
int main() |
||||
{ |
||||
try |
||||
{ |
||||
// 设置日志级别
|
||||
drogon::app().setLogLevel(trantor::Logger::kTrace); |
||||
drogon::app().registerBeginningAdvice([]() |
||||
{ LOG_INFO << "Drogon application starting..."; }); |
||||
// 初始化窗口和渲染上下文(例如GLFW+OpenGL)
|
||||
glfwInit(); |
||||
GLFWwindow *window = glfwCreateWindow(1280, 720, "ImGui Demo", NULL, NULL); |
||||
|
||||
// 加载配置
|
||||
drogon::app().loadConfigFile("./config.json"); |
||||
// 初始化ImGui
|
||||
ImGui::CreateContext(); |
||||
ImGui_ImplGlfw_InitForOpenGL(window, true); |
||||
ImGui_ImplOpenGL3_Init("#version 130"); |
||||
|
||||
// 启动服务
|
||||
drogon::app().run(); |
||||
} |
||||
catch (const std::exception &e) |
||||
while (!glfwWindowShouldClose(window)) |
||||
{ |
||||
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 @@
@@ -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