瀏覽代碼

Updated imgui. Can now display linked lib versions.

Thomas Buck 9 年之前
父節點
當前提交
d22e17b95c

+ 4
- 0
ChangeLog.md 查看文件

2
 
2
 
3
 ## OpenRaider (0.1.4) xythobuz <xythobuz@xythobuz.de>
3
 ## OpenRaider (0.1.4) xythobuz <xythobuz@xythobuz.de>
4
 
4
 
5
+    [ 20140318 ]
6
+    * Updated imgui to version 1.36
7
+    * Can now display all compiled/linked library versions
8
+
5
     [ 20140313 ]
9
     [ 20140313 ]
6
     * Renderer now limits room list size
10
     * Renderer now limits room list size
7
     * Updated Doxyfile template to current Doxygen version
11
     * Updated Doxyfile template to current Doxygen version

+ 3
- 0
include/system/Shader.h 查看文件

8
 #ifndef _SHADER_H_
8
 #ifndef _SHADER_H_
9
 #define _SHADER_H_
9
 #define _SHADER_H_
10
 
10
 
11
+#include <string>
11
 #include <vector>
12
 #include <vector>
12
 
13
 
13
 #include "TextureManager.h"
14
 #include "TextureManager.h"
91
                        glm::mat4 MVP, GLenum mode = GL_TRIANGLES, ShaderTexture* target = nullptr,
92
                        glm::mat4 MVP, GLenum mode = GL_TRIANGLES, ShaderTexture* target = nullptr,
92
                        Shader& shader = colorShader);
93
                        Shader& shader = colorShader);
93
 
94
 
95
+    static std::string getVersion(bool linked);
96
+
94
   private:
97
   private:
95
     int programID;
98
     int programID;
96
     std::vector<unsigned int> uniforms;
99
     std::vector<unsigned int> uniforms;

+ 4
- 0
include/system/Sound.h 查看文件

8
 #ifndef _SOUND_H_
8
 #ifndef _SOUND_H_
9
 #define _SOUND_H_
9
 #define _SOUND_H_
10
 
10
 
11
+#include <string>
12
+
11
 class Sound {
13
 class Sound {
12
   public:
14
   public:
13
     static int initialize();
15
     static int initialize();
32
 
34
 
33
     static void setVolume(float vol = 1.0f);
35
     static void setVolume(float vol = 1.0f);
34
     static float getVolume();
36
     static float getVolume();
37
+
38
+    static std::string getVersion(bool linked);
35
 };
39
 };
36
 
40
 
37
 #endif
41
 #endif

+ 3
- 0
include/system/SoundAL.h 查看文件

8
 #ifndef _SOUND_AL_H_
8
 #ifndef _SOUND_AL_H_
9
 #define _SOUND_AL_H_
9
 #define _SOUND_AL_H_
10
 
10
 
11
+#include <string>
11
 #include <vector>
12
 #include <vector>
12
 
13
 
13
 class SoundAL {
14
 class SoundAL {
35
     static void setVolume(float vol);
36
     static void setVolume(float vol);
36
     static float getVolume();
37
     static float getVolume();
37
 
38
 
39
+    static std::string getVersion(bool linked);
40
+
38
   private:
41
   private:
39
     static bool init;
42
     static bool init;
40
     static bool enabled;
43
     static bool enabled;

+ 3
- 0
include/system/Window.h 查看文件

8
 #ifndef _WINDOW_H_
8
 #ifndef _WINDOW_H_
9
 #define _WINDOW_H_
9
 #define _WINDOW_H_
10
 
10
 
11
+#include <string>
11
 #include <glm/gtc/type_precision.hpp>
12
 #include <glm/gtc/type_precision.hpp>
12
 
13
 
13
 class Window {
14
 class Window {
33
     static const char* getClipboard();
34
     static const char* getClipboard();
34
 
35
 
35
     static void inputPositionCallback(int x, int y);
36
     static void inputPositionCallback(int x, int y);
37
+
38
+    static std::string getVersion(bool linked);
36
 };
39
 };
37
 
40
 
38
 #endif
41
 #endif

+ 3
- 0
include/system/WindowGLFW.h 查看文件

8
 #ifndef _WINDOW_GLFW_H_
8
 #ifndef _WINDOW_GLFW_H_
9
 #define _WINDOW_GLFW_H_
9
 #define _WINDOW_GLFW_H_
10
 
10
 
11
+#include <string>
11
 #include <glm/gtc/type_precision.hpp>
12
 #include <glm/gtc/type_precision.hpp>
12
 
13
 
13
 class GLFWwindow;
14
 class GLFWwindow;
36
 
37
 
37
     static void inputPositionCallback(int x, int y);
38
     static void inputPositionCallback(int x, int y);
38
 
39
 
40
+    static std::string getVersion(bool linked);
41
+
39
   private:
42
   private:
40
     static void errorCallback(int error, const char* desc);
43
     static void errorCallback(int error, const char* desc);
41
     static void sizeCallback(GLFWwindow* w, int width, int height);
44
     static void sizeCallback(GLFWwindow* w, int width, int height);

+ 3
- 0
include/system/WindowSDL.h 查看文件

8
 #ifndef _WINDOW_SDL_H_
8
 #ifndef _WINDOW_SDL_H_
9
 #define _WINDOW_SDL_H_
9
 #define _WINDOW_SDL_H_
10
 
10
 
11
+#include <string>
11
 #include <glm/gtc/type_precision.hpp>
12
 #include <glm/gtc/type_precision.hpp>
12
 
13
 
13
 #include "SDL.h"
14
 #include "SDL.h"
36
 
37
 
37
     static void inputPositionCallback(int x, int y);
38
     static void inputPositionCallback(int x, int y);
38
 
39
 
40
+    static std::string getVersion(bool linked);
41
+
39
   private:
42
   private:
40
     static glm::i32vec2 size;
43
     static glm::i32vec2 size;
41
     static bool fullscreen;
44
     static bool fullscreen;

+ 20
- 2
src/UI.cpp 查看文件

18
 #include "SoundManager.h"
18
 #include "SoundManager.h"
19
 #include "TextureManager.h"
19
 #include "TextureManager.h"
20
 #include "World.h"
20
 #include "World.h"
21
+#include "system/Sound.h"
21
 #include "system/Window.h"
22
 #include "system/Window.h"
22
 #include "utils/time.h"
23
 #include "utils/time.h"
23
 #include "UI.h"
24
 #include "UI.h"
138
     style.ItemSpacing                           = ImVec2(2, 2);
139
     style.ItemSpacing                           = ImVec2(2, 2);
139
     style.ItemInnerSpacing                      = ImVec2(1, 1);
140
     style.ItemInnerSpacing                      = ImVec2(1, 1);
140
     style.TouchExtraPadding                     = ImVec2(0, 0);
141
     style.TouchExtraPadding                     = ImVec2(0, 0);
141
-    style.TreeNodeSpacing                       = 3;
142
+    style.IndentSpacing                       = 3;
142
     style.ScrollbarWidth                        = 10;
143
     style.ScrollbarWidth                        = 10;
143
 
144
 
144
     return 0;
145
     return 0;
230
 
231
 
231
             auto window = ImGui::GetWindowSize();
232
             auto window = ImGui::GetWindowSize();
232
             auto screen = Window::getSize();
233
             auto screen = Window::getSize();
233
-            ImGui::SetWindowPos(ImVec2(10, screen.y - window.y - 10));
234
+            //ImGui::SetWindowPos(ImVec2(10, screen.y - window.y - 10));
234
         }
235
         }
235
         ImGui::End();
236
         ImGui::End();
236
     }
237
     }
254
         TextureManager::display();
255
         TextureManager::display();
255
         SoundManager::display();
256
         SoundManager::display();
256
 
257
 
258
+        if (ImGui::CollapsingHeader("Library Versions")) {
259
+            ImGui::TextWrapped("%s", VERSION);
260
+            ImGui::Separator();
261
+            ImGui::TextWrapped("ImGui v%s", IMGUI_VERSION);
262
+            ImGui::TextWrapped("%s", Window::getVersion(false).c_str());
263
+            ImGui::TextWrapped("%s", Shader::getVersion(false).c_str());
264
+            ImGui::TextWrapped("%s", Sound::getVersion(false).c_str());
265
+            ImGui::TextWrapped("GLM v%d.%d.%d", (GLM_VERSION / 100),
266
+                               ((GLM_VERSION % 100) / 10), (GLM_VERSION % 10));
267
+            ImGui::Separator();
268
+            ImGui::TextWrapped("ImGui v%s", ImGui::GetVersion());
269
+            ImGui::TextWrapped("%s", Window::getVersion(true).c_str());
270
+            ImGui::TextWrapped("%s", Shader::getVersion(true).c_str());
271
+            ImGui::TextWrapped("%s", Sound::getVersion(true).c_str());
272
+        }
273
+
257
         if (ImGui::CollapsingHeader("ImGui/Debug UI Help")) {
274
         if (ImGui::CollapsingHeader("ImGui/Debug UI Help")) {
258
             ImGui::ShowUserGuide();
275
             ImGui::ShowUserGuide();
259
             ImGui::Separator();
276
             ImGui::Separator();
357
     io.KeysDown[key] = pressed;
374
     io.KeysDown[key] = pressed;
358
     io.KeyCtrl = io.KeysDown[leftctrlKey] | io.KeysDown[rightctrlKey];
375
     io.KeyCtrl = io.KeysDown[leftctrlKey] | io.KeysDown[rightctrlKey];
359
     io.KeyShift = io.KeysDown[leftshiftKey] | io.KeysDown[rightshiftKey];
376
     io.KeyShift = io.KeysDown[leftshiftKey] | io.KeysDown[rightshiftKey];
377
+    io.KeyAlt = io.KeysDown[leftaltKey] | io.KeysDown[rightaltKey];
360
 
378
 
361
     keyboardEvents.push_back(std::make_tuple(key, pressed));
379
     keyboardEvents.push_back(std::make_tuple(key, pressed));
362
 
380
 

+ 1037
- 474
src/deps/imgui/imgui.cpp
文件差異過大導致無法顯示
查看文件


+ 41
- 17
src/deps/imgui/imgui.h 查看文件

1
-// ImGui library v1.35
1
+// ImGui library v1.37 WIP
2
 // See .cpp file for documentation.
2
 // See .cpp file for documentation.
3
 // See ImGui::ShowTestWindow() for sample code.
3
 // See ImGui::ShowTestWindow() for sample code.
4
 // Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
4
 // Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
13
 #include <stdlib.h>         // NULL, malloc
13
 #include <stdlib.h>         // NULL, malloc
14
 #include <string.h>         // memset, memmove
14
 #include <string.h>         // memset, memmove
15
 
15
 
16
+#define IMGUI_VERSION       "1.37 WIP"
17
+
16
 // Define assertion handler.
18
 // Define assertion handler.
17
 #ifndef IM_ASSERT
19
 #ifndef IM_ASSERT
18
 #include <assert.h>
20
 #include <assert.h>
164
     IMGUI_API bool          BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);            // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
166
     IMGUI_API bool          BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);            // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
165
     IMGUI_API bool          BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                    // "
167
     IMGUI_API bool          BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                    // "
166
     IMGUI_API void          EndChild();
168
     IMGUI_API void          EndChild();
167
-    IMGUI_API bool          GetWindowIsFocused();
168
     IMGUI_API ImVec2        GetContentRegionMax();                                              // window or current column boundaries, in windows coordinates
169
     IMGUI_API ImVec2        GetContentRegionMax();                                              // window or current column boundaries, in windows coordinates
169
     IMGUI_API ImVec2        GetWindowContentRegionMin();                                        // window boundaries, in windows coordinates
170
     IMGUI_API ImVec2        GetWindowContentRegionMin();                                        // window boundaries, in windows coordinates
170
     IMGUI_API ImVec2        GetWindowContentRegionMax();
171
     IMGUI_API ImVec2        GetWindowContentRegionMax();
222
     IMGUI_API void          EndTooltip();
223
     IMGUI_API void          EndTooltip();
223
 
224
 
224
     // Layout
225
     // Layout
226
+    IMGUI_API void          BeginGroup();
227
+    IMGUI_API void          EndGroup();
225
     IMGUI_API void          Separator();                                                        // horizontal line
228
     IMGUI_API void          Separator();                                                        // horizontal line
226
-    IMGUI_API void          SameLine(int column_x = 0, int spacing_w = -1);                     // call between widgets to layout them horizontally
227
-    IMGUI_API void          Spacing();
229
+    IMGUI_API void          SameLine(int column_x = 0, int spacing_w = -1);                     // call between widgets or groups to layout them horizontally
230
+    IMGUI_API void          Spacing();                                                          // add vertical spacing
231
+    IMGUI_API void          Indent();                                                           // move content position toward the right by style.IndentSpacing pixels
232
+    IMGUI_API void          Unindent();                                                         // move content position back to the left (cancel Indent)
228
     IMGUI_API void          Columns(int count = 1, const char* id = NULL, bool border=true);    // setup number of columns
233
     IMGUI_API void          Columns(int count = 1, const char* id = NULL, bool border=true);    // setup number of columns
229
     IMGUI_API void          NextColumn();                                                       // next column
234
     IMGUI_API void          NextColumn();                                                       // next column
230
     IMGUI_API int           GetColumnIndex();                                                   // get current column index
235
     IMGUI_API int           GetColumnIndex();                                                   // get current column index
282
     IMGUI_API bool          SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
287
     IMGUI_API bool          SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
283
     IMGUI_API bool          SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
288
     IMGUI_API bool          SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
284
     IMGUI_API bool          SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
289
     IMGUI_API bool          SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
290
+    IMGUI_API bool          VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
291
+    IMGUI_API bool          VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f");
285
     IMGUI_API void          PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
292
     IMGUI_API void          PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
286
     IMGUI_API void          PlotLines(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0));
293
     IMGUI_API void          PlotLines(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0));
287
     IMGUI_API void          PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
294
     IMGUI_API void          PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
296
     IMGUI_API bool          InputFloat3(const char* label, float v[3], int decimal_precision = -1);
303
     IMGUI_API bool          InputFloat3(const char* label, float v[3], int decimal_precision = -1);
297
     IMGUI_API bool          InputFloat4(const char* label, float v[4], int decimal_precision = -1);
304
     IMGUI_API bool          InputFloat4(const char* label, float v[4], int decimal_precision = -1);
298
     IMGUI_API bool          InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
305
     IMGUI_API bool          InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
306
+    IMGUI_API bool          InputInt2(const char* label, int v[2]);
307
+    IMGUI_API bool          InputInt3(const char* label, int v[3]);
308
+    IMGUI_API bool          InputInt4(const char* label, int v[4]);
299
     IMGUI_API bool          Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
309
     IMGUI_API bool          Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
300
     IMGUI_API bool          Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1);      // separate items with \0, end item-list with \0\0
310
     IMGUI_API bool          Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1);      // separate items with \0, end item-list with \0\0
301
     IMGUI_API bool          Combo(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
311
     IMGUI_API bool          Combo(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
342
 
352
 
343
     // Utilities
353
     // Utilities
344
     IMGUI_API bool          IsItemHovered();                                                    // was the last item hovered by mouse?
354
     IMGUI_API bool          IsItemHovered();                                                    // was the last item hovered by mouse?
355
+    IMGUI_API bool          IsItemHoveredRectOnly();                                            // was the last item hovered by mouse? even if another item is active while we are hovering this.
345
     IMGUI_API bool          IsItemActive();                                                     // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
356
     IMGUI_API bool          IsItemActive();                                                     // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
346
     IMGUI_API bool          IsAnyItemActive();                                                  // 
357
     IMGUI_API bool          IsAnyItemActive();                                                  // 
347
-    IMGUI_API ImVec2        GetItemBoxMin();                                                    // get bounding box of last item
348
-    IMGUI_API ImVec2        GetItemBoxMax();                                                    // get bounding box of last item
358
+    IMGUI_API ImVec2        GetItemActiveDragDelta();                                           // mouse delta from the time the item first got active
359
+    IMGUI_API ImVec2        GetItemRectMin();                                                   // get bounding rect of last item
360
+    IMGUI_API ImVec2        GetItemRectMax();                                                   // "
361
+    IMGUI_API ImVec2        GetItemRectSize();                                                  // "
362
+    IMGUI_API bool          IsWindowFocused();                                                  // is current window focused (differentiate child windows from each others)
363
+    IMGUI_API bool          IsRootWindowFocused();                                              // is current root window focused
364
+    IMGUI_API bool          IsRootWindowOrAnyChildFocused();                                    // is current root window or any of its child (including current window) focused
349
     IMGUI_API bool          IsClipped(const ImVec2& item_size);                                 // to perform coarse clipping on user's side (as an optimization)
365
     IMGUI_API bool          IsClipped(const ImVec2& item_size);                                 // to perform coarse clipping on user's side (as an optimization)
350
     IMGUI_API bool          IsKeyPressed(int key_index, bool repeat = true);                    // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry
366
     IMGUI_API bool          IsKeyPressed(int key_index, bool repeat = true);                    // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry
351
     IMGUI_API bool          IsMouseClicked(int button, bool repeat = false);
367
     IMGUI_API bool          IsMouseClicked(int button, bool repeat = false);
352
     IMGUI_API bool          IsMouseDoubleClicked(int button);
368
     IMGUI_API bool          IsMouseDoubleClicked(int button);
353
     IMGUI_API bool          IsMouseHoveringWindow();                                            // is mouse hovering current window ("window" in API names always refer to current window)
369
     IMGUI_API bool          IsMouseHoveringWindow();                                            // is mouse hovering current window ("window" in API names always refer to current window)
354
     IMGUI_API bool          IsMouseHoveringAnyWindow();                                         // is mouse hovering any active imgui window
370
     IMGUI_API bool          IsMouseHoveringAnyWindow();                                         // is mouse hovering any active imgui window
355
-    IMGUI_API bool          IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max);   // is mouse hovering given bounding box
371
+    IMGUI_API bool          IsMouseHoveringRect(const ImVec2& rect_min, const ImVec2& rect_max);// is mouse hovering given bounding rect
356
     IMGUI_API bool          IsPosHoveringAnyWindow(const ImVec2& pos);                          // is given position hovering any active imgui window
372
     IMGUI_API bool          IsPosHoveringAnyWindow(const ImVec2& pos);                          // is given position hovering any active imgui window
357
     IMGUI_API ImVec2        GetMousePos();                                                      // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
373
     IMGUI_API ImVec2        GetMousePos();                                                      // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
358
     IMGUI_API float         GetTime();
374
     IMGUI_API float         GetTime();
359
     IMGUI_API int           GetFrameCount();
375
     IMGUI_API int           GetFrameCount();
360
     IMGUI_API const char*   GetStyleColName(ImGuiCol idx);
376
     IMGUI_API const char*   GetStyleColName(ImGuiCol idx);
377
+    IMGUI_API ImVec2        CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f);   // utility to find the closest point the last item bounding rectangle edge. useful to visually link items.
361
     IMGUI_API ImVec2        CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
