Skip to content

Commit a157331

Browse files
committed
改用Release版本IMGUI
1 parent c0e872f commit a157331

12 files changed

+123
-173
lines changed

Diff for: impl/imgui_impl_glfw.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// dear imgui: Platform Binding for GLFW
1+
// ImGui Platform Binding for: GLFW
22
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
33
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
44

55
// Implemented features:
66
// [X] Platform: Clipboard support.
7-
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
7+
// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
88
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
99
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
1010

Diff for: impl/imgui_impl_glfw.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// dear imgui: Platform Binding for GLFW
1+
// ImGui Platform Binding for: GLFW
22
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..)
33
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
44

55
// Implemented features:
66
// [X] Platform: Clipboard support.
7-
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
7+
// [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
88
// [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW.
99
// [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE).
1010

Diff for: impl/imgui_impl_opengl2.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui: Renderer for OpenGL2 (legacy OpenGL, fixed pipeline)
1+
// ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline)
22
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
33

44
// Implemented features:
@@ -102,7 +102,7 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
102102
//glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound
103103

104104
// Setup viewport, orthographic projection matrix
105-
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
105+
// Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
106106
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
107107
glMatrixMode(GL_PROJECTION);
108108
glPushMatrix();

Diff for: impl/imgui_impl_opengl2.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui: Renderer for OpenGL2 (legacy OpenGL, fixed pipeline)
1+
// ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline)
22
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
33

44
// Implemented features:

Diff for: impl/imgui_impl_opengl3.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui: Renderer for OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
1+
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
22
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
33
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
44

@@ -175,7 +175,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
175175
#endif
176176

177177
// Setup viewport, orthographic projection matrix
178-
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
178+
// Our visible imgui space lies from draw_data->DisplayPps (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayMin is typically (0,0) for single viewport apps.
179179
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
180180
float L = draw_data->DisplayPos.x;
181181
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;

Diff for: impl/imgui_impl_opengl3.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui: Renderer for OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
1+
// ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline)
22
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
33
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
44

Diff for: include/imgui.h

+16-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.66 WIP
1+
// dear imgui, v1.65
22
// (headers)
33

44
// See imgui.cpp file for documentation.
@@ -23,8 +23,8 @@
2323

2424
// Version
2525
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY00 then bounced up to XYY01 when release tagging happens)
26-
#define IMGUI_VERSION "1.66 WIP"
27-
#define IMGUI_VERSION_NUM 16600
26+
#define IMGUI_VERSION "1.65"
27+
#define IMGUI_VERSION_NUM 16501
2828
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert))
2929

3030
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
@@ -189,20 +189,14 @@ namespace ImGui
189189
IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font
190190

191191
// Windows
192-
// - Begin() = push window to the stack and start appending to it. End() = pop window from the stack.
193-
// - You may append multiple times to the same window during the same frame.
194-
// - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window, which clicking will set the boolean to false when clicked.
195-
// - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
196-
// Always call a matching End() for each Begin() call, regardless of its return value [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.]
192+
// (Begin = push window to the stack and start appending to it. End = pop window from the stack. You may append multiple times to the same window during the same frame)
193+
// Begin()/BeginChild() return false to indicate the window being collapsed or fully clipped, so you may early out and omit submitting anything to the window.
194+
// You need to always call a matching End()/EndChild() for a Begin()/BeginChild() call, regardless of its return value (this is due to legacy reason and is inconsistent with BeginMenu/EndMenu, BeginPopup/EndPopup and other functions where the End call should only be called if the corresponding Begin function returned true.)
195+
// Passing 'bool* p_open != NULL' shows a close widget in the upper-right corner of the window, which when clicking will set the boolean to false.
196+
// Use child windows to introduce independent scrolling/clipping regions within a host window. Child windows can embed their own child.
197197
IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);
198198
IMGUI_API void End();
199-
200-
// Child Windows
201-
// - Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child.
202-
// - For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImVec2(0,400).
203-
// - BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window.
204-
// Always call a matching EndChild() for each BeginChild() call, regardless of its return value [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.]
205-
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0);
199+
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0); // Begin a scrolling region. size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. ImVec2(0,400).
206200
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0);
207201
IMGUI_API void EndChild();
208202

