Imported ImNodes
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
#include "imgui_impl_win32.h"
|
||||
#include "imgui_impl_dx11.h"
|
||||
|
||||
// ImNodes相关
|
||||
#include "imnodes.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// Mingw 相关库
|
||||
@@ -87,6 +90,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
// 建立 Dear ImGui 上下文
|
||||
ImGui::CreateContext();
|
||||
|
||||
// 建立ImNodes 上下文
|
||||
ImNodes::CreateContext();
|
||||
|
||||
// 获取ImGui IO 设备配置结构体
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
@@ -220,6 +226,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
ImGui_ImplDX11_Shutdown(); // 关闭 ImGui DX11 组件
|
||||
ImGui_ImplWin32_Shutdown(); // 关闭 ImGui Win32 组件
|
||||
ImGui::DestroyContext(); // 销毁 ImGui 上下文
|
||||
ImNodes::DestroyContext(); // 销毁 ImNodes 上下文
|
||||
|
||||
CleanupDeviceD3D(); // 清理 Direct 3D 设备
|
||||
DestroyWindow(hwnd); // 销毁窗体
|
||||
|
||||
+23
-3
@@ -24,10 +24,30 @@ void UI_Layout()
|
||||
// 设置窗体相关属性,不允许停靠
|
||||
window_flags |= ImGuiWindowFlags_NoDocking;
|
||||
|
||||
ImGui::Begin("Main Panel", NULL, window_flags);
|
||||
ImGui::Begin("Main Panel", NULL, window_flags); // 创建Label
|
||||
ImGui::PopStyleVar(2); // 退出绘制风格栈中的设置项
|
||||
{
|
||||
// 退出绘制风格栈中的设置项
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
ImNodes::BeginNodeEditor();
|
||||
{
|
||||
|
||||
ImNodes::BeginNode(1);
|
||||
|
||||
ImNodes::BeginNodeTitleBar();
|
||||
ImGui::TextUnformatted("output node");
|
||||
ImNodes::EndNodeTitleBar();
|
||||
|
||||
ImGui::Text("Test Format %%d :%d", 123);
|
||||
|
||||
ImGui::Button("Click");
|
||||
|
||||
ImGui::SameLine();
|
||||
static bool check = false;
|
||||
ImGui::Checkbox("", &check);
|
||||
|
||||
ImNodes::EndNode();
|
||||
}
|
||||
ImNodes::EndNodeEditor();
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user