mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
Moved DragScalar, InputScalar, SliderScalar to imgui.h as well as ImGuiDataType (#320, #643, #708, #1011)
This commit is contained in:
parent
c5fb929555
commit
8da0d42ef2
@ -63,13 +63,16 @@ Other Changes:
|
||||
- InputText: Fixed returning true when edition is canceled with ESC and the current buffer matches the initial value.
|
||||
- InputFloat,InputFloat2,InputFloat3,InputFloat4: Added variations taking a more flexible and consistent optional "const char* format" parameter instead of "int decimal_precision".
|
||||
This allow using custom formats to display values in scientific notation, and is generally more consistent with other API. Obsoleted functions using the optional "int decimal_precision" parameter. (#648)
|
||||
- Added DragScalar, DragScalarN: supports signed/unsigned, 32/64 bits, float/double data types. (#320, #643, #708, #1011)
|
||||
- Added InputScalar, InputScalarN: supports signed/unsigned, 32/64 bits, float/double data types. (#320, #643, #708, #1011)
|
||||
- Added SliderScalar, SliderScalarN: supports signed/unsigned, 32/64 bits, float/double data types. (#320, #643, #708, #1011)
|
||||
- DragFloat, DragInt: Cancel mouse tweak when current value is initially past the min/max boundaries and mouse is pushing in the same direction (keyboard/gamepad version already did this).
|
||||
- DragFloat, DragInt: Honor natural type limits (e.g. INT_MAX, FLT_MAX) instead of wrapping around. (#708, #320)
|
||||
- DragFloat, SliderFloat: Fixes to allow input of scientific notation numbers when using CTRL+Click to input the value. (~#648, #1011)
|
||||
- DragFloat, SliderFloat: Rounding-on-write uses the provided format string instead of parsing the precision from the string, which allows for finer uses of %e %g etc. (#648, #642)
|
||||
- DragFloat: Improved computation when using the power curve. Improved lost of input precision with very small steps. Added an assert than power-curve requires a min/max range. (~#642)
|
||||
- DragFloat: The 'power' parameter is only honored if the min/max parameter are also setup.
|
||||
- DragInt: Fixed handling of large integers (we previously passed data around internally as float, which reduced the range of valid integers).
|
||||
- DragInt, SliderInt: Fixed handling of large integers (we previously passed data around internally as float, which reduced the range of valid integers).
|
||||
- Nav: Fixed hovering a Selectable() with the mouse so that it update the navigation cursor (as it happened in the pre-1.60 navigation branch). (#787)
|
||||
- Style: Changed default style.DisplaySafeAreaPadding values from (4,4) to (3,3) so it is smaller than FramePadding and has no effect on main menu bar on a computer. (#1439)
|
||||
- Misc: Added IMGUI_CHECKVERSION() macro to compare version string and data structure sizes in order to catch issues with mismatching compilation unit settings. (#1695, #1769)
|
||||
@ -77,7 +80,6 @@ Other Changes:
|
||||
- Examples: Calling IMGUI_CHECKVERSION() in the main.cpp of every example application.
|
||||
- Examples: Allegro 5: Added support for 32-bit indices setup via defining ImDrawIdx, to avoid an unnecessary conversion (Allegro 5 doesn't support 16-bit indices).
|
||||
- Examples: Allegro 5: Renamed bindings from imgui_impl_a5.cpp to imgui_impl_allegro5.cpp.
|
||||
- Internal: DragScalar(), InputScalar() now support signed/unsigned, 32/64 bits, float/double data types. (#320, #643, #708, #1011)
|
||||
- Various minor fixes, tweaks, refactoring, comments.
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
1
TODO.txt
1
TODO.txt
@ -131,7 +131,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
||||
- slider: tint background based on value (e.g. v_min -> v_max, or use 0.0f either side of the sign)
|
||||
- slider: precision dragging
|
||||
- slider: step option (#1183)
|
||||
- slider: int data passing through a float
|
||||
- knob: rotating knob widget (#942)
|
||||
- drag float: up/down axis
|
||||
- drag float: added leeway on edge (e.g. a few invisible steps past the clamp limits)
|
||||
|
20
imgui.h
20
imgui.h
@ -80,6 +80,7 @@ typedef void* ImTextureID; // User data to identify a texture (this is
|
||||
typedef unsigned int ImGuiID; // Unique ID used by widgets (typically hashed from a stack of string)
|
||||
typedef unsigned short ImWchar; // Character for keyboard input/display
|
||||
typedef int ImGuiCol; // enum: a color identifier for styling // enum ImGuiCol_
|
||||
typedef int ImGuiDataType; // enum: a primary data type // enum ImGuiDataType_
|
||||
typedef int ImGuiDir; // enum: a cardinal direction // enum ImGuiDir_
|
||||
typedef int ImGuiCond; // enum: a condition for Set*() // enum ImGuiCond_
|
||||
typedef int ImGuiKey; // enum: a key identifier (ImGui-side enum) // enum ImGuiKey_
|
||||
@ -353,6 +354,8 @@ namespace ImGui
|
||||
IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d");
|
||||
IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d");
|
||||
IMGUI_API bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", const char* format_max = NULL);
|
||||
IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* v, float v_speed, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* v, int components, float v_speed, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
|
||||
// Widgets: Input with Keyboard
|
||||
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
||||
@ -366,6 +369,8 @@ namespace ImGui
|
||||
IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputDouble(const char* label, double* v, double step = 0.0f, double step_fast = 0.0f, const char* format = "%.6f", ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputScalar(const char* label, ImGuiDataType data_type, void* v, const void* step, const void* step_fast, const char* format = NULL, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* step, const void* step_fast, const char* format = NULL, ImGuiInputTextFlags extra_flags = 0);
|
||||
|
||||
// Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard. manually input values aren't clamped, can go off-bounds)
|
||||
// Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||
@ -378,8 +383,11 @@ namespace ImGui
|
||||
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = "%d");
|
||||
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = "%d");
|
||||
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format = "%d");
|
||||
IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format = "%d");
|
||||
IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
|
||||
// Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.)
|
||||
// Note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can the pass the address of a first float element out of a contiguous structure, e.g. &myvector.x
|
||||
@ -708,6 +716,18 @@ enum ImGuiDragDropFlags_
|
||||
#define IMGUI_PAYLOAD_TYPE_COLOR_3F "_COL3F" // float[3]: Standard type for colors, without alpha. User code may use this type.
|
||||
#define IMGUI_PAYLOAD_TYPE_COLOR_4F "_COL4F" // float[4]: Standard type for colors. User code may use this type.
|
||||
|
||||
// A primary data type
|
||||
enum ImGuiDataType_
|
||||
{
|
||||
ImGuiDataType_S32, // int
|
||||
ImGuiDataType_U32, // unsigned int
|
||||
ImGuiDataType_S64, // long long, __int64
|
||||
ImGuiDataType_U64, // unsigned long long, unsigned __int64
|
||||
ImGuiDataType_Float, // float
|
||||
ImGuiDataType_Double, // double
|
||||
ImGuiDataType_COUNT
|
||||
};
|
||||
|
||||
// A cardinal direction
|
||||
enum ImGuiDir_
|
||||
{
|
||||
|
@ -251,17 +251,6 @@ enum ImGuiPlotType
|
||||
ImGuiPlotType_Histogram
|
||||
};
|
||||
|
||||
enum ImGuiDataType
|
||||
{
|
||||
ImGuiDataType_S32, // int
|
||||
ImGuiDataType_U32, // unsigned int
|
||||
ImGuiDataType_S64, // long long / __int64
|
||||
ImGuiDataType_U64, // unsigned long long / unsigned __int64
|
||||
ImGuiDataType_Float,
|
||||
ImGuiDataType_Double,
|
||||
ImGuiDataType_COUNT
|
||||
};
|
||||
|
||||
enum ImGuiInputSource
|
||||
{
|
||||
ImGuiInputSource_None = 0,
|
||||
@ -1102,15 +1091,6 @@ namespace ImGui
|
||||
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
||||
|
||||
IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
|
||||
IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* v, float v_speed, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* v, int components, float v_speed, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f);
|
||||
|
||||
IMGUI_API bool InputScalar(const char* label, ImGuiDataType data_type, void* v, const void* step, const void* step_fast, const char* format = NULL, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* step, const void* step_fast, const char* format = NULL, ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
||||
IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* data_ptr, const char* format);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user