Przeglądaj źródła

New imgui version, fix for Travis Mac workers.

Thomas Buck 9 lat temu
rodzic
commit
589649cb51

+ 1
- 0
ChangeLog.md Wyświetl plik

@@ -6,6 +6,7 @@
6 6
     * No longer including gl.h globally, now only using gl33.h where needed.
7 7
     * No longer including all of glm globally, only the vec2/3/4 and mat4x4.
8 8
     * No longer re-defining our own assert(), now called orAssert().
9
+    * Updated imgui to version 1.37
9 10
 
10 11
     [ 20150318 ]
11 12
     * Updated imgui to version 1.36

+ 1
- 1
cmake/travis_install_mac.sh Wyświetl plik

@@ -1,4 +1,4 @@
1 1
 #!/bin/bash
2 2
 
3
-brew install sdl2 sdl2_ttf freealut glm glbinding
3
+brew install sdl2 sdl2_ttf freealut glm
4 4
 

+ 18
- 0
cmake/travis_script_mac.sh Wyświetl plik

@@ -1,4 +1,22 @@
1 1
 #!/bin/bash
2 2
 
3
+# Need to build latest glbinding from source
4
+#GLBVER=`curl https://api.github.com/repos/hpicgs/glbinding/releases/latest | grep -m1 tag_name | cut -d\" -f4`
5
+#curl -L https://github.com/hpicgs/glbinding/archive/${GLBVER}.tar.gz | tar xzf -
6
+#cd glbinding-${GLBVER#v}
7
+
8
+# Need to use master until a fixed version is released
9
+git clone https://github.com/hpicgs/glbinding.git
10
+cd glbinding
11
+
12
+mkdir build
13
+cd build
14
+cmake ..
15
+make -j4
16
+sudo make install
17
+cd ..
18
+cd ..
19
+
20
+# Build OpenRaider and run the unit tests
3 21
 mkdir build && cd build && cmake .. && make -j 4 && make check
4 22
 

+ 3
- 0
src/deps/imgui/imconfig.h Wyświetl plik

@@ -23,6 +23,9 @@
23 23
 //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
24 24
 //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS
25 25
 
26
+//---- Don't implement help and test window functionality (ShowUserGuide()/ShowStyleEditor()/ShowTestWindow() methods will be empty)
27
+//#define IMGUI_DISABLE_TEST_WINDOWS
28
+
26 29
 //---- Include imgui_user.inl at the end of imgui.cpp so you can include code that extends ImGui using its private data/functions.
27 30
 #define IMGUI_INCLUDE_IMGUI_USER_INL
28 31
 

+ 722
- 355
src/deps/imgui/imgui.cpp
Plik diff jest za duży
Wyświetl plik


+ 75
- 49
src/deps/imgui/imgui.h Wyświetl plik

@@ -1,4 +1,4 @@
1
-// ImGui library v1.37 WIP
1
+// ImGui library v1.37
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.
@@ -9,11 +9,11 @@
9 9
 #include "imconfig.h"       // User-editable configuration file
10 10
 #include <float.h>          // FLT_MAX
11 11
 #include <stdarg.h>         // va_list
12
-#include <stddef.h>         // ptrdiff_t
13
-#include <stdlib.h>         // NULL, malloc
14
-#include <string.h>         // memset, memmove
12
+#include <stddef.h>         // ptrdiff_t, NULL
13
+#include <stdlib.h>         // NULL, malloc, free, qsort, atoi
14
+#include <string.h>         // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
15 15
 
16
-#define IMGUI_VERSION       "1.37 WIP"
16
+#define IMGUI_VERSION       "1.37"
17 17
 
18 18
 // Define assertion handler.
19 19
 #ifndef IM_ASSERT
@@ -43,8 +43,9 @@ typedef int ImGuiCol;               // enum ImGuiCol_
43 43
 typedef int ImGuiStyleVar;          // enum ImGuiStyleVar_
44 44
 typedef int ImGuiKey;               // enum ImGuiKey_
45 45
 typedef int ImGuiColorEditMode;     // enum ImGuiColorEditMode_
46
+typedef int ImGuiMouseCursor;       // enum ImGuiMouseCursor_
46 47
 typedef int ImGuiWindowFlags;       // enum ImGuiWindowFlags_
47
-typedef int ImGuiSetCond;           // enum ImGuiSetCondition_
48
+typedef int ImGuiSetCond;           // enum ImGuiSetCond_
48 49
 typedef int ImGuiInputTextFlags;    // enum ImGuiInputTextFlags_
