mirror of
https://github.com/ocornut/imgui.git
synced 2026-08-27 09:31:49 +00:00
Tweaks.
This commit is contained in:
@@ -1747,7 +1747,7 @@ static void DemoWindowWidgetsDragAndDrop()
|
||||
|
||||
if (ImGui::IsItemActive() && !ImGui::IsItemHovered())
|
||||
{
|
||||
int n_next = n + (ImGui::GetMouseDragDelta(0).y < 0.f ? -1 : 1);
|
||||
int n_next = n + (ImGui::GetMouseDragDelta(0).y < 0.0f ? -1 : 1);
|
||||
if (n_next >= 0 && n_next < IM_COUNTOF(item_names))
|
||||
{
|
||||
item_names[n] = item_names[n_next];
|
||||
@@ -2201,7 +2201,7 @@ static void DemoWindowWidgetsProgressBars()
|
||||
|
||||
char buf[32];
|
||||
sprintf(buf, "%d/%d", (int)(progress * 1753), 1753);
|
||||
ImGui::ProgressBar(progress, ImVec2(0.f, 0.f), buf);
|
||||
ImGui::ProgressBar(progress, ImVec2(0.0f, 0.0f), buf);
|
||||
|
||||
// Pass an animated negative value, e.g. -1.0f * (float)ImGui::GetTime() is the recommended value.
|
||||
// Adjust the factor if you want to adjust the animation speed.
|
||||
@@ -9094,7 +9094,7 @@ struct ExampleAppConsole
|
||||
static int Stricmp(const char* s1, const char* s2) { int d; while ((d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; } return d; }
|
||||
static int Strnicmp(const char* s1, const char* s2, int n) { int d = 0; while (n > 0 && (d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; n--; } return d; }
|
||||
static char* Strdup(const char* s) { IM_ASSERT(s); size_t len = strlen(s) + 1; void* buf = ImGui::MemAlloc(len); IM_ASSERT(buf); return (char*)memcpy(buf, (const void*)s, len); }
|
||||
static void Strtrim(char* s) { char* str_end = s + strlen(s); while (str_end > s && str_end[-1] == ' ') str_end--; *str_end = 0; }
|
||||
static void Strtrimblanks(char* s) { char* str_end = s + strlen(s); while (str_end > s && str_end[-1] == ' ') str_end--; *str_end = 0; }
|
||||
|
||||
void ClearLog()
|
||||
{
|
||||
@@ -9243,10 +9243,10 @@ struct ExampleAppConsole
|
||||
if (ImGui::InputText("Input", InputBuf, IM_COUNTOF(InputBuf), input_text_flags, &TextEditCallbackStub, (void*)this))
|
||||
{
|
||||
char* s = InputBuf;
|
||||
Strtrim(s);
|
||||
Strtrimblanks(s);
|
||||
if (s[0])
|
||||
ExecCommand(s);
|
||||
strcpy(s, "");
|
||||
s[0] = 0;
|
||||
reclaim_focus = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user