66// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
77// - Introduction, links and more at the top of imgui.cpp
88
9+ // Modified by RobertJN64 to add plot support and split render into its own file
10+
911#include " imgui.h"
12+ #include " implot.h"
1013#include " imgui_impl_win32.h"
1114#include " imgui_impl_dx11.h"
1215#include < d3d11.h>
@@ -28,7 +31,7 @@ void CleanupRenderTarget();
2831LRESULT WINAPI WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
2932
3033// Forward declaration of render loop (in ui.cpp)
31- void render_loop (ImGuiIO io );
34+ void render_loop ();
3235
3336// Main code
3437int main (int , char **) {
@@ -39,7 +42,7 @@ int main(int, char **) {
3942 // Create application window
4043 WNDCLASSEXW wc = {sizeof (wc), CS_CLASSDC, WndProc, 0L , 0L , GetModuleHandle (nullptr ), nullptr , nullptr , nullptr , nullptr , L" ImGui Example" , nullptr };
4144 ::RegisterClassExW (&wc);
42- HWND hwnd = ::CreateWindowW (wc.lpszClassName , L" Dear ImGui DirectX11 Example " , WS_OVERLAPPEDWINDOW, 100 , 100 , (int )(1280 * main_scale), (int )(800 * main_scale), nullptr , nullptr , wc.hInstance , nullptr );
45+ HWND hwnd = ::CreateWindowW (wc.lpszClassName , L" PSP Active Controls DAQ v0.1 " , WS_OVERLAPPEDWINDOW, 100 , 100 , (int )(1280 * main_scale), (int )(800 * main_scale), nullptr , nullptr , wc.hInstance , nullptr );
4346
4447 // Initialize Direct3D
4548 if (!CreateDeviceD3D (hwnd)) {
@@ -55,6 +58,7 @@ int main(int, char **) {
5558 // Setup Dear ImGui context
5659 IMGUI_CHECKVERSION ();
5760 ImGui::CreateContext ();
61+ ImPlot::CreateContext ();
5862 ImGuiIO &io = ImGui::GetIO ();
5963 (void )io;
6064 io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
@@ -69,6 +73,11 @@ int main(int, char **) {
6973 style.ScaleAllSizes (main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this requires resetting Style + calling this again)
7074 style.FontScaleDpi = main_scale; // Set initial font scale. (using io.ConfigDpiScaleFonts=true makes this unnecessary. We leave both here for documentation purpose)
7175
76+ ImPlotStyle &plotStyle = ImPlot::GetStyle ();
77+ plotStyle.PlotBorderSize = 1 .0f ; // thickness of border
78+ plotStyle.Colors [ImPlotCol_FrameBg] = ImVec4 (0 .1f , 0 .1f , 0 .1f , 1 .0f ); // Plot background
79+ plotStyle.Colors [ImPlotCol_PlotBorder] = ImVec4 (205 / 255.0 , 159 / 255.0 , 38 / 255.0 , 1 .0f ); // Plot border
80+
7281 // Setup Platform/Renderer backends
7382 ImGui_ImplWin32_Init (hwnd);
7483 ImGui_ImplDX11_Init (g_pd3dDevice, g_pd3dDeviceContext);
@@ -128,7 +137,7 @@ int main(int, char **) {
128137 ImGui_ImplDX11_NewFrame ();
129138 ImGui_ImplWin32_NewFrame ();
130139 ImGui::NewFrame ();
131- render_loop (io );
140+ render_loop ();
132141
133142 // Rendering
134143 ImGui::Render ();
@@ -146,6 +155,7 @@ int main(int, char **) {
146155 // Cleanup
147156 ImGui_ImplDX11_Shutdown ();
148157 ImGui_ImplWin32_Shutdown ();
158+ ImPlot::DestroyContext ();
149159 ImGui::DestroyContext ();
150160
151161 CleanupDeviceD3D ();
0 commit comments