@ -369,6 +369,10 @@ CODE
When you are not sure about a old symbol or function name , try using the Search / Find function of your IDE to look for comments or references in all imgui files .
When you are not sure about a old symbol or function name , try using the Search / Find function of your IDE to look for comments or references in all imgui files .
You can read releases logs https : //github.com/ocornut/imgui/releases for more details.
You can read releases logs https : //github.com/ocornut/imgui/releases for more details.
- 2019 / 10 / 14 ( 1.74 ) - inputs : Fixed a miscalculation in the keyboard / mouse " typematic " repeat delay / rate calculation , used by keys and e . g . repeating mouse buttons as well as the GetKeyPressedAmount ( ) function .
if you were using a non - default value for io . KeyRepeatRate ( previous default was 0.250 ) , you can add + io . KeyRepeatDelay to it to compensate for the fix .
The function was triggering on : 0.0 and ( delay + rate * N ) where ( N > = 1 ) . Fixed formula responds to ( N > = 0 ) . Effectively it made io . KeyRepeatRate behave like it was set to ( io . KeyRepeatRate + io . KeyRepeatDelay ) .
If you never altered io . KeyRepeatRate nor used GetKeyPressedAmount ( ) this won ' t affect you .
- 2019 / 07 / 15 ( 1.72 ) - removed TreeAdvanceToLabelPos ( ) which is rarely used and only does SetCursorPosX ( GetCursorPosX ( ) + GetTreeNodeToLabelSpacing ( ) ) . Kept redirection function ( will obsolete ) .
- 2019 / 07 / 15 ( 1.72 ) - removed TreeAdvanceToLabelPos ( ) which is rarely used and only does SetCursorPosX ( GetCursorPosX ( ) + GetTreeNodeToLabelSpacing ( ) ) . Kept redirection function ( will obsolete ) .
- 2019 / 07 / 12 ( 1.72 ) - renamed ImFontAtlas : : CustomRect to ImFontAtlasCustomRect . Kept redirection typedef ( will obsolete ) .
- 2019 / 07 / 12 ( 1.72 ) - renamed ImFontAtlas : : CustomRect to ImFontAtlasCustomRect . Kept redirection typedef ( will obsolete ) .
- 2019 / 06 / 14 ( 1.72 ) - removed redirecting functions / enums names that were marked obsolete in 1.51 ( June 2017 ) : ImGuiCol_Column * , ImGuiSetCond_ * , IsItemHoveredRect ( ) , IsPosHoveringAnyWindow ( ) , IsMouseHoveringAnyWindow ( ) , IsMouseHoveringWindow ( ) , IMGUI_ONCE_UPON_A_FRAME . Grep this log for details and new names .
- 2019 / 06 / 14 ( 1.72 ) - removed redirecting functions / enums names that were marked obsolete in 1.51 ( June 2017 ) : ImGuiCol_Column * , ImGuiSetCond_ * , IsItemHoveredRect ( ) , IsPosHoveringAnyWindow ( ) , IsMouseHoveringAnyWindow ( ) , IsMouseHoveringWindow ( ) , IMGUI_ONCE_UPON_A_FRAME . Grep this log for details and new names .
@ -1206,7 +1210,7 @@ ImGuiIO::ImGuiIO()
MouseDoubleClickMaxDist = 6.0f ;
MouseDoubleClickMaxDist = 6.0f ;
for ( int i = 0 ; i < ImGuiKey_COUNT ; i + + )
for ( int i = 0 ; i < ImGuiKey_COUNT ; i + + )
KeyMap [ i ] = - 1 ;
KeyMap [ i ] = - 1 ;
KeyRepeatDelay = 0.2 50 f;
KeyRepeatDelay = 0.2 7 5f;
KeyRepeatRate = 0.050f ;
KeyRepeatRate = 0.050f ;
UserData = NULL ;
UserData = NULL ;
@ -4402,14 +4406,22 @@ bool ImGui::IsKeyDown(int user_key_index)
return g . IO . KeysDown [ user_key_index ] ;
return g . IO . KeysDown [ user_key_index ] ;
}
}
int ImGui : : CalcTypematicPressedRepeatAmount ( float t , float t_prev , float repeat_delay , float repeat_rate )
// t0 = previous time (e.g.: g.Time - g.IO.DeltaTime)
// t1 = current time (e.g.: g.Time)
// An event is triggered at:
// t = 0.0f t = repeat_delay, t = repeat_delay + repeat_rate*N
int ImGui : : CalcTypematicRepeatAmount ( float t0 , float t1 , float repeat_delay , float repeat_rate )
{
{
if ( t = = 0.0f )
if ( t 1 = = 0.0f )
return 1 ;
return 1 ;
if ( t < = repeat_delay | | repeat_rate < = 0.0f )
if ( t 0 > = t1 )
return 0 ;
return 0 ;
const int count = ( int ) ( ( t - repeat_delay ) / repeat_rate ) - ( int ) ( ( t_prev - repeat_delay ) / repeat_rate ) ;
if ( repeat_rate < = 0.0f )
return ( count > 0 ) ? count : 0 ;
return ( t0 < repeat_delay ) & & ( t1 > = repeat_delay ) ;
const int count_t0 = ( t0 < repeat_delay ) ? - 1 : ( int ) ( ( t0 - repeat_delay ) / repeat_rate ) ;
const int count_t1 = ( t1 < repeat_delay ) ? - 1 : ( int ) ( ( t1 - repeat_delay ) / repeat_rate ) ;
const int count = count_t1 - count_t0 ;
return count ;
}
}
int ImGui : : GetKeyPressedAmount ( int key_index , float repeat_delay , float repeat_rate )
int ImGui : : GetKeyPressedAmount ( int key_index , float repeat_delay , float repeat_rate )
@ -4419,7 +4431,7 @@ int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_r
return 0 ;
return 0 ;
IM_ASSERT ( key_index > = 0 & & key_index < IM_ARRAYSIZE ( g . IO . KeysDown ) ) ;
IM_ASSERT ( key_index > = 0 & & key_index < IM_ARRAYSIZE ( g . IO . KeysDown ) ) ;
const float t = g . IO . KeysDownDuration [ key_index ] ;
const float t = g . IO . KeysDownDuration [ key_index ] ;
return CalcTypematic Pressed RepeatAmount( t , t - g . IO . DeltaTime , repeat_delay , repeat_rate ) ;
return CalcTypematic RepeatAmount( t - g . IO . DeltaTime , t , repeat_delay , repeat_rate ) ;
}
}
bool ImGui : : IsKeyPressed ( int user_key_index , bool repeat )
bool ImGui : : IsKeyPressed ( int user_key_index , bool repeat )
@ -4471,7 +4483,7 @@ bool ImGui::IsMouseClicked(int button, bool repeat)
if ( repeat & & t > g . IO . KeyRepeatDelay )
if ( repeat & & t > g . IO . KeyRepeatDelay )
{
{
// FIXME: 2019/05/03: Our old repeat code was wrong here and led to doubling the repeat rate, which made it an ok rate for repeat on mouse hold.
// FIXME: 2019/05/03: Our old repeat code was wrong here and led to doubling the repeat rate, which made it an ok rate for repeat on mouse hold.
int amount = CalcTypematic Pressed RepeatAmount( t , t - g . IO . DeltaTime , g . IO . KeyRepeatDelay , g . IO . KeyRepeatRate * 0.5 f) ;
int amount = CalcTypematic RepeatAmount( t - g . IO . DeltaTime , t , g . IO . KeyRepeatDelay , g . IO . KeyRepeatRate * 0.5 0 f) ;
if ( amount > 0 )
if ( amount > 0 )
return true ;
return true ;
}
}
@ -8228,11 +8240,11 @@ float ImGui::GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode)
if ( mode = = ImGuiInputReadMode_Pressed ) // Return 1.0f when just pressed, no repeat, ignore analog input.
if ( mode = = ImGuiInputReadMode_Pressed ) // Return 1.0f when just pressed, no repeat, ignore analog input.
return ( t = = 0.0f ) ? 1.0f : 0.0f ;
return ( t = = 0.0f ) ? 1.0f : 0.0f ;
if ( mode = = ImGuiInputReadMode_Repeat )
if ( mode = = ImGuiInputReadMode_Repeat )
return ( float ) CalcTypematic Pressed RepeatAmount( t , t - g . IO . DeltaTime , g . IO . KeyRepeatDelay * 0. 80 f, g . IO . KeyRepeatRate * 0.80f ) ;
return ( float ) CalcTypematic RepeatAmount( t - g . IO . DeltaTime , t , g . IO . KeyRepeatDelay * 0. 72 f, g . IO . KeyRepeatRate * 0.80f ) ;
if ( mode = = ImGuiInputReadMode_RepeatSlow )
if ( mode = = ImGuiInputReadMode_RepeatSlow )
return ( float ) CalcTypematic Pressed RepeatAmount( t , t - g . IO . DeltaTime , g . IO . KeyRepeatDelay * 1. 00 f, g . IO . KeyRepeatRate * 2.00f ) ;
return ( float ) CalcTypematic RepeatAmount( t - g . IO . DeltaTime , t , g . IO . KeyRepeatDelay * 1. 25 f, g . IO . KeyRepeatRate * 2.00f ) ;
if ( mode = = ImGuiInputReadMode_RepeatFast )
if ( mode = = ImGuiInputReadMode_RepeatFast )
return ( float ) CalcTypematic Pressed RepeatAmount( t , t - g . IO . DeltaTime , g . IO . KeyRepeatDelay * 0. 80 f, g . IO . KeyRepeatRate * 0.30f ) ;
return ( float ) CalcTypematic RepeatAmount( t - g . IO . DeltaTime , t , g . IO . KeyRepeatDelay * 0. 72 f, g . IO . KeyRepeatRate * 0.30f ) ;
return 0.0f ;
return 0.0f ;
}
}