From fae7b34a3f54ad618851490442c47c33f7b4485c Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 9 Oct 2015 21:47:41 +0200 Subject: [PATCH 01/10] Fixed bug with handling of malformed utf-8 at the end of a non-zero terminated string range. --- imgui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 1f1aaedc..1865d185 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -908,7 +908,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* if ((*str & 0xe0) == 0xc0) { *out_char = 0xFFFD; // will be invalid but not end of string - if (in_text_end && in_text_end - (const char*)str < 2) return 0; + if (in_text_end && in_text_end - (const char*)str < 2) return 1; if (*str < 0xc2) return 2; c = (unsigned int)((*str++ & 0x1f) << 6); if ((*str & 0xc0) != 0x80) return 2; @@ -919,7 +919,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* if ((*str & 0xf0) == 0xe0) { *out_char = 0xFFFD; // will be invalid but not end of string - if (in_text_end && in_text_end - (const char*)str < 3) return 0; + if (in_text_end && in_text_end - (const char*)str < 3) return 1; if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return 3; if (*str == 0xed && str[1] > 0x9f) return 3; // str[1] < 0x80 is checked below c = (unsigned int)((*str++ & 0x0f) << 12); @@ -933,7 +933,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* if ((*str & 0xf8) == 0xf0) { *out_char = 0xFFFD; // will be invalid but not end of string - if (in_text_end && in_text_end - (const char*)str < 4) return 0; + if (in_text_end && in_text_end - (const char*)str < 4) return 1; if (*str > 0xf4) return 4; if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return 4; if (*str == 0xf4 && str[1] > 0x8f) return 4; // str[1] < 0x80 is checked below From 8a6bde35276838a9152a5cc9cfd66debe5720c67 Mon Sep 17 00:00:00 2001 From: richardk Date: Sun, 11 Oct 2015 16:25:49 +0200 Subject: [PATCH 02/10] Fix for AltGR being send as Ctrl&Alt on german keyboards. Don't consume characters if CTRL key press is detected AND ALT key press is detected in Imgui::InputTextEx --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 1865d185..aa20ce15 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7217,7 +7217,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 if (g.IO.InputCharacters[0]) { // Process text input (before we check for Return because using some IME will effectively send a Return?) - if (!is_ctrl_down && is_editable) + if (!(is_ctrl_down && !is_alt_down) && is_editable) { for (int n = 0; n < IM_ARRAYSIZE(g.IO.InputCharacters) && g.IO.InputCharacters[n]; n++) if (unsigned int c = (unsigned int)g.IO.InputCharacters[n]) From 8c5c0c41fc80462e6111b9b9dfa57e05d4cca0ef Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 11 Oct 2015 17:16:45 +0200 Subject: [PATCH 03/10] ImDrawList: AddImage() uv parameters default to (0.0) and (1.1) --- imgui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.h b/imgui.h index 361ba83e..8434f27c 100644 --- a/imgui.h +++ b/imgui.h @@ -1113,7 +1113,7 @@ struct ImDrawList IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12); IMGUI_API void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL); 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 ImVec4* cpu_fine_clip_rect = NULL); - IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col = 0xFFFFFFFF); + IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), ImU32 col = 0xFFFFFFFF); IMGUI_API void AddPolyline(const ImVec2* points, const int num_points, ImU32 col, bool closed, float thickness, bool anti_aliased); IMGUI_API void AddConvexPolyFilled(const ImVec2* points, const int num_points, ImU32 col, bool anti_aliased); IMGUI_API void AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments = 0); From 8eb4df0dd610bd883a606c8a3f73960b302a48c6 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 11 Oct 2015 17:20:07 +0200 Subject: [PATCH 04/10] Added comments (#369 #370) --- imgui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/imgui.cpp b/imgui.cpp index aa20ce15..5db642f0 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7217,6 +7217,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 if (g.IO.InputCharacters[0]) { // Process text input (before we check for Return because using some IME will effectively send a Return?) + // We ignore CTRL inputs, but need to allow CTRL+ALT as some keyboards (e.g. German) use AltGR - which is Alt+Ctrl - to input certain characters. if (!(is_ctrl_down && !is_alt_down) && is_editable) { for (int n = 0; n < IM_ARRAYSIZE(g.IO.InputCharacters) && g.IO.InputCharacters[n]; n++) From a5132286b7c7763942ae84bfc43ddbedcb4964ae Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 11 Oct 2015 17:50:55 +0200 Subject: [PATCH 05/10] ImDrawList: ChannelsSetCurrent() added an extra assert --- imgui_draw.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index e91ba390..09fcf015 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -291,6 +291,7 @@ void ImDrawList::ChannelsMerge() void ImDrawList::ChannelsSetCurrent(int idx) { + IM_ASSERT(idx < _ChannelsCount); if (_ChannelsCurrent == idx) return; memcpy(&_Channels.Data[_ChannelsCurrent].CmdBuffer, &CmdBuffer, sizeof(CmdBuffer)); // copy 12 bytes, four times memcpy(&_Channels.Data[_ChannelsCurrent].IdxBuffer, &IdxBuffer, sizeof(IdxBuffer)); From 509ac33abe2f0e6a53a9ca7ec864b9bd7e5b36a4 Mon Sep 17 00:00:00 2001 From: Nicolas Guillemot Date: Sun, 11 Oct 2015 16:42:22 -0700 Subject: [PATCH 06/10] fix POSITION format (ImDrawVert::pos is 2D, not 4D) the inputlayout incorrectly described the POSITION attribute as being 4D, while ImDrawVert::pos is 2D. This went unnoticed because the buffer binding has a stride of sizeof(ImDrawVert) and the POSITION is treated as a float2 in the vertex shader. If you switch POSITION to float4 in the vertex shader (and actually use the z/w in the matrix multiplication) then everything become wacky-looking since it's interpreting the texture coordinates as z/w. On a similar note: It's weird that the projection matrix takes z and w into consideration when those don't exist in the shader due to positions being float2s. --- examples/directx11_example/imgui_impl_dx11.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/directx11_example/imgui_impl_dx11.cpp b/examples/directx11_example/imgui_impl_dx11.cpp index 41684b33..cf862995 100644 --- a/examples/directx11_example/imgui_impl_dx11.cpp +++ b/examples/directx11_example/imgui_impl_dx11.cpp @@ -328,9 +328,9 @@ bool ImGui_ImplDX11_CreateDeviceObjects() // Create the input layout D3D11_INPUT_ELEMENT_DESC localLayout[] = { - { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->pos), D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->uv), D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (size_t)(&((ImDrawVert*)0)->col), D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->pos), D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->uv), D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (size_t)(&((ImDrawVert*)0)->col), D3D11_INPUT_PER_VERTEX_DATA, 0 }, }; if (g_pd3dDevice->CreateInputLayout(localLayout, 3, g_pVertexShaderBlob->GetBufferPointer(), g_pVertexShaderBlob->GetBufferSize(), &g_pInputLayout) != S_OK) From a5c895f7914cd3b1ce67051ad300b0cb959480ce Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 12 Oct 2015 12:20:01 +0200 Subject: [PATCH 07/10] Added SetClipboardText / GetClipboardText helper shortcuts to match MemAlloc / MemFree --- imgui.cpp | 11 +++++++++++ imgui.h | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 5db642f0..0e7add76 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1761,6 +1761,17 @@ void ImGui::MemFree(void* ptr) return GImGui->IO.MemFreeFn(ptr); } +const char* ImGui::GetClipboardText() +{ + return GImGui->IO.GetClipboardTextFn ? GImGui->IO.GetClipboardTextFn() : ""; +} + +void ImGui::SetClipboardText(const char* text) +{ + if (GImGui->IO.SetClipboardTextFn) + GImGui->IO.SetClipboardTextFn(text); +} + const char* ImGui::GetVersion() { return IMGUI_VERSION; diff --git a/imgui.h b/imgui.h index 8434f27c..29ad4756 100644 --- a/imgui.h +++ b/imgui.h @@ -416,9 +416,11 @@ namespace ImGui IMGUI_API void CaptureKeyboardFromApp(); // manually enforce imgui setting the io.WantCaptureKeyboard flag next frame (your application needs to handle it). e.g. capture keyboard when your widget is being hovered. IMGUI_API void CaptureMouseFromApp(); // manually enforce imgui setting the io.WantCaptureMouse flag next frame (your application needs to handle it). - // Helpers functions to access the MemAllocFn/MemFreeFn pointers in ImGui::GetIO() + // Helpers functions to access functions pointers in ImGui::GetIO() IMGUI_API void* MemAlloc(size_t sz); IMGUI_API void MemFree(void* ptr); + IMGUI_API const char* GetClipboardText(); + IMGUI_API void SetClipboardText(const char* text); // Internal state/context access - if you want to use multiple ImGui context, or share context between modules (e.g. DLL), or allocate the memory yourself IMGUI_API const char* GetVersion(); From d4d2e5bc62540d4f20d9b50adf82a090013f5a0b Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 12 Oct 2015 12:31:41 +0200 Subject: [PATCH 08/10] Added items to Todo list --- imgui.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 0e7add76..80f4b6ea 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -399,14 +399,19 @@ Issue numbers (#) refer to github issues. The list below consist mostly of notes of things to do before they are requested/discussed by users (at that point it usually happens on the github) - - window: autofit feedback loop when user relies on any dynamic layout (window width multiplier, column). maybe just clearly drop manual autofit? - - window: add a way for very transient windows (non-saved, temporary overlay over hundreds of objects) to "clean" up from the global window list. + - window: maximum window size settings (per-axis). for large popups in particular user may not want the popup to fill all space. + - window: add a way for very transient windows (non-saved, temporary overlay over hundreds of objects) to "clean" up from the global window list. perhaps a lightweight explicit cleanup pass. + - window: auto-fit feedback loop when user relies on any dynamic layout (window width multiplier, column). clarify. - window: allow resizing of child windows (possibly given min/max for each axis?) - window: background options for child windows, border option (disable rounding) + - window: add a way to clear an existing window instead of appending (e.g. for tooltip override using a consistent api rather than the deferred tooltip) - window: resizing from any sides? + mouse cursor directives for app. +!- window: begin with *p_opened == false should return false. - window: get size/pos helpers given names (see discussion in #249) - window: a collapsed window can be stuck behind the main menu bar? + - window: detect extra End() call that pop the "Debug" window out and assert at call site instead of later. !- scrolling: allow immediately effective change of scroll if we haven't appended items yet + - splitter: formalize the splitter idiom into an official api (we want to handle n-way split) - widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc. - widgets: clean up widgets internal toward exposing everything. - widgets: add disabled and read-only modes (#211) @@ -421,6 +426,8 @@ - input number: use mouse wheel to step up/down - input number: applying arithmetics ops (+,-,*,/) messes up with text edit undo stack. - text: proper alignment options + - image/image button: misalignment on padded/bordered button? + - image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that? - layout: horizontal layout helper (#97) - layout: more generic alignment state (left/right/centered) for single items? - layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding. @@ -436,19 +443,20 @@ - listbox: user may want to initial scroll to focus on the one selected value? - listbox: keyboard navigation. - listbox: scrolling should track modified selection. - ! menus/popups: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331) +-! menus/popups: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331) - menus: local shortcuts, global shortcuts (#126) - menus: icons - menus: menubars: some sort of priority / effect of main menu-bar on desktop size? + - statusbar: add a per-window status bar helper similar to what menubar does. - tabs - separator: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y) - gauge: various forms of gauge/loading bars widgets - - color: add a better color picker (perhaps a popup). - - plot: plotlines should use the polygon-stroke facilities (currently issues with averaging normals) + - color: add a better color picker + - plot: PlotLines() should use the polygon-stroke facilities (currently issues with averaging normals) - plot: make it easier for user to draw extra stuff into the graph (e.g: draw basis, highlight certain points, 2d plots, multiple plots) - plot: "smooth" automatic scale over time, user give an input 0.0(full user scale) 1.0(full derived from value) - plot: add a helper e.g. Plot(char* label, float value, float time_span=2.0f) that stores values and Plot them for you - probably another function name. and/or automatically allow to plot ANY displayed value (more reliance on stable ID) - - file selection widget -> build the tool in our codebase to improve model-dialog idioms + - applet: file selection widget (as an example) - slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt() - slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar). - slider: add dragging-based widgets to edit values with mouse (on 2 axises), saving screen real-estate. @@ -459,13 +467,15 @@ - text edit: centered text for slider as input text so it matches typical positioning. - text edit: flag to disable live update of the user buffer. - text edit: field resize behavior - field could stretch when being edited? hover tooltip shows more text? - - tree: add treenode/treepush int variants? because (void*) cast from int warns on some platforms/settings + - tree node / optimization: avoid formatting when clipped. + - tree node: tree-node/header right-most side doesn't take account of horizontal scrolling. + - tree node: add treenode/treepush int variants? because (void*) cast from int warns on some platforms/settings - textwrapped: figure out better way to use TextWrapped() in an always auto-resize context (tooltip, etc.) (git issue #249) - settings: write more decent code to allow saving/loading new fields - settings: api for per-tool simple persistent data (bool,int,float,columns sizes,etc.) in .ini file - style: store rounded corners in texture to use 1 quad per corner (filled and wireframe). so rounding have minor cost. - style: color-box not always square? - - style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps that other settings? + - style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc. - text: simple markup language for color change? - log: LogButtons() options for specifying depth and/or hiding depth slider - log: have more control over the log scope (e.g. stop logging when leaving current tree node scope) @@ -479,11 +489,12 @@ - focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame) - input: rework IO to be able to pass actual events to fix temporal aliasing issues. - input: support track pad style scrolling & slider edit. - - memory: add a way to discard allocs of unused/transient windows. with the current architecture new windows (including popup, opened combos, listbox) perform at least 3 allocs. - misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL) - misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon? - style editor: have a more global HSV setter (e.g. alter hue on all elements). consider replacing active/hovered by offset in HSV space? - style editor: color child window height expressed in multiple of line height. +!- examples: directx9/directx11: resizing window duplicate the font data :( + - optimization: use another hash function than crc32, e.g. FNV1a - optimization/render: merge command-lists with same clip-rect into one even if they aren't sequential? (as long as in-between clip rectangle don't overlap)? - optimization: turn some the various stack vectors into statically-sized arrays - optimization: better clipping for multi-component widgets From 1c69b3d0df3b1e9ebb38776db0b9e616da87f5e1 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 12 Oct 2015 13:13:00 +0200 Subject: [PATCH 09/10] Tools: binary_to_compressed_c.cpp: added -nocompress option. --- extra_fonts/binary_to_compressed_c.cpp | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/extra_fonts/binary_to_compressed_c.cpp b/extra_fonts/binary_to_compressed_c.cpp index 34411a0d..a9b3b77f 100644 --- a/extra_fonts/binary_to_compressed_c.cpp +++ b/extra_fonts/binary_to_compressed_c.cpp @@ -18,21 +18,23 @@ typedef unsigned int stb_uint; typedef unsigned char stb_uchar; stb_uint stb_compress(stb_uchar *out,stb_uchar *in,stb_uint len); -static bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_base85_encoding); +static bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_base85_encoding, bool use_compression); int main(int argc, char** argv) { if (argc < 3) { - printf("Syntax: %s [-base85] \n", argv[0]); + printf("Syntax: %s [-base85] [-nocompress] \n", argv[0]); return 0; } int argn = 1; bool use_base85_encoding = false; + bool use_compression = true; if (argv[argn][0] == '-') { if (strcmp(argv[argn], "-base85") == 0) { use_base85_encoding = true; argn++; } + else if (strcmp(argv[argn], "-nocompress") == 0) { use_compression = false; argn++; } else { printf("Unknown argument: '%s'\n", argv[argn]); @@ -40,7 +42,7 @@ int main(int argc, char** argv) } } - binary_to_compressed_c(argv[argn], argv[argn+1], use_base85_encoding); + binary_to_compressed_c(argv[argn], argv[argn+1], use_base85_encoding, use_compression); return 1; } @@ -50,7 +52,7 @@ char Encode85Byte(unsigned int x) return (x>='\\') ? x+1 : x; } -bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_base85_encoding) +bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_base85_encoding, bool use_compression) { // Read file FILE* f = fopen(filename, "rb"); @@ -64,17 +66,19 @@ bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_b // Compress int maxlen = data_sz + 512 + (data_sz >> 2) + sizeof(int); // total guess - char* compressed = new char[maxlen]; - int compressed_sz = stb_compress((stb_uchar*)compressed, (stb_uchar*)data, data_sz); - memset(compressed + compressed_sz, 0, maxlen - compressed_sz); + char* compressed = use_compression ? new char[maxlen] : data; + int compressed_sz = use_compression ? stb_compress((stb_uchar*)compressed, (stb_uchar*)data, data_sz) : data_sz; + if (use_compression) + memset(compressed + compressed_sz, 0, maxlen - compressed_sz); // Output as Base85 encoded FILE* out = stdout; fprintf(out, "// File: '%s' (%d bytes)\n", filename, (int)data_sz); fprintf(out, "// Exported using binary_to_compressed_c.cpp\n"); + const char* compressed_str = use_compression ? "compressed_" : ""; if (use_base85_encoding) { - fprintf(out, "static const char %s_compressed_data_base85[%d+1] =\n \"", symbol, (int)((compressed_sz+3)/4)*5); + fprintf(out, "static const char %s_%sdata_base85[%d+1] =\n \"", symbol, compressed_str, (int)((compressed_sz+3)/4)*5); int column = 0; for (int i = 0; i < compressed_sz; i += 4) { @@ -87,8 +91,8 @@ bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_b } else { - fprintf(out, "static const unsigned int %s_compressed_size = %d;\n", symbol, (int)compressed_sz); - fprintf(out, "static const unsigned int %s_compressed_data[%d/4] =\n{", symbol, (int)((compressed_sz+3)/4)*4); + fprintf(out, "static const unsigned int %s_%ssize = %d;\n", symbol, compressed_str, (int)compressed_sz); + fprintf(out, "static const unsigned int %s_%sdata[%d/4] =\n{", symbol, compressed_str, (int)((compressed_sz+3)/4)*4); int column = 0; for (int i = 0; i < compressed_sz; i += 4) { @@ -103,7 +107,8 @@ bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_b // Cleanup delete[] data; - delete[] compressed; + if (use_compression) + delete[] compressed; return true; } From 5d53f37a5d760db532755571e8d92cdd261c5d4b Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 13 Oct 2015 17:53:43 +0200 Subject: [PATCH 10/10] Examples: Possibly clarified the intent of imgui_impl_* files. --- examples/allegro5_example/imgui_impl_a5.cpp | 3 +++ examples/allegro5_example/imgui_impl_a5.h | 3 +++ examples/directx11_example/imgui_impl_dx11.cpp | 3 +++ examples/directx11_example/imgui_impl_dx11.h | 3 +++ examples/directx9_example/imgui_impl_dx9.cpp | 3 +++ examples/directx9_example/imgui_impl_dx9.h | 3 +++ examples/ios_example/README.md | 6 ++---- examples/opengl3_example/imgui_impl_glfw_gl3.cpp | 3 +++ examples/opengl3_example/imgui_impl_glfw_gl3.h | 3 +++ examples/opengl_example/imgui_impl_glfw.cpp | 3 +++ examples/opengl_example/imgui_impl_glfw.h | 3 +++ examples/sdl_opengl_example/imgui_impl_sdl.cpp | 3 +++ examples/sdl_opengl_example/imgui_impl_sdl.h | 3 +++ 13 files changed, 38 insertions(+), 4 deletions(-) diff --git a/examples/allegro5_example/imgui_impl_a5.cpp b/examples/allegro5_example/imgui_impl_a5.cpp index b5dd7439..8faa332c 100644 --- a/examples/allegro5_example/imgui_impl_a5.cpp +++ b/examples/allegro5_example/imgui_impl_a5.cpp @@ -1,4 +1,7 @@ // ImGui Allegro 5 bindings +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui // by @birthggd diff --git a/examples/allegro5_example/imgui_impl_a5.h b/examples/allegro5_example/imgui_impl_a5.h index a6cda1c0..ec10fff1 100644 --- a/examples/allegro5_example/imgui_impl_a5.h +++ b/examples/allegro5_example/imgui_impl_a5.h @@ -1,4 +1,7 @@ // ImGui Allegro 5 bindings +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui // by @birthggd diff --git a/examples/directx11_example/imgui_impl_dx11.cpp b/examples/directx11_example/imgui_impl_dx11.cpp index cf862995..6e7f1944 100644 --- a/examples/directx11_example/imgui_impl_dx11.cpp +++ b/examples/directx11_example/imgui_impl_dx11.cpp @@ -1,4 +1,7 @@ // ImGui Win32 + DirectX11 binding +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui #include diff --git a/examples/directx11_example/imgui_impl_dx11.h b/examples/directx11_example/imgui_impl_dx11.h index a36bfd68..e5d44600 100644 --- a/examples/directx11_example/imgui_impl_dx11.h +++ b/examples/directx11_example/imgui_impl_dx11.h @@ -1,4 +1,7 @@ // ImGui Win32 + DirectX11 binding +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui struct ID3D11Device; diff --git a/examples/directx9_example/imgui_impl_dx9.cpp b/examples/directx9_example/imgui_impl_dx9.cpp index b8186329..1e7c7900 100644 --- a/examples/directx9_example/imgui_impl_dx9.cpp +++ b/examples/directx9_example/imgui_impl_dx9.cpp @@ -1,4 +1,7 @@ // ImGui Win32 + DirectX9 binding +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui #include diff --git a/examples/directx9_example/imgui_impl_dx9.h b/examples/directx9_example/imgui_impl_dx9.h index 99075e53..608626fb 100644 --- a/examples/directx9_example/imgui_impl_dx9.h +++ b/examples/directx9_example/imgui_impl_dx9.h @@ -1,4 +1,7 @@ // ImGui Win32 + DirectX9 binding +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui struct IDirect3DDevice9; diff --git a/examples/ios_example/README.md b/examples/ios_example/README.md index 5b51b905..a2ada955 100644 --- a/examples/ios_example/README.md +++ b/examples/ios_example/README.md @@ -1,14 +1,14 @@ # iOS example ----- ## Introduction This example is the default XCode "OpenGL" example code, modified to support ImGui and [Synergy](http://synergy-project.org/). +It is a rather complex example because of all of the faff required to get an XCode/iOS application running. Refer to the regular OpenGL examples if you want to learn about integrating ImGui. + Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImGui without it. Synergy includes a "uSynergy" library that allows embedding a synergy client, this is what is used here. ImGui supports "TouchPadding", and this is enabled when Synergy is not active. ## How to Use ----- 0. In Synergy, go to Preferences, and uncheck "Use SSL encryption" 0. Run the example app. @@ -16,7 +16,6 @@ Synergy (remote keyboard/mouse) is not required, but it's pretty hard to use ImG 0. Enter the name or the IP of your synergy host 0. If you had previously connected to a server, you may need to kill and re-start the app. ----- ## Notes and TODOs Things that would be nice but I didn't get around to doing: @@ -26,7 +25,6 @@ Things that would be nice but I didn't get around to doing: * Graceful disconnect/reconnect from uSynergy. * Copy/Paste not well-supported ----- ## C++ on iOS ImGui is a c++ library. If you want to include it directly, rename your Obj-C file to have the ".mm" extension. diff --git a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp index d111b76a..0b5b658b 100644 --- a/examples/opengl3_example/imgui_impl_glfw_gl3.cpp +++ b/examples/opengl3_example/imgui_impl_glfw_gl3.cpp @@ -1,4 +1,7 @@ // ImGui GLFW binding with OpenGL3 + shaders +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui #include diff --git a/examples/opengl3_example/imgui_impl_glfw_gl3.h b/examples/opengl3_example/imgui_impl_glfw_gl3.h index edec71c3..33e01c30 100644 --- a/examples/opengl3_example/imgui_impl_glfw_gl3.h +++ b/examples/opengl3_example/imgui_impl_glfw_gl3.h @@ -1,4 +1,7 @@ // ImGui GLFW binding with OpenGL3 + shaders +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui struct GLFWwindow; diff --git a/examples/opengl_example/imgui_impl_glfw.cpp b/examples/opengl_example/imgui_impl_glfw.cpp index 27625e7e..3e06e4b9 100644 --- a/examples/opengl_example/imgui_impl_glfw.cpp +++ b/examples/opengl_example/imgui_impl_glfw.cpp @@ -1,4 +1,7 @@ // ImGui GLFW binding with OpenGL +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui #include diff --git a/examples/opengl_example/imgui_impl_glfw.h b/examples/opengl_example/imgui_impl_glfw.h index 35088f0e..05fe6b05 100644 --- a/examples/opengl_example/imgui_impl_glfw.h +++ b/examples/opengl_example/imgui_impl_glfw.h @@ -1,4 +1,7 @@ // ImGui GLFW binding with OpenGL +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui struct GLFWwindow; diff --git a/examples/sdl_opengl_example/imgui_impl_sdl.cpp b/examples/sdl_opengl_example/imgui_impl_sdl.cpp index 5d7c44a3..aed5881b 100644 --- a/examples/sdl_opengl_example/imgui_impl_sdl.cpp +++ b/examples/sdl_opengl_example/imgui_impl_sdl.cpp @@ -1,4 +1,7 @@ // ImGui SDL2 binding with OpenGL +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui #include diff --git a/examples/sdl_opengl_example/imgui_impl_sdl.h b/examples/sdl_opengl_example/imgui_impl_sdl.h index 1edd8980..cef9817c 100644 --- a/examples/sdl_opengl_example/imgui_impl_sdl.h +++ b/examples/sdl_opengl_example/imgui_impl_sdl.h @@ -1,4 +1,7 @@ // ImGui SDL2 binding with OpenGL +// You can copy and use unmodified imgui_impl_* files in your project. +// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). +// See main.cpp for an example of using this. // https://github.com/ocornut/imgui struct SDL_Window;