Initial dstalk project: core DLL + CLI + BearSSL TLS
- Core DLL: AI API client (DeepSeek/OpenAI compatible), HTTP(S) via Boost.Beast - BearSSL vendored as TLS backend (MIT license, replacing OpenSSL) - CLI frontend with ANSI colors, /help /model /file /save /load commands - WinHTTP alternative HTTP client for Windows - GPLv3 license with linking exception - Build: CMake + Ninja + Clang, dependencies via Conan2 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
15
dstalk-gui/CMakeLists.txt
Normal file
15
dstalk-gui/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
# ============================================================
|
||||
# dstalk-gui — 图形化前端 (SDL3)
|
||||
# ============================================================
|
||||
|
||||
find_package(SDL3 REQUIRED)
|
||||
|
||||
add_executable(dstalk-gui
|
||||
src/main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(dstalk-gui
|
||||
PRIVATE
|
||||
dstalk
|
||||
SDL3::SDL3
|
||||
)
|
||||
57
dstalk-gui/src/main.cpp
Normal file
57
dstalk-gui/src/main.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include "dstalk/dstalk_api.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (dstalk_init(nullptr) != 0) {
|
||||
std::fprintf(stderr, "[dstalk] 初始化失败\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||
std::fprintf(stderr, "[dstalk] SDL 初始化失败: %s\n", SDL_GetError());
|
||||
dstalk_destroy();
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Window* window = SDL_CreateWindow(
|
||||
"dstalk", 1024, 768, SDL_WINDOW_RESIZABLE);
|
||||
if (!window) {
|
||||
std::fprintf(stderr, "[dstalk] 窗口创建失败: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
dstalk_destroy();
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr);
|
||||
if (!renderer) {
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
dstalk_destroy();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* TODO: 主循环 — SDL 事件处理, UI 渲染, 调用 dstalk_chat */
|
||||
bool running = true;
|
||||
SDL_Event event;
|
||||
while (running) {
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_EVENT_QUIT) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
SDL_SetRenderDrawColor(renderer, 0x1E, 0x1E, 0x2E, 0xFF);
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
dstalk_destroy();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user