@@ -247,7 +241,7 @@ namespace ImGui
247241
IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y
248242
IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()]
249243
IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()]
250-
IMGUI_API void SetScrollHereY(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
244+
IMGUI_API void SetScrollHere(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead.
251245
IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions.
252246

253247
// Parameters stacks (shared)
@@ -521,8 +515,8 @@ namespace ImGui
521515
IMGUI_API void PopClipRect();
522516

523517
// Focus, Activation
524-
// (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHereY()" when applicable to signify "this is the default item")
525-
IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window.
518+
// (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHere()" when applicable, to make your code more forward compatible when navigation branch is merged)
519+
IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. Please use instead of "if (IsWindowAppearing()) SetScrollHere()" to signify "default item".
526520
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. Use -1 to access previous widget.
527521

528522
// Utilities
@@ -1210,8 +1204,6 @@ struct ImGuiIO
12101204
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
12111205
namespace ImGui
12121206
{
1213-
// OBSOLETED in 1.66 (from Sep 2018)
1214-
static inline void SetScrollHere(float center_ratio=0.5f){ SetScrollHereY(center_ratio); }
12151207
// OBSOLETED in 1.63 (from Aug 2018)
12161208
static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); }
12171209
// OBSOLETED in 1.61 (from Apr 2018)
@@ -1263,7 +1255,7 @@ class ImVector
12631255
inline ImVector() { Size = Capacity = 0; Data = NULL; }
12641256
inline ~ImVector() { if (Data) ImGui::MemFree(Data); }
12651257
inline ImVector(const ImVector<T>& src) { Size = Capacity = 0; Data = NULL; operator=(src); }
1266-
inline ImVector<T>& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(value_type)); return *this; }
1258+
inline ImVector& operator=(const ImVector<T>& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(value_type)); return *this; }
12671259

12681260
inline bool empty() const { return Size == 0; }
12691261
inline int size() const { return Size; }
@@ -1456,7 +1448,7 @@ struct ImGuiInputTextCallbackData
14561448

14571449
// Helper functions for text manipulation.
14581450
// Use those function to benefit from the CallbackResize behaviors. Calling those function reset the selection.
1459-
IMGUI_API ImGuiInputTextCallbackData();
1451+
ImGuiInputTextCallbackData();
14601452
IMGUI_API void DeleteChars(int pos, int bytes_count);
14611453
IMGUI_API void InsertChars(int pos, const char* text, const char* text_end = NULL);
14621454
bool HasSelection() const { return SelectionStart != SelectionEnd; }
@@ -1928,7 +1920,7 @@ struct ImFont
19281920
ImVec2 DisplayOffset; // = (0.f,0.f) // Offset font rendering by xx pixels
19291921
ImVector<ImFontGlyph> Glyphs; // // All glyphs.
19301922
ImVector<float> IndexAdvanceX; // // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI).
1931-
ImVector<ImWchar> IndexLookup; // // Sparse. Index glyphs by Unicode code-point.
1923+
ImVector<unsigned short> IndexLookup; // // Sparse. Index glyphs by Unicode code-point.
19321924
const ImFontGlyph* FallbackGlyph; // == FindGlyph(FontFallbackChar)
19331925
float FallbackAdvanceX; // == FallbackGlyph->AdvanceX
19341926
ImWchar FallbackChar; // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar()
@@ -1957,7 +1949,7 @@ struct ImFont
19571949
// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
19581950
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8
19591951
IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;
1960-
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const;
1952+
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const;
19611953
IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const;
19621954

19631955
// [Internal]

Diff for: include/imgui_internal.h

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// dear imgui, v1.66 WIP
1+
// dear imgui, v1.65
22
// (internal structures/api)
33

44
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
@@ -649,8 +649,7 @@ struct ImGuiContext
649649
int FrameCount;
650650
int FrameCountEnded;
651651
int FrameCountRendered;
652-
ImVector<ImGuiWindow*> Windows; // Windows, sorted in display order, back to front
653-
ImVector<ImGuiWindow*> WindowsFocusOrder; // Windows, sorted in focus order, back to front
652+
ImVector<ImGuiWindow*> Windows;
654653
ImVector<ImGuiWindow*> WindowsSortBuffer;
655654
ImVector<ImGuiWindow*> CurrentWindowStack;
656655
ImGuiStorage WindowsById;
@@ -1114,10 +1113,9 @@ namespace ImGui
11141113
inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }
11151114
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
11161115
IMGUI_API void FocusWindow(ImGuiWindow* window);
1117-
IMGUI_API void FocusPreviousWindowIgnoringOne(ImGuiWindow* ignore_window);
1118-
IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window);
1119-
IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window);
1120-
IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window);
1116+
IMGUI_API void FocusFrontMostActiveWindowIgnoringOne(ImGuiWindow* ignore_window);
1117+
IMGUI_API void BringWindowToFront(ImGuiWindow* window);
1118+
IMGUI_API void BringWindowToBack(ImGuiWindow* window);
11211119
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
11221120
IMGUI_API ImVec2 CalcWindowExpectedSize(ImGuiWindow* window);
11231121
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);

0 commit comments

Comments
 (0)