mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 20:18:47 +02:00
Examples: Comments, synched some minor drift between examples + stronger suggestion to use StyleColorsDark().
This commit is contained in:
@ -77,6 +77,10 @@ int main(int, char**)
|
||||
// Setup ImGui binding
|
||||
ImGui_ImplDX9_Init(hwnd, g_pd3dDevice);
|
||||
|
||||
// Setup style
|
||||
ImGui::StyleColorsClassic();
|
||||
//ImGui::StyleColorsDark();
|
||||
|
||||
// Load Fonts
|
||||
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
||||
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
|
||||
@ -117,14 +121,16 @@ int main(int, char**)
|
||||
ImGui_ImplDX9_NewFrame();
|
||||
|
||||
// 1. Show a simple window.
|
||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug".
|
||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
||||
{
|
||||
static float f = 0.0f;
|
||||
ImGui::Text("Hello, world!");
|
||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
||||
ImGui::ColorEdit3("clear color", (float*)&clear_color);
|
||||
if (ImGui::Button("Demo Window")) show_demo_window ^= 1;
|
||||
if (ImGui::Button("Another Window")) show_another_window ^= 1;
|
||||
ImGui::Text("Hello, world!"); // Some text (you can use a format string too)
|
||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float as a slider from 0.0f to 1.0f
|
||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats as a color
|
||||
if (ImGui::Button("Demo Window")) // Use buttons to toggle our bools. We could use Checkbox() as well.
|
||||
show_demo_window ^= 1;
|
||||
if (ImGui::Button("Another Window"))
|
||||
show_another_window ^= 1;
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||
}
|
||||
|
||||
@ -139,7 +145,7 @@ int main(int, char**)
|
||||
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow().
|
||||
if (show_demo_window)
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
||||
ImGui::ShowDemoWindow(&show_demo_window);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user