ocornut / imgui_club Goto Github PK
View Code? Open in Web Editor NEWNice things to use along dear imgui
License: MIT License
Nice things to use along dear imgui
License: MIT License
From @simuuz
ocornut/imgui#3488 (comment)
The reason for me making it from scratch is that the memory watcher extension for ImGui dies when feeding him with address spaces that are larger than 24 bit (IIRC, at least that's what has happened to me and some other emulator developers), and since the GBA has an address space that ranges from 28 to 32 bit, here I am :3
I answered
I haven't tried but I am assuming that there'll be an issue with floating point precision with large scroll amount. I don't know how you'd intend to solve it but whatever the solution (maybe implementing custom scroll bar + virtualizing position) it would be worth implementing it in the existing memory editor..
(let's resume this discussion in imgui_club issue tracker)
When using MemoryEditor
as last item inside an existing window, with edit.OptShowOptions = false;
and #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
it asserts (on Code uses SetCursorPos()/SetCursorScreenPos() to extend window/parent boundaries. Please submit an item e.g. Dummy() to validate extent.
).
Version: v1.90.3-docking
Backend: imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
Compiler/OS: Win10 22H2 + MSVC 2022 (17.7.4)
Full config/build information:
Dear ImGui 1.90.3 (19030)
--------------------------------
sizeof(size_t): 4, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS
define: IMGUI_DISABLE_OBSOLETE_KEYIO
define: _WIN32
define: _MSC_VER=1900
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_vulkan
io.ConfigFlags: 0x00000443
NavEnableKeyboard
NavEnableGamepad
DockingEnable
ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000140E
HasMouseCursors
HasSetMousePos
PlatformHasViewports
RendererHasVtxOffset
RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1280.00,720.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00
To reproduce:
imgui_memory_editor.h
from ea49dd3 and drop it next to imgui.h
Another Window
Patch :
$ git diff
diff --git a/examples/example_glfw_vulkan/main.cpp b/examples/example_glfw_vulkan/main.cpp
index c852e5f4d..ad5227295 100644
--- a/examples/example_glfw_vulkan/main.cpp
+++ b/examples/example_glfw_vulkan/main.cpp
@@ -16,6 +16,7 @@
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_vulkan.h"
+#include "imgui_memory_editor.h"
#include <stdio.h> // printf, fprintf
#include <stdlib.h> // abort
#define GLFW_INCLUDE_NONE
@@ -535,10 +536,15 @@ int main(int, char**)
// 3. Show another simple window.
if (show_another_window)
{
+ static MemoryEditor edit;
+ static unsigned char data[100];
+ edit.OptShowOptions = false;
+
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
+ edit.DrawContents(data, sizeof data, 0);
ImGui::End();
}
diff --git a/imconfig.h b/imconfig.h
index d556cbaf1..13166d820 100644
--- a/imconfig.h
+++ b/imconfig.h
@@ -27,7 +27,7 @@
//#define IMGUI_API __declspec( dllimport )
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
-//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
+#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87+ disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This is automatically done by IMGUI_DISABLE_OBSOLETE_FUNCTIONS.
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
Can you add a license to the repository (preferably MIT)?
It would be a great improvement if the memory editor could consume key presses like up, down, left, right, Home, End, PgUp and PgDown when the widget has the focus (contextual key binding).
Steps to reproduce:
Current behaviour:
Keys trigger navigation actions (right), but also game/app actions (wrong).
Expected behaviour:
Any key event that is handle by a window should be consumed and not passed on to the main window.
A user can double-click the Columns DragInt and can set Cols outside the (4, 32) range.
Setting Cols to 0 (or less) is pathological and causes a divide-by-zero later.
Suggest this fix
if (ImGui::DragInt("##cols", &Cols, 0.2f, 4, 32, "%d cols"))
{
if (Cols <= 0) Cols = 1; // Crashproofing
ContentsWidthChanged = true;
}
I just noticed a weird (new?) behaviour which I didn't notice when I started using the imgui_memory_editor:
When I'm clicking a number to start editing, and the click takes a bit longer, the focus isn't taken, so editing doesn't start. Only when "short-tapping" through a touchpad it seems to work.
I had to replace the IsMouseClicked(0) here:
...with IsMouseReleased(0)
. This always seems to work, both with "short taps" and "long clicks", but I don't understand why.
Is anybody else seeing this too? Could this be caused by a change of behaviour in newer ImGui versions?
When i set memory_size 0xFFFF_FFFF, slider is not visible. GoTo address is not working.
TLDR: I can't get the memory editor to 'edit' anything, and I am unsure how to debug this.
Observed issue: When selecting a byte (both in the hex or ascii columns) the byte is briefly selected, after which the selection seems to get lost again?
See screen recording:
This occurs in a (minimally) edited branch of Dear ImGui, details:
Version: v1.90.3-docking
Backend: imgui_impl_glfw.cpp + imgui_impl_vulkan.cpp
Compiler/OS: Win10 22H2 + MSVC 2022 (17.7.4)
Full config/build information:
Dear ImGui 1.90.3 (19030)
--------------------------------
sizeof(size_t): 4, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS
define: IMGUI_DISABLE_OBSOLETE_KEYIO
define: _WIN32
define: _MSC_VER=1900
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_vulkan
io.ConfigFlags: 0x00000443
NavEnableKeyboard
NavEnableGamepad
DockingEnable
ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000140E
HasMouseCursors
HasSetMousePos
PlatformHasViewports
RendererHasVtxOffset
RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1280.00,720.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00
To reproduce:
imgui_memory_editor.h
from ea49dd3 and drop it next to imgui.h
Another Window
Patch :
$ git diff
diff --git a/examples/example_glfw_vulkan/main.cpp b/examples/example_glfw_vulkan/main.cpp
index c852e5f4d..47dd787c6 100644
--- a/examples/example_glfw_vulkan/main.cpp
+++ b/examples/example_glfw_vulkan/main.cpp
@@ -16,6 +16,7 @@
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_vulkan.h"
+#include "imgui_memory_editor.h"
#include <stdio.h> // printf, fprintf
#include <stdlib.h> // abort
#define GLFW_INCLUDE_NONE
@@ -539,6 +540,9 @@ int main(int, char**)
ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
+ static MemoryEditor edit;
+ static unsigned char data[100];
+ edit.DrawContents(data, sizeof data);
ImGui::End();
}
Would be good to use nav logic or implement.
Newly introduced input ownership system should allow to do a mix of both.
Hi! Thank you so much for such a thing as ImGui and thank you so much for the large number of examples and various ready-made widgets/snippets!
Is multiselect of bytes support planned here? Something like this ocornut/imgui#1861
I'm using this handy utility for my disassembler/debugger thanks. Very pleased this exists, but I'm intrigued by your comment:
// - This is generally old/crappy code, it should work but isn't very good.. to be rewritten some day.
It would be great to hear what you have in mind.
Thanks again for ImGui. Unbelievably liberating.
I think it'll be better for organizing if all of the plugins had each their own repositories, then this repository can include them as git submodules, this way all of the plugins can be downloaded in a batch using this repo or each plugin can be downloaded separately from their own repos using git clone
I am new to GitHub and am not yet sure how to upload a suggested code change. Thus I've just provided it as an issue:
I fixed this for my purposes but it is a breakings change. On the other hand it now seems to match your overall system for handling window closing.
Clicking close window 'X' on DrawWindow() doesn't close the window.
Fix as follows:
Add bool* p_open to parameter list of DrawOpen on line 188 as follows:
Line 188 void DrawWindow(bool* p_open, const char* title, void* mem_data, size_t mem_size, size_t base_display_addr = 0x0000)
Change Lines 195 as follows: (replace &Open with p_open)
if (ImGui::Begin(title, &Open, ImGuiWindowFlags_NoScrollbar))
if (ImGui::Begin(title, p_open, ImGuiWindowFlags_NoScrollbar))
You could remove boolean Open from the remainder of the file.
Brad
Hi,
I'm trying to compile imgui_freetype with dear_imgui version 1.51 but I'm getting a few errors.
One of which indicates that ImFontAtlasBuildRegisterDefaultCustomRects(atlas) could not be found which lets me believe this function existed in a previous version of dear_imgui but I might be wrong as I don't see any mention of it in API changelog.
The other errors are the same but for other variables or function calls.
I was just wondering if I was missing something obvious.
If my issue isn't clear enough please let me know.
Thanks in advance for your help
I'm using the vanilla library, I did not modify it whatsoever, yet, the scrollbar isn't getting drawn from what I can see. I hope I didn't just miss some detail thus wasting your time, and I hope we can eventually find the root of the problem, because it works in all the other projects that use this memory editor. I'm attaching a screenshot that shows the metrics and the memory editor widget:
Update: it is this problem #20 ๐ My address range occupies the entire 32-bit address space... (it is for a Nintendo 64 emulator). I guess I'm just going to try to modify the library and propose a solution. Sorry for wasting your time
Using the sample code given to recreate the issue. Then set the values to below 15 both data and size with enabled option data preview, will cause the crash when key pressed down arrow.
// Sample 12
static char data[12];
size_t data_size = 12;
// and
mem_edit_1.OptShowDataPreview = true
This was due to the function of DrawPreviewData(), the reason was due to the mem_size is greater than the addr. The partial fix I did at the very first line of the function is to set the max memory size of the address(highlight selected):
if (addr > mem_size) addr = mem_size;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.