deadcell-framework README

项目的 README,来自 github.com/current/deadcell-framework。合并为一个 markdown 文件:README.md。

deadcell menu

imgui foundation for the deadcell menu. this is a pinned snapshot of dear imgui (1.89.5-wip) — everything the menu draws, from the window frames down to the sliders and tabs, goes through this code and out the back into dx11.

the tree is vendored on purpose, not pulled as a submodule:

what's in here

imgui.cpp             core — context, windows, id stack, input, layout
imgui.h               public api
imgui_internal.h      internal api, the one custom widgets actually need
imgui_draw.cpp        vertex buffers, font atlas, antialiased primitives
imgui_widgets.cpp     sliders, combos, trees, tabs, all the stock widgets
imgui_tables.cpp      table api
imgui_demo.cpp        live sample of every widget, with source. read it.
imconfig.h            compile-time toggles
backends/             platform + renderer backends (see below)
misc/                 fonts, freetype, std::string helpers, .natvis files
docs/                 upstream docs — faq and BACKENDS.md are the good ones
CMakeLists.txt        builds imgui as a static lib

how it works

imgui is immediate mode. there's no widget tree and no per-widget state hanging around between frames — you call NewFrame(), issue your widget calls, call Render(), and out comes a vertex/index buffer a backend shoves into the gpu. every frame. that's the whole trick, and it's why dynamic uis (quick-loading configs, iterating over a vector of features) are one-liners instead of bookkeeping.

widget identity comes from labels plus whatever's on the id stack, so two InputInt calls in a loop don't collide as long as you push an id per item. mostly you never think about it. sometimes you do, and that's what imgui_internal.h is for.

file does
imgui.cpp windows, id stack, input routing, layout
imgui_draw.cpp draw lists, font atlas rasterization
imgui_widgets.cpp stock widgets, built on the core
imgui_tables.cpp tables — scroll, sort, freeze, resize
imgui_internal.h internals: custom widgets, theming hooks

backends

two kinds, mix and match:

win32 + dx11 is the pair that actually gets exercised. everything else in backends/ (dx9/10/12, opengl, vulkan, sdl2/sdl3, glfw, metal...) is vendored as-is for reference — fine to compile against, just not battle-tested on this snapshot.

both primaries compile straight into the imgui static target, and the dx11 side links d3d11/dxgi/dwmapi on its own when building on windows.

building

cmake >= 3.16, c++17 compiler:

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

wiring it up

once you've got a device and a window:

ImGui::CreateContext();
ImGui_ImplWin32_Init(hwnd);
ImGui_ImplDX11_Init(device, device_context);

// frame loop
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();

ImGui::Begin("deadcell");
// menu contents
ImGui::End();

ImGui::Render();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());

that's it. no scene graph, no callbacks to register.

versions

snapshot tracks 1.89.5-wip (pre-1.89.5 master). when moving up a version: diff the core sources against the upstream tag and re-verify the win32/dx11 path first — everything else is untested anyway.

license

mit, © omar cornut — see LICENSE. this is an unmodified snapshot of upstream; the menu itself lives in downstream code.

deadcell-framework (current/deadcell-framework)

正在搜索数据库…

这是什么?这是一份固定版本、以 vendor 方式内置的 Dear ImGui(1.89.5-wip)快照,作为「deadcell」菜单的渲染基础,负责绘制从窗口框架到滑块等所有界面元素,并包含 DirectX11 后端。
这是完整的应用程序,还是只有渲染代码?这是一个 C++ 即时模式 GUI 库/框架,需要编译进你自己的项目(生成一个静态 ImGui 目标)。这里没有附带任何菜单界面,只有 vendor 进来的渲染内部代码以及 win32 和 dx11 后端。
我该如何构建并把它接入我的项目?使用 CMake 3.16+ 和 C++17 编译器进行构建。然后在你创建好 DirectX11 设备和窗口之后,每一帧依次调用 NewFrame()、调用你的控件函数,最后调用 Render(),无需注册场景图或回调。
它在平台层面需要什么?需要一个 Win32 窗口和一个 DirectX11 设备;在 Windows 上,构建过程会自动链接 d3d11、dxgi 和 dwmapi。
所有包含的后端稳定性都一样吗?不一样。实际经过测试的只有 win32 平台后端搭配 dx11 渲染器;backends/ 目录下的其他后端(dx9/10/12、opengl、vulkan、sdl2/sdl3、glfw、metal)虽然可以编译,但在这个快照中未经测试。
关于许可证有什么需要注意的吗?采用 MIT 许可证,署名为 Omar Cornut,是未经修改的上游快照。真正使用该框架的 deadcell 菜单代码单独存放在下游。
为什么要以 vendor 方式引入 ImGui,而不是用 submodule?vendor 方式可以让构建不受上游变更影响,让自定义控件能够安全地依赖经常变动的 imguiinternal.h,并且可以有选择地挑选上游修复,而不是整体照单全收。
这个 ImGui 基于哪个版本?它跟踪的是 1.89.5-wip,即 master 分支中 1.89.5 之前的一个快照。
除了 DirectX11,我能使用其他渲染后端吗?仓库内置了 dx9/10/12、OpenGL、Vulkan、SDL2/SDL3、GLFW 和 Metal 后端供参考,但在本快照中只有 win32+dx11 这一组经过了充分实战检验。
imguiinternal.h 是做什么用的?它公开了自定义控件和主题钩子所需的 ImGui 内部接口,这些内容不属于公开 API。这里将其固定版本,以确保这些内部接口不会意外变动。
作者
current
大小
1.2 MB
星标
522
更新
提交Feb 02
时长
2年
提交 · 90 天