Przeglądaj źródła

Changed default imgui style, fixed FPS histogram

Thomas Buck 10 lat temu
rodzic
commit
1f05528ddd
4 zmienionych plików z 66 dodań i 9 usunięć
  1. 1
    0
      ChangeLog.md
  2. 1
    0
      data/Unix.in
  3. 7
    9
      src/RunTime.cpp
  4. 57
    0
      src/UI.cpp

+ 1
- 0
ChangeLog.md Wyświetl plik

@@ -4,6 +4,7 @@
4 4
 
5 5
     [ 20140109 ]
6 6
     * Display of Bounding Boxes can be individually toggled for Rooms/StaticMeshes
7
+    * Tightened imgui Style and changed colors to match the _OpenRaider-blue_
7 8
 
8 9
     [ 20140108 ]
9 10
     * FPS and Camera position now displayed in imgui Overlay

+ 1
- 0
data/Unix.in Wyświetl plik

@@ -22,6 +22,7 @@ set mouse_y    0.75
22 22
 
23 23
 bind menu     "escape"
24 24
 bind debug    'q'
25
+bind console  "backquote"
25 26
 bind forward  'w'
26 27
 bind backward 's'
27 28
 bind left     'a'

+ 7
- 9
src/RunTime.cpp Wyświetl plik

