Repository navigation
Dear ImGui 1.93.1, touch screens through ImGuiTouch, callbacks that add instead of replace, and a window that follows a monitor's change of scale on Windows (opt-in). There was no v1.93.0 of Hello ImGui: this release follows v1.92.901.
Breaking changes
- The CMake package is
hello_imgui:find_package(hello_imgui)andhello_imgui::hello_imguireplacefind_package(hello-imgui)andhello-imgui::hello_imgui.- The former name still works, through a deprecated shim, to be removed later.
- The config files are in
lib/cmake/hello_imgui/, wherefind_packagefinds them without vcpkg's fixup. - The vcpkg port keeps its name,
hello-imgui(vcpkg forbids underscores).
Dear ImGui 1.93.1
- Hello ImGui follows Dear ImGui 1.93.1 (docking branch).
- On iOS, its SDL2 backend opens the on-screen keyboard: the runner's own call stays for older versions only.
Touch screens
The touch layer comes from imgui_touch, and the wheel session from imgui_kit. Both are vendored in external/, or come from the app's own targets. The settings are one field, RunnerParams::touchConfig (an ImGuiTouchConfig). What a finger does:
- A drag scrolls the window, with inertia after the release and a bounce at the end, as on a phone. A tap still clicks, two taps are a double click, and a short hold then a drag goes to the widget (a slider, a text selection).
touchConfig.ScrollMode:Auto(on a touch screen),Always(also with the mouse, to try it on a desktop) orDisabled. Demo:hello_touch_scroll. - The scroll bars are thin (0.3 em, rounded) while the pointer is a finger:
touchConfig.ThinScrollbars. A swipe that starts on a bar scrolls the content with the finger. - A long press is a right click (the context menus):
touchConfig.LongPressIsRightClick. A ring around the finger shows when the lift will right click. - Two fingers on a widget zoom and pan it, when the widget claims them:
ImGuiTouch::ItemPinch(), or for a widget that zooms with the wheel,SetItemPinchAsWheel()andSetItemTwoFingerPanAsMouseDrag(). Elsewhere, a pinch scales the font (touchConfig.PinchScalesFont). - A widget dragged by a finger at once:
SetItemTakesTouchDrags(), right after the widget (a plot, a canvas), takes the press in every direction, without the hold. - The delays:
touchConfig.HoldSeconds(0.15) andLongPressSeconds(0.5).
Where:
- In the browser:
SetTapOpensUrl(rectMin, rectMax, url): a tap on a rectangle opens a link in a new tab, with a mouse too, and on desktop Safari. It returns true when the page takes the link;- the phone's virtual keyboard: an active text widget shows a keyboard button next to it, and the full-screen windows keep out of the keyboard (
ImGuiTouch::GetKeyboardInsets()); - ImGui learns whether the pointer is a mouse, a finger or a pen.
- In a native app, through SDL2 (a Windows touch laptop, iOS, Android): the runner forwards the fingers, for the pinch and the two-finger drag. GLFW reports no fingers.
- iOS: the app fills the screen (a launch screen in the Info.plist template), and the keyboard opens when a widget wants text.
- Android: the app runs where the display has no multisampled surface (the emulator), and the generated Android Studio project builds with a current JDK (Gradle 8.9, AGP 8.5.2, minSdk 21).
The mouse wheel
- The wheel stays with the window it scrolls, as in a browser: a page scrolled with the wheel keeps scrolling when a plot passes under the mouse, and the plot does not zoom. A wheel that starts on the plot zooms it.
- A widget of your own that reads the wheel claims it while hovered:
if (ImGui::SetItemKeyOwner(ImGuiKey_MouseWheelY)) zoom *= powf(1.1f, ImGui::GetIO().MouseWheel);. RunnerParams::wheelSession(true by default): false gives Dear ImGui's own behavior.
Callbacks that add instead of replace
RunnerCallbacks::AddCallback(slot, callback, owner)adds a callback beside the app's own, in 14 slots (CallbackSlot): a latercallbacks.PostInit = freplaces only the app's function.- They run before the app's in the setup slots and in
PreNewFrame, after it elsewhere, in reverse order in the exit slots (CallbackOrder::Before/Afterto choose).RemoveCallback(id),RemoveCallbacks(owner). CallSoon(f, afterFrames = 1)calls a function once, on a later frame.CallLater(f, seconds)calls it after a delay: an idling app wakes up for it.
A monitor with another scale (Windows, opt-in)
- With
appWindowParams.windowGeometry.followMonitorScale = true(GLFW), the window keeps its size relative to its content when it moves to a monitor with another scale: Windows resizes it, and the fonts and the style follow. The content is redrawn once during a drag, when the window reaches the other monitor. - Off by default: the window keeps its size in pixels, as before. With SDL, the flag does nothing (imgui_bundle#516).
Themes
- In the 14 Hello ImGui themes, a hover or a press shows, and text reads on a hovered or pressed item (3:1). The slider grab, at rest and held, and the check mark stand out from their frame (3:1). Dear ImGui's own three styles are unchanged.
- The theme tweaks keep each color's components in [0, 1]: harmless on screen, but wrong in an exported style.
Other novelties
HelloImGui::PrefersReducedMotion(): the system asks for less motion ("Reduce motion" on macOS and iOS, a browser'sprefers-reduced-motion...).- Hidden windows for tests: with
HELLOIMGUI_TEST_HIDDEN_WINDOWS=1, every window stays hidden, while the app still renders and the test engine drives it. - Idling: a mouse button or a finger held down keeps the app awake.
- plutosvg and plutovg are git submodules (plutosvg v0.0.8, plutovg v1.3.3), no longer downloaded at configure time: the release archives are complete.
HELLOIMGUI_USE_SYSTEM_PLUTOSVGlinks an installed plutosvg (for packagers).
Fixes
- Windows:
- a borderless full-screen window with
borderlessResizablekeeps its size when it is minimized and restored (#171); main()gets the command line in an app made withhello_imgui_add_app;- borderless windows: no resize handle in full screen, and the handle follows a slow drag;
- DirectX 11 and 12: the image follows a resized window, and the mouse lines up at a display scale other than 100%. The swapchain kept its first size, and Windows stretched the image.
- a borderless full-screen window with
- macOS: an app starts while the display sleeps (no monitor reported). It crashed.
- SDL: the DPI factor comes from the window's display, not from display 0.
- Safari: the canvas follows the page zoom.
- Ini settings:
LoadUserPrefgives back the value as saved (it gained a newline from the second run on), and a value with lines that look like the file's markers comes back intact;- a malformed
hello_imgui.inino longer stops the app at each start.
- Running twice with the same
RunnerParams(a notebook cell run again): the DPI factor is measured again,appShallExitis reset. - Install:
nlohmann/json.hppandjson_fwd.hppgo intoinclude/nlohmann;imgui_stdlib.his also at Dear ImGui's own path (include/misc/cpp/imgui_stdlib.h). - TearDown: no final screenshot when no frame was rendered (an app stopped right after its setup).
- The log window: its level buttons read on every theme.
- The GLFW fallback download: 3.5.1, instead of 3.3.8.