49 50
 struct ImGuiTextEditCallbackData;   // for advanced uses of InputText() 
50 51
 typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data);
@@ -161,41 +162,42 @@ namespace ImGui
161 162
 
162 163
     // Window
163 164
     // See implementation in .cpp for details
164
-    IMGUI_API bool          Begin(const char* name = "Debug", bool* p_opened = NULL, const ImVec2& initial_size = ImVec2(0,0), float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code. passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
165
+    IMGUI_API bool          Begin(const char* name = "Debug", bool* p_opened = NULL, ImGuiWindowFlags flags = 0);                                           // return false when window is collapsed, so you can early out in your code. 'bool* p_opened' creates a widget on the upper-right to close the window (which sets your bool to false). 
166
+    IMGUI_API bool          Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0);   // this is the older/longer API. call SetNextWindowSize() instead if you want to set a window size. For regular windows, 'size_on_first_use' only applies to the first time EVER the window is created and probably not what you want! maybe obsolete this API eventually.
165 167
     IMGUI_API void          End();
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.
167
-    IMGUI_API bool          BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                    // "
168
+    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.
169
+    IMGUI_API bool          BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);                // "
168 170
     IMGUI_API void          EndChild();
169 171
     IMGUI_API ImVec2        GetContentRegionMax();                                              // window or current column boundaries, in windows coordinates
170 172
     IMGUI_API ImVec2        GetWindowContentRegionMin();                                        // window boundaries, in windows coordinates
171 173
     IMGUI_API ImVec2        GetWindowContentRegionMax();
172
-    IMGUI_API ImDrawList*   GetWindowDrawList();                                                // get rendering command-list if you want to append your own draw primitives.
174
+    IMGUI_API ImDrawList*   GetWindowDrawList();                                                // get rendering command-list if you want to append your own draw primitives
173 175
     IMGUI_API ImFont*       GetWindowFont();
174 176
     IMGUI_API float         GetWindowFontSize();                                                // size (also height in pixels) of current font with current scale applied
175
-    IMGUI_API void          SetWindowFontScale(float scale);                                    // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows.
176
-    IMGUI_API ImVec2        GetWindowPos();                                                     // you should rarely need/care about the window position, but it can be useful if you want to do your own drawing.
177
-    IMGUI_API ImVec2        GetWindowSize();                                                    // get current window position.
177
+    IMGUI_API void          SetWindowFontScale(float scale);                                    // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows
178
+    IMGUI_API ImVec2        GetWindowPos();                                                     // you should rarely need/care about the window position, but it can be useful if you want to do your own drawing
179
+    IMGUI_API ImVec2        GetWindowSize();                                                    // get current window position
178 180
     IMGUI_API float         GetWindowWidth();
179 181
     IMGUI_API bool          GetWindowCollapsed();
180 182
 
181
-    IMGUI_API void          SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0);         // set next window position - call before Begin().
182
-    IMGUI_API void          SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0);       // set next window size. set to ImVec2(0,0) to force an auto-fit.
183
-    IMGUI_API void          SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);      // set next window collapsed state.
183
+    IMGUI_API void          SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0);         // set next window position - call before Begin()
184
+    IMGUI_API void          SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0);       // set next window size. set to ImVec2(0,0) to force an auto-fit
185
+    IMGUI_API void          SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);      // set next window collapsed state
184 186
     IMGUI_API void          SetNextWindowFocus();                                               // set next window to be focused / front-most
185
-    IMGUI_API void          SetWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0);             // set current window position - call within Begin()/End(). may incur tearing.
186
-    IMGUI_API void          SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0);           // set current window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing.
187
-    IMGUI_API void          SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);          // set current window collapsed state.
187
+    IMGUI_API void          SetWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0);             // set current window position - call within Begin()/End(). may incur tearing
188
+    IMGUI_API void          SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0);           // set current window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing
189
+    IMGUI_API void          SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0);          // set current window collapsed state
188 190
     IMGUI_API void          SetWindowFocus();                                                   // set current window to be focused / front-most
189
-    IMGUI_API void          SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0);      // set named window position - call within Begin()/End(). may incur tearing.
190
-    IMGUI_API void          SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0);    // set named window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing.
191
-    IMGUI_API void          SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0);   // set named window collapsed state.
191
+    IMGUI_API void          SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0);      // set named window position - call within Begin()/End(). may incur tearing
192
+    IMGUI_API void          SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0);    // set named window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing
193
+    IMGUI_API void          SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0);   // set named window collapsed state
192 194
     IMGUI_API void          SetWindowFocus(const char* name);                                              // set named window to be focused / front-most
193 195
 
194
-    IMGUI_API float         GetScrollPosY();                                                    // get scrolling position (0..GetScrollMaxY())
196
+    IMGUI_API float         GetScrollPosY();                                                    // get scrolling position [0..GetScrollMaxY()]
195 197
     IMGUI_API float         GetScrollMaxY();                                                    // get maximum scrolling position == ContentSize.Y - WindowSize.Y
196
-    IMGUI_API void          SetScrollPosHere();                                                 // adjust scrolling position to center into the current cursor position.
197
-    IMGUI_API void          SetKeyboardFocusHere(int offset = 0);                               // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget.
198
-    IMGUI_API void          SetStateStorage(ImGuiStorage* tree);                                // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it).
198
+    IMGUI_API void          SetScrollPosHere();                                                 // adjust scrolling position to center into the current cursor position
199
+    IMGUI_API void          SetKeyboardFocusHere(int offset = 0);                               // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget
200
+    IMGUI_API void          SetStateStorage(ImGuiStorage* tree);                                // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
199 201
     IMGUI_API ImGuiStorage* GetStateStorage();
200 202
 
201 203
     // Parameters stacks (shared)
@@ -211,17 +213,21 @@ namespace ImGui
211 213
     IMGUI_API void          PushItemWidth(float item_width);                                    // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -0.01f always align width to the right side)
212 214
     IMGUI_API void          PopItemWidth();
213 215
     IMGUI_API float         CalcItemWidth();                                                    // width of item given pushed settings and current cursor position
214
-    IMGUI_API void          PushAllowKeyboardFocus(bool v);                                     // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets.
216
+    IMGUI_API void          PushAllowKeyboardFocus(bool v);                                     // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
215 217
     IMGUI_API void          PopAllowKeyboardFocus();
216
-    IMGUI_API void          PushTextWrapPos(float wrap_pos_x = 0.0f);                           // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space.
218
+    IMGUI_API void          PushTextWrapPos(float wrap_pos_x = 0.0f);                           // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space
217 219
     IMGUI_API void          PopTextWrapPos();
218 220
 
219 221
     // Tooltip
220
-    IMGUI_API void          SetTooltip(const char* fmt, ...);                                   // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins.
222
+    IMGUI_API void          SetTooltip(const char* fmt, ...);                                   // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins
221 223
     IMGUI_API void          SetTooltipV(const char* fmt, va_list args);
222
-    IMGUI_API void          BeginTooltip();                                                     // use to create full-featured tooltip windows that aren't just text.
224
+    IMGUI_API void          BeginTooltip();                                                     // use to create full-featured tooltip windows that aren't just text
223 225
     IMGUI_API void          EndTooltip();
224 226
 
227
+    // Popup
228
+    IMGUI_API void          BeginPopup(bool* p_opened);
229
+    IMGUI_API void          EndPopup();
230
+
225 231
     // Layout
226 232
     IMGUI_API void          BeginGroup();
227 233
     IMGUI_API void          EndGroup();
@@ -233,8 +239,8 @@ namespace ImGui
233 239
     IMGUI_API void          Columns(int count = 1, const char* id = NULL, bool border=true);    // setup number of columns
234 240
     IMGUI_API void          NextColumn();                                                       // next column
235 241
     IMGUI_API int           GetColumnIndex();                                                   // get current column index
236
-    IMGUI_API float         GetColumnOffset(int column_index = -1);                             // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetcolumnsCount() inclusive. column 0 is usually 0.0f and not resizable unless you call this.
237
-    IMGUI_API void          SetColumnOffset(int column_index, float offset_x);                  // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column.
242
+    IMGUI_API float         GetColumnOffset(int column_index = -1);                             // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetcolumnsCount() inclusive. column 0 is usually 0.0f and not resizable unless you call this
243
+    IMGUI_API void          SetColumnOffset(int column_index, float offset_x);                  // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column
238 244
     IMGUI_API float         GetColumnWidth(int column_index = -1);                              // column width (== GetColumnOffset(GetColumnIndex()+1) - GetColumnOffset(GetColumnOffset())
239 245
     IMGUI_API int           GetColumnsCount();                                                  // number of columns (what was passed to Columns())
240 246
     IMGUI_API ImVec2        GetCursorPos();                                                     // cursor position is relative to window position
