mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2024-11-27 20:20:40 +00:00
Use literals in place of LLONG_MIN, LLONG_MAX ULLONG_MAX if they are not available. Amend 498c0dcb4c
. We prefer using the defines if available in limits.h because they somehow tend to work without warnings when enabling strict C++03 compilation. The 3 literals are fallbacks.. (#1926).
This commit is contained in:
parent
0905202f44
commit
9d8a0374d3
@ -852,10 +852,19 @@ static const ImS32 IM_S32_MIN = INT_MIN; // (-2147483647 - 1), (0x80000000);
|
||||
static const ImS32 IM_S32_MAX = INT_MAX; // (2147483647), (0x7FFFFFFF)
|
||||
static const ImU32 IM_U32_MIN = 0;
|
||||
static const ImU32 IM_U32_MAX = UINT_MAX; // (0xFFFFFFFF)
|
||||
#ifdef LLONG_MIN
|
||||
static const ImS64 IM_S64_MIN = LLONG_MIN; // (-9223372036854775807ll - 1ll);
|
||||
static const ImS64 IM_S64_MAX = LLONG_MAX; // (9223372036854775807ll);
|
||||
#else
|
||||
static const ImS64 IM_S64_MIN = -9223372036854775807LL - 1;
|
||||
static const ImS64 IM_S64_MAX = 9223372036854775807LL;
|
||||
#endif
|
||||
static const ImU64 IM_U64_MIN = 0;
|
||||
#ifdef ULLONG_MAX
|
||||
static const ImU64 IM_U64_MAX = ULLONG_MAX; // (0xFFFFFFFFFFFFFFFFull);
|
||||
#else
|
||||
static const ImU64 IM_U64_MAX = (2ULL * 9223372036854775807LL + 1);
|
||||
#endif
|
||||
|
||||
// When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch.
|
||||
static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the highlight and screen dimming starts fading in
|
||||
|
@ -1022,14 +1022,25 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
if (ImGui::TreeNode("Data Types"))
|
||||
{
|
||||
// The DragScalar, InputScalar, SliderScalar functions allow manipulating most common data types: signed/unsigned int/long long and float/double
|
||||
// To avoid polluting the public API with all possible combinations, we use the ImGuiDataType enum to pass the type, and argument-by-values are turned into argument-by-address.
|
||||
// The DragScalar/InputScalar/SliderScalar functions allow various data types: signed/unsigned int/long long and float/double
|
||||
// To avoid polluting the public API with all possible combinations, we use the ImGuiDataType enum to pass the type,
|
||||
// and passing all arguments by address.
|
||||
// This is the reason the test code below creates local variables to hold "zero" "one" etc. for each types.
|
||||
// In practice, if you frequently use a given type that is not covered by the normal API entry points, you may want to wrap it yourself inside a 1 line function
|
||||
// which can take typed values argument instead of void*, and then pass their address to the generic function. For example:
|
||||
// bool SliderU64(const char *label, u64* value, u64 min = 0, u64 max = 0, const char* format = "%lld") { return SliderScalar(label, ImGuiDataType_U64, value, &min, &max, format); }
|
||||
// Below are helper variables we can take the address of to work-around this:
|
||||
// In practice, if you frequently use a given type that is not covered by the normal API entry points, you can wrap it
|
||||
// yourself inside a 1 line function which can take typed argument as value instead of void*, and then pass their address
|
||||
// to the generic function. For example:
|
||||
// bool MySliderU64(const char *label, u64* value, u64 min = 0, u64 max = 0, const char* format = "%lld")
|
||||
// {
|
||||
// return SliderScalar(label, ImGuiDataType_U64, value, &min, &max, format);
|
||||
// }
|
||||
|
||||
// Limits (as helper variables that we can take the address of)
|
||||
// Note that the SliderScalar function has a maximum usable range of half the natural type maximum, hence the /2 below.
|
||||
#ifndef LLONG_MIN
|
||||
ImS64 LLONG_MIN = -9223372036854775807LL - 1;
|
||||
ImS64 LLONG_MAX = 9223372036854775807LL;
|
||||
ImU64 ULLONG_MAX = (2ULL * 9223372036854775807LL + 1);
|
||||
#endif
|
||||
const ImS32 s32_zero = 0, s32_one = 1, s32_fifty = 50, s32_min = INT_MIN/2, s32_max = INT_MAX/2, s32_hi_a = INT_MAX/2 - 100, s32_hi_b = INT_MAX/2;
|
||||
const ImU32 u32_zero = 0, u32_one = 1, u32_fifty = 50, u32_min = 0, u32_max = UINT_MAX/2, u32_hi_a = UINT_MAX/2 - 100, u32_hi_b = UINT_MAX/2;
|
||||
const ImS64 s64_zero = 0, s64_one = 1, s64_fifty = 50, s64_min = LLONG_MIN/2, s64_max = LLONG_MAX/2, s64_hi_a = LLONG_MAX/2 - 100, s64_hi_b = LLONG_MAX/2;
|
||||
|
Loading…
Reference in New Issue
Block a user