378
     IMGUI_API ImVec2        CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
362
     IMGUI_API void          CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end);    // helper to manually clip large list of items. see comments in implementation.
379
     IMGUI_API void          CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end);    // helper to manually clip large list of items. see comments in implementation.
363
 
380
 
369
     IMGUI_API void          ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
386
     IMGUI_API void          ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
370
 
387
 
371
     // Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself
388
     // Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself
389
+    IMGUI_API const char*   GetVersion();
372
     IMGUI_API void*         GetInternalState();
390
     IMGUI_API void*         GetInternalState();
373
     IMGUI_API size_t        GetInternalStateSize();
391
     IMGUI_API size_t        GetInternalStateSize();
374
     IMGUI_API void          SetInternalState(void* state, bool construct = false);
392
     IMGUI_API void          SetInternalState(void* state, bool construct = false);
375
 
393
 
376
     // Obsolete (will be removed)
394
     // Obsolete (will be removed)
377
-    IMGUI_API void          GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
378
-    static inline void      OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); }
395
+    IMGUI_API void          GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);   // OBSOLETE
396
+    static inline void      OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); }  // OBSOLETE
397
+    static inline bool      GetWindowIsFocused() { return ImGui::IsWindowFocused(); }   // OBSOLETE
398
+    static inline ImVec2    GetItemBoxMin() { return GetItemRectMin(); }    // OBSOLETE
399
+    static inline ImVec2    GetItemBoxMax() { return GetItemRectMax(); }    // OBSOLETE
400
+    static inline bool      IsMouseHoveringBox(const ImVec2& rect_min, const ImVec2& rect_max) { return IsMouseHoveringRect(rect_min, rect_max); }  // OBSOLETE
379
 
401
 
380
 } // namespace ImGui
402
 } // namespace ImGui
381
 
403
 
496
     ImGuiStyleVar_FrameRounding,       // float
518
     ImGuiStyleVar_FrameRounding,       // float
497
     ImGuiStyleVar_ItemSpacing,         // ImVec2
519
     ImGuiStyleVar_ItemSpacing,         // ImVec2
498
     ImGuiStyleVar_ItemInnerSpacing,    // ImVec2
520
     ImGuiStyleVar_ItemInnerSpacing,    // ImVec2
499
-    ImGuiStyleVar_TreeNodeSpacing      // float
521
+    ImGuiStyleVar_IndentSpacing,       // float
522
+    ImGuiStyleVar_GrabMinSize          // float
500
 };
523
 };
501
 
524
 
502
 // Enumeration for ColorEditMode()
525
 // Enumeration for ColorEditMode()
529
     float       FrameRounding;              // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
552
     float       FrameRounding;              // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
530
     ImVec2      ItemSpacing;                // Horizontal and vertical spacing between widgets/lines
553
     ImVec2      ItemSpacing;                // Horizontal and vertical spacing between widgets/lines
531
     ImVec2      ItemInnerSpacing;           // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
554
     ImVec2      ItemInnerSpacing;           // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
532
-    ImVec2      TouchExtraPadding;          // Expand bounding box for touch-based system where touch position is not accurate enough (unnecessary for mouse inputs). Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget running. So dont grow this too much!
555
+    ImVec2      TouchExtraPadding;          // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
533
     ImVec2      AutoFitPadding;             // Extra space after auto-fit (double-clicking on resize grip)