@@ -243,20 +249,20 @@ namespace ImGui
243 249
     IMGUI_API void          SetCursorPos(const ImVec2& pos);                                    // "
244 250
     IMGUI_API void          SetCursorPosX(float x);                                             // "
245 251
     IMGUI_API void          SetCursorPosY(float y);                                             // "
246
-    IMGUI_API ImVec2        GetCursorScreenPos();                                               // cursor position in absolute screen coordinates (0..io.DisplaySize)
247
-    IMGUI_API void          SetCursorScreenPos(const ImVec2& pos);                              // cursor position in absolute screen coordinates (0..io.DisplaySize)
248
-    IMGUI_API void          AlignFirstTextHeightToWidgets();                                    // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets.
252
+    IMGUI_API ImVec2        GetCursorScreenPos();                                               // cursor position in absolute screen coordinates [0..io.DisplaySize]
253
+    IMGUI_API void          SetCursorScreenPos(const ImVec2& pos);                              // cursor position in absolute screen coordinates [0..io.DisplaySize]
254
+    IMGUI_API void          AlignFirstTextHeightToWidgets();                                    // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets
249 255
     IMGUI_API float         GetTextLineHeight();                                                // height of font == GetWindowFontSize()
250 256
     IMGUI_API float         GetTextLineHeightWithSpacing();                                     // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y
251 257
 
252 258
     // ID scopes
253
-    // If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them.
259
+    // If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them
254 260
     // You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide')
255 261
     IMGUI_API void          PushID(const char* str_id);                                         // push identifier into the ID stack. IDs are hash of the *entire* stack!
256 262
     IMGUI_API void          PushID(const void* ptr_id);
257 263
     IMGUI_API void          PushID(const int int_id);
258 264
     IMGUI_API void          PopID();
259
-    IMGUI_API ImGuiID       GetID(const char* str_id);                                          // calculate unique ID (hash of whole ID stack + given parameter). useful if you want to query into ImGuiStorage yourself. otherwise rarely needed.
265
+    IMGUI_API ImGuiID       GetID(const char* str_id);                                          // calculate unique ID (hash of whole ID stack + given parameter). useful if you want to query into ImGuiStorage yourself. otherwise rarely needed
260 266
     IMGUI_API ImGuiID       GetID(const void* ptr_id);
261 267
 
262 268
     // Widgets
@@ -266,7 +272,7 @@ namespace ImGui
266 272
     IMGUI_API void          TextColoredV(const ImVec4& col, const char* fmt, va_list args);
267 273
     IMGUI_API void          TextWrapped(const char* fmt, ...);                                  // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();
268 274
     IMGUI_API void          TextWrappedV(const char* fmt, va_list args);
269
-    IMGUI_API void          TextUnformatted(const char* text, const char* text_end = NULL);     // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text.
275
+    IMGUI_API void          TextUnformatted(const char* text, const char* text_end = NULL);     // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text
270 276
     IMGUI_API void          LabelText(const char* label, const char* fmt, ...);                 // display text+label aligned the same way as value+label widgets 
271 277
     IMGUI_API void          LabelTextV(const char* label, const char* fmt, va_list args);
272 278
     IMGUI_API void          Bullet();
@@ -276,9 +282,9 @@ namespace ImGui
276 282
     IMGUI_API bool          SmallButton(const char* label);
277 283
     IMGUI_API bool          InvisibleButton(const char* str_id, const ImVec2& size);
278 284
     IMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
279
-    IMGUI_API bool          ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0),  const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,1), const ImVec4& tint_col = ImVec4(1,1,1,1));    // <0 frame_padding uses default frame padding settings. 0 for no paddnig.
285
+    IMGUI_API bool          ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0),  const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,1), const ImVec4& tint_col = ImVec4(1,1,1,1));    // <0 frame_padding uses default frame padding settings. 0 for no padding
280 286
     IMGUI_API bool          CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false);
281
-    IMGUI_API bool          SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);     // adjust display_format to decorate the value with a prefix or a suffix. Use power!=1.0 for logarithmic sliders.
287
+    IMGUI_API bool          SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);     // adjust display_format to decorate the value with a prefix or a suffix. Use power!=1.0 for logarithmic sliders
282 288
     IMGUI_API bool          SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
283 289
     IMGUI_API bool          SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
284 290
     IMGUI_API bool          SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
@@ -326,7 +332,7 @@ namespace ImGui
326 332
     IMGUI_API void          SetNextTreeNodeOpened(bool opened, ImGuiSetCond cond = 0);          // set next tree node to be opened.
327 333
 
328 334
     // Selectable / Lists
329
-    IMGUI_API bool          Selectable(const char* label, bool selected, const ImVec2& size = ImVec2(0,0));
335
+    IMGUI_API bool          Selectable(const char* label, bool selected = false, const ImVec2& size = ImVec2(0,0));
330 336
     IMGUI_API bool          Selectable(const char* label, bool* p_selected, const ImVec2& size = ImVec2(0,0));
331 337
     IMGUI_API bool          ListBox(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
332 338
     IMGUI_API bool          ListBox(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);
@@ -352,10 +358,9 @@ namespace ImGui
352 358
 
353 359
     // Utilities
354 360
     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.
361
+    IMGUI_API bool          IsItemHoveredRect();                                                // was the last item hovered by mouse? even if another item is active while we are hovering this
356 362
     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)
357 363
     IMGUI_API bool          IsAnyItemActive();                                                  // 
358
-    IMGUI_API ImVec2        GetItemActiveDragDelta();                                           // mouse delta from the time the item first got active
359 364
     IMGUI_API ImVec2        GetItemRectMin();                                                   // get bounding rect of last item
360 365
     IMGUI_API ImVec2        GetItemRectMax();                                                   // "
361 366
     IMGUI_API ImVec2        GetItemRectSize();                                                  // "
@@ -369,16 +374,20 @@ namespace ImGui
369 374
     IMGUI_API bool          IsMouseHoveringWindow();                                            // is mouse hovering current window ("window" in API names always refer to current window)
370 375
     IMGUI_API bool          IsMouseHoveringAnyWindow();                                         // is mouse hovering any active imgui window
371 376
     IMGUI_API bool          IsMouseHoveringRect(const ImVec2& rect_min, const ImVec2& rect_max);// is mouse hovering given bounding rect
377
+    IMGUI_API bool          IsMouseDragging(int button = 0, float lock_threshold = -1.0f);      // is mouse dragging. if lock_threshold < -1.0f uses io.MouseDraggingThreshold
372 378
     IMGUI_API bool          IsPosHoveringAnyWindow(const ImVec2& pos);                          // is given position hovering any active imgui window
373 379
     IMGUI_API ImVec2        GetMousePos();                                                      // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
380
+    IMGUI_API ImVec2        GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f);    // dragging amount since clicking, also see: GetItemActiveDragDelta(). if lock_threshold < -1.0f uses io.MouseDraggingThreshold
381
+    IMGUI_API ImGuiMouseCursor GetMouseCursor();                                                // get desired cursor type, reset in ImGui::NewFrame(), this updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
382
+    IMGUI_API void          SetMouseCursor(ImGuiMouseCursor type);                              // set desired cursor type
374 383
     IMGUI_API float         GetTime();
375 384
     IMGUI_API int           GetFrameCount();
376 385
     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.
386
+    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
378 387
     IMGUI_API ImVec2        CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
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.
388
+    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
380 389
 
381
-    IMGUI_API void          BeginChildFrame(ImGuiID id, const ImVec2& size);                    // helper to create a child window / scrolling region that looks like a normal widget frame.
390
+    IMGUI_API void          BeginChildFrame(ImGuiID id, const ImVec2& size);                    // helper to create a child window / scrolling region that looks like a normal widget frame
382 391
     IMGUI_API void          EndChildFrame();
383 392
 
384 393
     IMGUI_API ImU32         ColorConvertFloat4ToU32(const ImVec4& in);
@@ -419,7 +428,8 @@ enum ImGuiWindowFlags_
419 428
     ImGuiWindowFlags_ChildWindowAutoFitX    = 1 << 10,  // For internal use by BeginChild()
420 429
     ImGuiWindowFlags_ChildWindowAutoFitY    = 1 << 11,  // For internal use by BeginChild()
421 430
     ImGuiWindowFlags_ComboBox               = 1 << 12,  // For internal use by ComboBox()
422
-    ImGuiWindowFlags_Tooltip                = 1 << 13   // For internal use by BeginTooltip()
431
+    ImGuiWindowFlags_Tooltip                = 1 << 13,  // For internal use by BeginTooltip()
432
+    ImGuiWindowFlags_Popup                  = 1 << 14   // For internal use by BeginPopup()
423 433
 };
424 434
 
425 435
 // Flags for ImGui::InputText()
@@ -532,6 +542,19 @@ enum ImGuiColorEditMode_
532 542
     ImGuiColorEditMode_HEX = 2
