Bläddra i källkod

Updated imgui. Can now display linked lib versions.

Thomas Buck 9 år sedan
förälder
incheckning
d22e17b95c

+ 4
- 0
ChangeLog.md Visa fil

@@ -2,6 +2,10 @@
2 2
 
3 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 9
     [ 20140313 ]
6 10
     * Renderer now limits room list size
7 11
     * Updated Doxyfile template to current Doxygen version

+ 3
- 0
include/system/Shader.h Visa fil

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

+ 4
- 0
include/system/Sound.h Visa fil

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

+ 3
- 0
include/system/SoundAL.h Visa fil

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

+ 3
- 0
include/system/Window.h Visa fil

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

+ 3
- 0
include/system/WindowGLFW.h Visa fil

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

+ 3
- 0
include/system/WindowSDL.h Visa fil

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

+ 20
- 2
src/UI.cpp Visa fil

@@ -18,6 +18,7 @@
18 18
 #include "SoundManager.h"
19 19
 #include "TextureManager.h"
20 20
 #include "World.h"
21
+#include "system/Sound.h"
21 22
 #include "system/Window.h"
22 23
 #include "utils/time.h"
23 24
 #include "UI.h"
@@ -138,7 +139,7 @@ int UI::initialize() {
138 139
     style.ItemSpacing                           = ImVec2(2, 2);
139 140
     style.ItemInnerSpacing                      = ImVec2(1, 1);
140 141
     style.TouchExtraPadding                     = ImVec2(0, 0);
141
-    style.TreeNodeSpacing                       = 3;
142
+    style.IndentSpacing                       = 3;
142 143
     style.ScrollbarWidth                        = 10;
143 144
 
144 145
     return 0;
@@ -230,7 +231,7 @@ void UI::display() {
230 231
 
231 232
             auto window = ImGui::GetWindowSize();
232 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 236
         ImGui::End();
236 237
     }
@@ -254,6 +255,22 @@ void UI::display() {
254 255
         TextureManager::display();
255 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 274
         if (ImGui::CollapsingHeader("ImGui/Debug UI Help")) {
258 275
             ImGui::ShowUserGuide();
259 276
             ImGui::Separator();
@@ -357,6 +374,7 @@ void UI::handleKeyboard(KeyboardButton key, bool pressed) {
357 374
     io.KeysDown[key] = pressed;
358 375
     io.KeyCtrl = io.KeysDown[leftctrlKey] | io.KeysDown[rightctrlKey];
359 376
     io.KeyShift = io.KeysDown[leftshiftKey] | io.KeysDown[rightshiftKey];
377
+    io.KeyAlt = io.KeysDown[leftaltKey] | io.KeysDown[rightaltKey];
360 378
 
361 379
     keyboardEvents.push_back(std::make_tuple(key, pressed));
362 380
 

+ 1037
- 474
src/deps/imgui/imgui.cpp
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 41
- 17
src/deps/imgui/imgui.h Visa fil

@@ -1,4 +1,4 @@
1
-// ImGui library v1.35
1
+// ImGui library v1.37 WIP
2 2
 // See .cpp file for documentation.
3 3
 // See ImGui::ShowTestWindow() for sample code.
4 4
 // Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
@@ -13,6 +13,8 @@
13 13
 #include <stdlib.h>         // NULL, malloc
14 14
 #include <string.h>         // memset, memmove
15 15
 
16
+#define IMGUI_VERSION       "1.37 WIP"
17
+
16 18
 // Define assertion handler.
17 19
 #ifndef IM_ASSERT
18 20
 #include <assert.h>
@@ -164,7 +166,6 @@ namespace ImGui
164 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 167
     IMGUI_API bool          BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                    // "
166 168
     IMGUI_API void          EndChild();
167
-    IMGUI_API bool          GetWindowIsFocused();
168 169
     IMGUI_API ImVec2        GetContentRegionMax();                                              // window or current column boundaries, in windows coordinates
169 170
     IMGUI_API ImVec2        GetWindowContentRegionMin();                                        // window boundaries, in windows coordinates
170 171
     IMGUI_API ImVec2        GetWindowContentRegionMax();
@@ -222,9 +223,13 @@ namespace ImGui
222 223
     IMGUI_API void          EndTooltip();
223 224
 
224 225
     // Layout
226
+    IMGUI_API void          BeginGroup();
227
+    IMGUI_API void          EndGroup();
225 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 233
     IMGUI_API void          Columns(int count = 1, const char* id = NULL, bool border=true);    // setup number of columns
229 234
     IMGUI_API void          NextColumn();                                                       // next column
230 235
     IMGUI_API int           GetColumnIndex();                                                   // get current column index
@@ -282,6 +287,8 @@ namespace ImGui
282 287
     IMGUI_API bool          SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
283 288
     IMGUI_API bool          SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
284 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 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 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 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,6 +303,9 @@ namespace ImGui
296 303
     IMGUI_API bool          InputFloat3(const char* label, float v[3], int decimal_precision = -1);
297 304
     IMGUI_API bool          InputFloat4(const char* label, float v[4], int decimal_precision = -1);
298 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 309
     IMGUI_API bool          Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
300 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 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,22 +352,29 @@ namespace ImGui
342 352
 
343 353
     // Utilities
344 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 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 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 365
     IMGUI_API bool          IsClipped(const ImVec2& item_size);                                 // to perform coarse clipping on user's side (as an optimization)
350 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 367
     IMGUI_API bool          IsMouseClicked(int button, bool repeat = false);
352 368
     IMGUI_API bool          IsMouseDoubleClicked(int button);
353 369
     IMGUI_API bool          IsMouseHoveringWindow();                                            // is mouse hovering current window ("window" in API names always refer to current window)
354 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 372
     IMGUI_API bool          IsPosHoveringAnyWindow(const ImVec2& pos);                          // is given position hovering any active imgui window
357 373
     IMGUI_API ImVec2        GetMousePos();                                                      // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
358 374
     IMGUI_API float         GetTime();
359 375
     IMGUI_API int           GetFrameCount();
360 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 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 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,13 +386,18 @@ namespace ImGui
369 386
     IMGUI_API void          ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
370 387
 
371 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 390
     IMGUI_API void*         GetInternalState();
373 391
     IMGUI_API size_t        GetInternalStateSize();
374 392
     IMGUI_API void          SetInternalState(void* state, bool construct = false);
375 393
 
376 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 402
 } // namespace ImGui
381 403
 
@@ -496,7 +518,8 @@ enum ImGuiStyleVar_
496 518
     ImGuiStyleVar_FrameRounding,       // float
497 519
     ImGuiStyleVar_ItemSpacing,         // ImVec2
498 520
     ImGuiStyleVar_ItemInnerSpacing,    // ImVec2
499
-    ImGuiStyleVar_TreeNodeSpacing      // float
521
+    ImGuiStyleVar_IndentSpacing,       // float
522
+    ImGuiStyleVar_GrabMinSize          // float
500 523
 };
501 524
 
502 525
 // Enumeration for ColorEditMode()
@@ -529,10 +552,10 @@ struct ImGuiStyle
529 552
     float       FrameRounding;              // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
530 553
     ImVec2      ItemSpacing;                // Horizontal and vertical spacing between widgets/lines
531 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 556
     ImVec2      AutoFitPadding;             // Extra space after auto-fit (double-clicking on resize grip)
534 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 559
     float       ColumnsMinSpacing;          // Minimum horizontal spacing between two columns
537 560
     float       ScrollbarWidth;             // Width of the vertical scrollbar
538 561
     float       GrabMinSize;                // Minimum width/height of a slider or scrollbar grab
@@ -598,6 +621,7 @@ struct ImGuiIO
598 621
     bool        MouseDrawCursor;            // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
599 622
     bool        KeyCtrl;                    // Keyboard modifier pressed: Control
600 623
     bool        KeyShift;                   // Keyboard modifier pressed: Shift
624
+    bool        KeyAlt;                     // Keyboard modifier pressed: Alt
601 625
     bool        KeysDown[512];              // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
602 626
     ImWchar     InputCharacters[16+1];      // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
603 627
 
@@ -686,7 +710,6 @@ struct ImGuiTextBuffer
686 710
     ImVector<char>      Buf;
687 711
 
688 712
     ImGuiTextBuffer()   { Buf.push_back(0); }
689
-    ~ImGuiTextBuffer()  { }
690 713
     const char*         begin() const { return &Buf.front(); }
691 714
     const char*         end() const { return &Buf.back(); }      // Buf is zero-terminated, so end() will point on the zero-terminator
692 715
     size_t              size() const { return Buf.size()-1; }
@@ -839,19 +862,20 @@ struct ImDrawList
839 862
     ImDrawList() { Clear(); }
840 863
     IMGUI_API void  Clear();
841 864
     IMGUI_API void  PushClipRect(const ImVec4& clip_rect);          // Scissoring. The values are x1, y1, x2, y2.
865
+    IMGUI_API void  PushClipRectFullScreen();
842 866
     IMGUI_API void  PopClipRect();
843 867
     IMGUI_API void  PushTextureID(const ImTextureID& texture_id);
844 868
     IMGUI_API void  PopTextureID();
845 869
 
846 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 872
     IMGUI_API void  AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
849 873
     IMGUI_API void  AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
850 874
     IMGUI_API void  AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
851 875
     IMGUI_API void  AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
852 876
     IMGUI_API void  AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
853 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 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 881
     // Advanced
@@ -862,7 +886,7 @@ struct ImDrawList
862 886
     IMGUI_API void  ReserveVertices(unsigned int vtx_count);
863 887
     IMGUI_API void  AddVtx(const ImVec2& pos, ImU32 col);
864 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 890
     IMGUI_API void  UpdateClipRect();
867 891
     IMGUI_API void  UpdateTextureID();
868 892
 };
@@ -895,7 +919,7 @@ struct ImFontAtlas
895 919
     IMGUI_API void              SetTexID(void* id)  { TexID = id; }
896 920
 
897 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 923
     IMGUI_API const ImWchar*    GetGlyphRangesDefault();    // Basic Latin, Extended Latin
900 924
     IMGUI_API const ImWchar*    GetGlyphRangesJapanese();   // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
901 925
     IMGUI_API const ImWchar*    GetGlyphRangesChinese();    // Japanese + full set of about 21000 CJK Unified Ideographs

+ 13
- 5
src/system/Shader.cpp Visa fil

@@ -5,6 +5,8 @@
5 5
  * \author xythobuz
6 6
  */
7 7
 
8
+#include <sstream>
9
+
8 10
 #include "global.h"
9 11
 #include "Log.h"
10 12
 #include "system/Window.h"
@@ -207,17 +209,23 @@ int Shader::compile(const char* vertex, const char* fragment) {
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 223
 Shader Shader::textShader;
211 224
 Shader Shader::textureShader;
212 225
 Shader Shader::colorShader;
213 226
 unsigned int Shader::vertexArrayID = 0;
214 227
 
215 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 229
     glGenVertexArrays(1, &vertexArrayID);
222 230
     glBindVertexArray(vertexArrayID);
223 231
 

+ 8
- 0
src/system/Sound.cpp Visa fil

@@ -124,3 +124,11 @@ float Sound::getVolume() {
124 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 Visa fil

@@ -13,6 +13,7 @@
13 13
 #endif
14 14
 
15 15
 #include <AL/alut.h>
16
+#include <sstream>
16 17
 
17 18
 #include "global.h"
18 19
 #include "Log.h"
@@ -259,3 +260,15 @@ float SoundAL::getVolume() {
259 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 Visa fil

@@ -176,3 +176,15 @@ void Window::inputPositionCallback(int x, int y) {
176 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 Visa fil

@@ -5,6 +5,8 @@
5 5
  * \author xythobuz
6 6
  */
7 7
 
8
+#include <sstream>
9
+
8 10
 #define GLFW_INCLUDE_NONE
9 11
 #include <GLFW/glfw3.h>
10 12
 
@@ -126,6 +128,16 @@ const char* WindowGLFW::getClipboard() {
126 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 141
 void WindowGLFW::inputPositionCallback(int x, int y) {
130 142
 
131 143
 }

+ 22
- 0
src/system/WindowSDL.cpp Visa fil

@@ -5,6 +5,10 @@
5 5
  * \author xythobuz
6 6
  */
7 7
 
8
+#include <sstream>
9
+
10
+#include "SDL_revision.h"
11
+
8 12
 #include "global.h"
9 13
 #include "Log.h"
10 14
 #include "RunTime.h"
@@ -584,3 +588,21 @@ void WindowSDL::inputPositionCallback(int x, int y) {
584 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
+

Laddar…
Avbryt
Spara