556
     ImVec2      AutoFitPadding;             // Extra space after auto-fit (double-clicking on resize grip)
534
     float       WindowFillAlphaDefault;     // Default alpha of window background, if not specified in ImGui::Begin()
557
     float       WindowFillAlphaDefault;     // Default alpha of window background, if not specified in ImGui::Begin()
535
-    float       TreeNodeSpacing;            // Horizontal spacing when entering a tree node
558
+    float       IndentSpacing;              // Horizontal indentation when e.g. entering a tree node
536
     float       ColumnsMinSpacing;          // Minimum horizontal spacing between two columns
559
     float       ColumnsMinSpacing;          // Minimum horizontal spacing between two columns
537
     float       ScrollbarWidth;             // Width of the vertical scrollbar
560
     float       ScrollbarWidth;             // Width of the vertical scrollbar
538
     float       GrabMinSize;                // Minimum width/height of a slider or scrollbar grab
561
     float       GrabMinSize;                // Minimum width/height of a slider or scrollbar grab
598
     bool        MouseDrawCursor;            // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
621
     bool        MouseDrawCursor;            // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
599
     bool        KeyCtrl;                    // Keyboard modifier pressed: Control
622
     bool        KeyCtrl;                    // Keyboard modifier pressed: Control
600
     bool        KeyShift;                   // Keyboard modifier pressed: Shift
623
     bool        KeyShift;                   // Keyboard modifier pressed: Shift
624
+    bool        KeyAlt;                     // Keyboard modifier pressed: Alt
601
     bool        KeysDown[512];              // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
625
     bool        KeysDown[512];              // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
602
     ImWchar     InputCharacters[16+1];      // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
626
     ImWchar     InputCharacters[16+1];      // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
603
 
627
 
686
     ImVector<char>      Buf;
710
     ImVector<char>      Buf;
687
 
711
 
688
     ImGuiTextBuffer()   { Buf.push_back(0); }
712
     ImGuiTextBuffer()   { Buf.push_back(0); }
689
-    ~ImGuiTextBuffer()  { }
690
     const char*         begin() const { return &Buf.front(); }
713
     const char*         begin() const { return &Buf.front(); }
691
     const char*         end() const { return &Buf.back(); }      // Buf is zero-terminated, so end() will point on the zero-terminator
714
     const char*         end() const { return &Buf.back(); }      // Buf is zero-terminated, so end() will point on the zero-terminator
692
     size_t              size() const { return Buf.size()-1; }
715
     size_t              size() const { return Buf.size()-1; }
839
     ImDrawList() { Clear(); }
862
     ImDrawList() { Clear(); }
840
     IMGUI_API void  Clear();
863
     IMGUI_API void  Clear();
841
     IMGUI_API void  PushClipRect(const ImVec4& clip_rect);          // Scissoring. The values are x1, y1, x2, y2.
864
     IMGUI_API void  PushClipRect(const ImVec4& clip_rect);          // Scissoring. The values are x1, y1, x2, y2.
865
+    IMGUI_API void  PushClipRectFullScreen();
842
     IMGUI_API void  PopClipRect();
866
     IMGUI_API void  PopClipRect();
843
     IMGUI_API void  PushTextureID(const ImTextureID& texture_id);
867
     IMGUI_API void  PushTextureID(const ImTextureID& texture_id);
844
     IMGUI_API void  PopTextureID();
868
     IMGUI_API void  PopTextureID();
845
 
869
 
846
     // Primitives   
870
     // Primitives   
847
-    IMGUI_API void  AddLine(const ImVec2& a, const ImVec2& b, ImU32 col);
871
+    IMGUI_API void  AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float half_thickness = 0.50f);
848
     IMGUI_API void  AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
872
     IMGUI_API void  AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
849
     IMGUI_API void  AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
873
     IMGUI_API void  AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
850
     IMGUI_API void  AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
874
     IMGUI_API void  AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
851
     IMGUI_API void  AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
875
     IMGUI_API void  AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
852
     IMGUI_API void  AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
876
     IMGUI_API void  AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
853
     IMGUI_API void  AddArc(const ImVec2& center, float rad, ImU32 col, int a_min, int a_max, bool tris = false, const ImVec2& third_point_offset = ImVec2(0,0));
877
     IMGUI_API void  AddArc(const ImVec2& center, float rad, ImU32 col, int a_min, int a_max, bool tris = false, const ImVec2& third_point_offset = ImVec2(0,0));
854
-    IMGUI_API void  AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL);
878
+    IMGUI_API void  AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL);
855
     IMGUI_API void  AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col = 0xFFFFFFFF);
879
     IMGUI_API void  AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col = 0xFFFFFFFF);
856
 
880
 
857
     // Advanced
881
     // Advanced
862
     IMGUI_API void  ReserveVertices(unsigned int vtx_count);
886
     IMGUI_API void  ReserveVertices(unsigned int vtx_count);
863
     IMGUI_API void  AddVtx(const ImVec2& pos, ImU32 col);
887
     IMGUI_API void  AddVtx(const ImVec2& pos, ImU32 col);
864
     IMGUI_API void  AddVtxUV(const ImVec2& pos, ImU32 col, const ImVec2& uv);
888
     IMGUI_API void  AddVtxUV(const ImVec2& pos, ImU32 col, const ImVec2& uv);
865
-    IMGUI_API void  AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col);
889
+    IMGUI_API void  AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col, float half_thickness = 0.50f);
866
     IMGUI_API void  UpdateClipRect();
890
     IMGUI_API void  UpdateClipRect();
867
     IMGUI_API void  UpdateTextureID();
891
     IMGUI_API void  UpdateTextureID();
868
 };
892
 };
895
     IMGUI_API void              SetTexID(void* id)  { TexID = id; }
919
     IMGUI_API void              SetTexID(void* id)  { TexID = id; }
896
 
920
 
897
     // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list)
921
     // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list)
898
-    // (Those functions could be static, aren't so simple use case doesn't have to refer to the ImFontAtlas:: type ever if in their code)
922
+    // (Those functions could be static but aren't so most users don't have to refer to the ImFontAtlas:: name ever if in their code; just using io.Fonts->)
899
     IMGUI_API const ImWchar*    GetGlyphRangesDefault();    // Basic Latin, Extended Latin
923
     IMGUI_API const ImWchar*    GetGlyphRangesDefault();    // Basic Latin, Extended Latin
900
     IMGUI_API const ImWchar*    GetGlyphRangesJapanese();   // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
924
     IMGUI_API const ImWchar*    GetGlyphRangesJapanese();   // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
901
     IMGUI_API const ImWchar*    GetGlyphRangesChinese();    // Japanese + full set of about 21000 CJK Unified Ideographs
925
     IMGUI_API const ImWchar*    GetGlyphRangesChinese();    // Japanese + full set of about 21000 CJK Unified Ideographs

+ 13
- 5
src/system/Shader.cpp 查看文件

5
  * \author xythobuz
5
  * \author xythobuz
6
  */
6
  */
7
 
7
 
8
+#include <sstream>
9
+
8
 #include "global.h"
10
 #include "global.h"
9
 #include "Log.h"
11
 #include "Log.h"
10
 #include "system/Window.h"
12
 #include "system/Window.h"
207
 
209
 
208
 // ----------------------------------------------------------------------------
210
 // ----------------------------------------------------------------------------
209
 
211
 
212
+std::string Shader::getVersion(bool linked) {
213
+    std::ostringstream str;
214
+    if (!linked) {
215
+        str << "OpenGL v" << glGetString(GL_VERSION);
216
+    } else {
217
+        str << "OpenGL " << glGetString(GL_SHADING_LANGUAGE_VERSION) << " "
218
+            << glGetString(GL_RENDERER) << " (" << glGetString(GL_VENDOR) << ")";
219
+    }
220
+    return str.str();
221
+}
222
+
210
 Shader Shader::textShader;
223
 Shader Shader::textShader;
211
 Shader Shader::textureShader;
224
 Shader Shader::textureShader;
212
 Shader Shader::colorShader;
225
 Shader Shader::colorShader;
213
 unsigned int Shader::vertexArrayID = 0;
226
 unsigned int Shader::vertexArrayID = 0;
214
 
227
 
215
 int Shader::initialize() {
228
 int Shader::initialize() {
216
-    Log::get(LOG_DEBUG) << "GL Ven.: " << glGetString(GL_VENDOR) << Log::endl;
217
-    Log::get(LOG_DEBUG) << "GL Ren.: " << glGetString(GL_RENDERER) << Log::endl;
218
-    Log::get(LOG_DEBUG) << "GL Ver.: " << glGetString(GL_VERSION) << Log::endl;
219
-    Log::get(LOG_DEBUG) << "GLSL V.: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << Log::endl;
220
-
221
     glGenVertexArrays(1, &vertexArrayID);
229
     glGenVertexArrays(1, &vertexArrayID);
222
     glBindVertexArray(vertexArrayID);
230
     glBindVertexArray(vertexArrayID);
223
 
231
 

+ 8
- 0
src/system/Sound.cpp 查看文件

124
 #endif
124
 #endif
125
 }
125
 }