@@ -178,18 +178,16 @@ void RunTime::display() {
178 178
     if (ImGui::CollapsingHeader("Performance")) {
179 179
         ImGui::Text("Uptime: %lums", systemTimerGet());
180 180
         ImGui::Text("Frames per Second: %luFPS", fps);
181
-        if (history.size() > 1) {
181
+        int size = history.size() - 1;
182
+        if (size > 0) {
182 183
             static bool scroll = true;
183 184
             if (scroll) {
184
-                int offset = history.size() - 1;
185
-                if (offset > 10)
186
-                    offset = 10;
187
-                ImGui::PlotLines("FPS", &history[1],
188
-                                 history.size() - 1,
189
-                                 history.size() - offset - 1);
185
+                int start = 0;
186
+                if (size > 10)
187
+                    start = size - 11;
188
+                ImGui::PlotLines("FPS", &history[1 + start], size - start);
190 189
             } else {
191
-                ImGui::PlotLines("FPS", &history[1],
192
-                                 history.size() - 1);
190
+                ImGui::PlotLines("FPS", &history[1], size);
193 191
             }
194 192
             ImGui::SameLine();
195 193
             ImGui::Checkbox("Scroll##fpsscroll", &scroll);

+ 57
- 0
src/UI.cpp Wyświetl plik

@@ -95,6 +95,55 @@ int UI::initialize() {
95 95
 
96 96
     stbi_image_free(tex_data);
97 97
 
98
+    // Set up OpenRaider style
99
+    ImGuiStyle& style = ImGui::GetStyle();
100
+    style.Colors[ImGuiCol_Text]                 = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
101
+    style.Colors[ImGuiCol_WindowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
102
+    style.Colors[ImGuiCol_Border]               = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
103
+    style.Colors[ImGuiCol_BorderShadow]         = ImVec4(0.00f, 0.00f, 0.00f, 0.60f);
104
+    style.Colors[ImGuiCol_FrameBg]              = ImVec4(0.80f, 0.80f, 0.80f, 0.30f);
105
+    style.Colors[ImGuiCol_TitleBg]              = ImVec4(0.50f, 0.70f, 1.00f, 0.45f);
106
+    style.Colors[ImGuiCol_TitleBgCollapsed]     = ImVec4(0.40f, 0.65f, 1.00f, 0.20f);
107
+    style.Colors[ImGuiCol_ScrollbarBg]          = ImVec4(0.40f, 0.65f, 1.00f, 0.15f);
108
+    style.Colors[ImGuiCol_ScrollbarGrab]        = ImVec4(0.40f, 0.65f, 1.00f, 0.30f);
109
+    style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.65f, 1.00f, 0.40f);
110
+    style.Colors[ImGuiCol_ScrollbarGrabActive]  = ImVec4(1.00f, 0.16f, 0.16f, 0.40f);
111
+    style.Colors[ImGuiCol_ComboBg]              = ImVec4(0.20f, 0.20f, 0.20f, 0.99f);
112
+    style.Colors[ImGuiCol_CheckHovered]         = ImVec4(1.00f, 0.40f, 0.40f, 0.45f);
113
+    style.Colors[ImGuiCol_CheckActive]          = ImVec4(0.65f, 0.50f, 0.50f, 0.55f);
114
+    style.Colors[ImGuiCol_CheckMark]            = ImVec4(0.90f, 0.90f, 0.90f, 0.50f);
115
+    style.Colors[ImGuiCol_SliderGrab]           = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
116
+    style.Colors[ImGuiCol_SliderGrabActive]     = ImVec4(1.00f, 0.20f, 0.22f, 1.00f);
117
+    style.Colors[ImGuiCol_Button]               = ImVec4(1.00f, 0.20f, 0.20f, 0.60f);
118
+    style.Colors[ImGuiCol_ButtonHovered]        = ImVec4(1.00f, 0.20f, 0.18f, 1.00f);
119
+    style.Colors[ImGuiCol_ButtonActive]         = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
120
+    style.Colors[ImGuiCol_Header]               = ImVec4(0.21f, 0.54f, 1.00f, 0.45f);
121
+    style.Colors[ImGuiCol_HeaderHovered]        = ImVec4(0.22f, 0.56f, 1.00f, 0.80f);
122
+    style.Colors[ImGuiCol_HeaderActive]         = ImVec4(0.00f, 0.31f, 1.00f, 1.00f);
123
+    style.Colors[ImGuiCol_Column]               = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
124
+    style.Colors[ImGuiCol_ColumnHovered]        = ImVec4(0.60f, 0.40f, 0.40f, 1.00f);
125
+    style.Colors[ImGuiCol_ColumnActive]         = ImVec4(0.80f, 0.50f, 0.50f, 1.00f);
126
+    style.Colors[ImGuiCol_ResizeGrip]           = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
127
+    style.Colors[ImGuiCol_ResizeGripHovered]    = ImVec4(1.00f, 1.00f, 1.00f, 0.60f);
128
+    style.Colors[ImGuiCol_ResizeGripActive]     = ImVec4(1.00f, 1.00f, 1.00f, 0.90f);
129
+    style.Colors[ImGuiCol_CloseButton]          = ImVec4(0.21f, 0.56f, 1.00f, 0.50f);
130
+    style.Colors[ImGuiCol_CloseButtonHovered]   = ImVec4(0.21f, 0.32f, 1.00f, 0.60f);
131
+    style.Colors[ImGuiCol_CloseButtonActive]    = ImVec4(0.70f, 0.70f, 0.70f, 1.00f);
132
+    style.Colors[ImGuiCol_PlotLines]            = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
133
+    style.Colors[ImGuiCol_PlotLinesHovered]     = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
134
+    style.Colors[ImGuiCol_PlotHistogram]        = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
135
+    style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
136
+    style.Colors[ImGuiCol_TextSelectedBg]       = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
137
+    style.Colors[ImGuiCol_TooltipBg]            = ImVec4(0.05f, 0.05f, 0.10f, 0.90f);
138
+    style.WindowPadding                         = ImVec2(2, 2);
139
+    style.WindowRounding                        = 9;
140
+    style.FramePadding                          = ImVec2(2, 1);
141
+    style.ItemSpacing                           = ImVec2(2, 2);
142
+    style.ItemInnerSpacing                      = ImVec2(1, 1);
143
+    style.TouchExtraPadding                     = ImVec2(0, 0);
144
+    style.TreeNodeSpacing                       = 3;
145
+    style.ScrollBarWidth                        = 10;
146
+
98 147
     return 0;
99 148
 }
100 149
 
@@ -224,6 +273,7 @@ void UI::display() {
224 273
     }
225 274
 
226 275
     static bool showTestWindow = false;
276
+    static bool showStyleWindow = false;
227 277
     if (ImGui::Begin("Engine", &visible, ImVec2(400, 400))) {
228 278
         Render::displayUI();
229 279
         RunTime::display();
@@ -456,6 +506,10 @@ void UI::display() {
456 506
             if (ImGui::Button("Show/Hide Test Window")) {
457 507
                 showTestWindow = !showTestWindow;
458 508
             }
509
+            ImGui::SameLine();
510
+            if (ImGui::Button("Show/Hide Style Editor")) {
511
+                showStyleWindow = !showStyleWindow;
512
+            }
459 513
         }
460 514
     }
461 515
     ImGui::End();
@@ -463,6 +517,9 @@ void UI::display() {
463 517
     if (showTestWindow)
464 518
         ImGui::ShowTestWindow();
465 519
 
520
+    if (showStyleWindow)
521
+        ImGui::ShowStyleEditor();
522
+
466 523
     ImGui::Render();
467 524
 }
468 525
 

Ładowanie…
Anuluj
Zapisz