diff --git a/examples/imgui_impl_freeglut.cpp b/examples/imgui_impl_freeglut.cpp index b265226b4..8884905d0 100644 --- a/examples/imgui_impl_freeglut.cpp +++ b/examples/imgui_impl_freeglut.cpp @@ -97,7 +97,7 @@ void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y) //printf("char_down_func %d '%c'\n", c, c); ImGuiIO& io = ImGui::GetIO(); if (c >= 32) - io.AddInputCharacter(c); + io.AddInputCharacter((unsigned short)c); // Store letters in KeysDown[] array as both uppercase and lowercase + Handle GLUT translating CTRL+A..CTRL+Z as 1..26. // This is a hacky mess but GLUT is unable to distinguish e.g. a TAB key from CTRL+I so this is probably the best we can do here. diff --git a/examples/imgui_impl_osx.mm b/examples/imgui_impl_osx.mm index 07494d6d2..edfd45475 100644 --- a/examples/imgui_impl_osx.mm +++ b/examples/imgui_impl_osx.mm @@ -188,7 +188,7 @@ bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view) { int c = [str characterAtIndex:i]; if (c < 0xF700 && !io.KeyCtrl) - io.AddInputCharacter(c); + io.AddInputCharacter((unsigned short)c); // We must reset in case we're pressing a sequence of special keys while keeping the command pressed int key = mapCharacterToKey(c); diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 44e7d022d..56cbf33d0 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -2844,7 +2844,7 @@ static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* t if (c == '\r') continue; - const float char_width = font->GetCharAdvance((unsigned short)c) * scale; + const float char_width = font->GetCharAdvance((ImWchar)c) * scale; line_width += char_width; } @@ -3697,7 +3697,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 else { ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true); - if (rect_size.x <= 0.0f) rect_size.x = (float)(int)(g.Font->GetCharAdvance((unsigned short)' ') * 0.50f); // So we can see selected empty lines + if (rect_size.x <= 0.0f) rect_size.x = (float)(int)(g.Font->GetCharAdvance((ImWchar)' ') * 0.50f); // So we can see selected empty lines ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos +ImVec2(rect_size.x, bg_offy_dn)); rect.ClipWith(clip_rect); if (rect.Overlaps(clip_rect)) diff --git a/misc/freetype/imgui_freetype.cpp b/misc/freetype/imgui_freetype.cpp index 89aa23f5c..33bdb1404 100644 --- a/misc/freetype/imgui_freetype.cpp +++ b/misc/freetype/imgui_freetype.cpp @@ -337,7 +337,7 @@ bool ImGuiFreeType::BuildFontAtlas(ImFontAtlas* atlas, unsigned int extra_flags) { for (uint32_t codepoint = in_range[0]; codepoint <= in_range[1]; ++codepoint) { - if (cfg.MergeMode && dst_font->FindGlyphNoFallback((unsigned short)codepoint)) + if (cfg.MergeMode && dst_font->FindGlyphNoFallback((ImWchar)codepoint)) continue; FT_Glyph ft_glyph = NULL;