533 543
 };
534 544
 
545
+// Enumeration for GetMouseCursor()
546
+enum ImGuiMouseCursor_
547
+{
548
+    ImGuiMouseCursor_Arrow = 0,
549
+    ImGuiMouseCursor_TextInput,
550
+    ImGuiMouseCursor_Move,                  // Unused by ImGui
551
+    ImGuiMouseCursor_ResizeNS,              // Unused by ImGui
552
+    ImGuiMouseCursor_ResizeEW,              // Unused by ImGui
553
+    ImGuiMouseCursor_ResizeNESW,            // Unused by ImGui
554
+    ImGuiMouseCursor_ResizeNWSE,
555
+    ImGuiMouseCursor_Count_
556
+};
557
+
535 558
 // Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions
536 559
 // All those functions treat 0 as a shortcut to ImGuiSetCond_Always
537 560
 enum ImGuiSetCond_
@@ -559,6 +582,7 @@ struct ImGuiStyle
559 582
     float       ColumnsMinSpacing;          // Minimum horizontal spacing between two columns
560 583
     float       ScrollbarWidth;             // Width of the vertical scrollbar
561 584
     float       GrabMinSize;                // Minimum width/height of a slider or scrollbar grab
585
+    ImVec2      DisplaySafeAreaPadding;     // Window positions are clamped to be visible within the display area. If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding.
562 586
     ImVec4      Colors[ImGuiCol_COUNT];
563 587
 
564 588
     IMGUI_API ImGuiStyle();
@@ -579,6 +603,7 @@ struct ImGuiIO
579 603
     const char*   LogFilename;              // = "imgui_log.txt"    // Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
580 604
     float         MouseDoubleClickTime;     // = 0.30f              // Time for a double-click, in seconds.
581 605
     float         MouseDoubleClickMaxDist;  // = 6.0f               // Distance threshold to stay in to validate a double-click, in pixels.
606
+    float         MouseDragThreshold;       // = 6.0f               // Distance threshold before considering we are dragging
582 607
     int           KeyMap[ImGuiKey_COUNT];   // <unset>              // Map of indices into the KeysDown[512] entries array
583 608
     void*         UserData;                 // = NULL               // Store your own data for retrieval by callbacks.
584 609
 
@@ -648,6 +673,7 @@ struct ImGuiIO
648 673
     bool        MouseDoubleClicked[5];      // Has mouse button been double-clicked?
649 674
     bool        MouseDownOwned[5];          // Track if button was clicked inside a window. We don't request mouse capture from the application if click started outside ImGui bounds.
650 675
     float       MouseDownTime[5];           // Time the mouse button has been down
676
+    float       MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the click point
651 677
     float       KeysDownTime[512];          // Time the keyboard key has been down
652 678
 
653 679
     IMGUI_API   ImGuiIO();
@@ -861,6 +887,7 @@ struct ImDrawList
861 887
 
862 888
     ImDrawList() { Clear(); }
863 889
     IMGUI_API void  Clear();
890
+    IMGUI_API void  ClearFreeMemory();
864 891
     IMGUI_API void  PushClipRect(const ImVec4& clip_rect);          // Scissoring. The values are x1, y1, x2, y2.
865 892
     IMGUI_API void  PushClipRectFullScreen();
866 893
     IMGUI_API void  PopClipRect();
@@ -931,7 +958,6 @@ struct ImFontAtlas
931 958
     unsigned int*               TexPixelsRGBA32;    // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4
932 959
     int                         TexWidth;
933 960
     int                         TexHeight;
934
-    ImVec2                      TexExtraDataPos;    // Position of our rectangle where we draw non-font graphics
935 961
     ImVec2                      TexUvWhitePixel;    // Texture coordinates to a white pixel (part of the TexExtraData block)
936 962
     ImVector<ImFont*>           Fonts;
937 963
 
@@ -940,7 +966,7 @@ struct ImFontAtlas
940 966
     ImVector<ImFontAtlasData*>  InputData;          // Internal data
941 967
     IMGUI_API bool              Build();            // Build pixels data. This is automatically for you by the GetTexData*** functions.
942 968
     IMGUI_API void              ClearInputData();   // Clear the input TTF data.
943
-    IMGUI_API void              RenderCustomTexData();
969
+    IMGUI_API void              RenderCustomTexData(int pass, void* rects);
944 970
 };
945 971
 
946 972
 // TTF font loading and rendering

Ładowanie…
Anuluj
Zapisz