126
 
126
 
127
+std::string Sound::getVersion(bool linked) {
128
+#ifdef USING_AL
129
+    return SoundAL::getVersion(linked);
130
+#else
131
+    return "none";
132
+#endif
133
+}
134
+

+ 13
- 0
src/system/SoundAL.cpp 查看文件

13
 #endif
13
 #endif
14
 
14
 
15
 #include <AL/alut.h>
15
 #include <AL/alut.h>
16
+#include <sstream>
16
 
17
 
17
 #include "global.h"
18
 #include "global.h"
18
 #include "Log.h"
19
 #include "Log.h"
259
     return volume;
260
     return volume;
260
 }
261
 }
261
 
262
 
263
+std::string SoundAL::getVersion(bool linked) {
264
+    std::ostringstream str;
265
+    if (!linked) {
266
+        str << "OpenAL v" << alGetString(AL_VERSION) << "; ALUT v"
267
+            << ALUT_API_MAJOR_VERSION << "." << ALUT_API_MINOR_VERSION;
268
+    } else {
269
+        str << "OpenAL " << alGetString(AL_RENDERER) << " (" << alGetString(AL_VENDOR)
270
+            << "); ALUT v" << alutGetMajorVersion() << "." << alutGetMinorVersion();
271
+    }
272
+    return str.str();
273
+}
274
+

+ 12
- 0
src/system/Window.cpp 查看文件

176
 #endif
176
 #endif
177
 }
177
 }
178
 
178
 
179
+std::string Window::getVersion(bool linked) {
180
+    std::string ret;
181
+
182
+#ifdef USING_SDL
183
+    ret = WindowSDL::getVersion(linked);
184
+#elif defined(USING_GLFW)
185
+    ret = WindowGLFW::getVersion(linked);
186
+#endif
187
+
188
+    return ret;
189
+}
190
+

+ 12
- 0
src/system/WindowGLFW.cpp 查看文件

5
  * \author xythobuz
5
  * \author xythobuz
6
  */
6
  */
7
 
7
 
8
+#include <sstream>
9
+
8
 #define GLFW_INCLUDE_NONE
10
 #define GLFW_INCLUDE_NONE
9
 #include <GLFW/glfw3.h>
11
 #include <GLFW/glfw3.h>
10
 
12
 
126
     return nullptr;
128
     return nullptr;
127
 }
129
 }
128
 
130
 
131
+std::string WindowGLFW::getVersion(bool linked) {
132
+    if (linked) {
133
+        return std::string("GLFW v") + glfwGetVersionString();
134
+    } else {
135
+        std::ostringstream str;
136
+        str << "GLFW v" << GLFW_VERSION_MAJOR << "." << GLFW_VERSION_MINOR << "." << GLFW_VERSION_REVISION;
137
+        return str.str();
138
+    }
139
+}
140
+
129
 void WindowGLFW::inputPositionCallback(int x, int y) {
141
 void WindowGLFW::inputPositionCallback(int x, int y) {
130
 
142
 
131
 }
143
 }

+ 22
- 0
src/system/WindowSDL.cpp 查看文件

5
  * \author xythobuz
5
  * \author xythobuz
6
  */
6
  */
7
 
7
 
8
+#include <sstream>
9
+
10
+#include "SDL_revision.h"
11
+
8
 #include "global.h"
12
 #include "global.h"
9
 #include "Log.h"
13
 #include "Log.h"
10
 #include "RunTime.h"
14
 #include "RunTime.h"
584
     SDL_SetTextInputRect(&rect);
588
     SDL_SetTextInputRect(&rect);
585
 }
589
 }
586
 
590
 
591
+std::string WindowSDL::getVersion(bool linked) {
592
+    SDL_version vers;
593
+
594
+    if (linked) {
595
+        SDL_GetVersion(&vers);
596
+    } else {
597
+        SDL_VERSION(&vers);
598
+    }
599
+
600
+    std::ostringstream str;
601
+    str << "SDL2 v" << int(vers.major) << "." << int(vers.minor) << "." << int(vers.patch);
602
+    if (linked) {
603
+        return str.str() + " (" + SDL_GetRevision() + ")";
604
+    } else {
605
+        return str.str() + " (" + SDL_REVISION + ")";
606
+    }
607
+}
608
+

Loading…
取消
儲存