You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ImGui::Begin("Example Bug");
staticuint8_t valueA = 0;
staticuint32_t valueB = 0;
// Input -1 into the field and observe the resultint step = 1;
int fstep = 10;
SetNextItemWidth( 200.f );
InputScalar( "Test A", ImGuiDataType_U8, &valueA, &step, &fstep );
SetNextItemWidth( 200.f );
// Do the same, it will underflowInputScalar( "Test B", ImGuiDataType_U32, &valueB, &step, &fstep );
Text( "A: %u", valueA );
Text( "B: %u", valueB );
ImGui::End();
The text was updated successfully, but these errors were encountered:
ocornut
changed the title
Widgets(InputScalar): Inconsistent output behavior between smaller and bigger data types
InputScalar: Inconsistent output behavior between smaller and bigger data types
Dec 17, 2024
Version/Branch of Dear ImGui:
1.91 Docking
Back-ends:
imgui_impl_sdl2
Compiler, OS:
Windows 10, MSVC 2022
Full config/build information:
Details:
My Issue/Question:
InputScalar for data types smaller than 4 bytes is clamped to min/max values and it is not for bigger types.
https://github.com/ocornut/imgui/blob/master/imgui_widgets.cpp#L2285
Would be a nice feature if it behaved for all types the same it does for smaller types
Screenshots/Video:
inputScalar.mp4
I've stumbled upon it while building node widgets for a graph
The code for the widget can be viewed here, Result of the node is a sum of two values controlled by InputScalar
https://gist.github.com/Riztazz/c90d71bb35950186e00762ab320dbd73
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: