mirror of
https://github.com/ocornut/imgui.git
synced 2026-09-26 16:05:45 +03:00
add public function to update display properties at will
This commit is contained in:
parent
7ba43170f8
commit
d88b253cd7
2 changed files with 11 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
|||
//
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2026-09-06: DPI: Added public ImGui_ImplEmscripten_UpdateDisplayProperties() wrapper.
|
||||
// 2026-09-06: Inputs: Exposed mouse button and key translation functions as public.
|
||||
// 2026-09-06: DPI: Added ImGui_ImplEmscripten_GetCssToImGuiScale() getter.
|
||||
// 2026-09-05: DPI: Use the canvas framebuffer dimensions for display sizing and exact per-axis mouse coordinate scaling.
|
||||
|
|
@ -406,6 +407,13 @@ ImVec2 ImGui_ImplEmscripten_GetCssToImGuiScale()
|
|||
return bd != nullptr ? bd->CssToImGuiScale : ImVec2(1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void ImGui_ImplEmscripten_UpdateDisplayProperties()
|
||||
{
|
||||
ImGui_ImplEmscripten_Data* bd = ImGui_ImplEmscripten_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "Context or backend not initialized? Did you call ImGui_ImplEmscripten_Init()?");
|
||||
if (bd != nullptr) ImGui_ImplEmscripten_UpdateDisplayProperties(ImGui::GetIO(), bd);
|
||||
}
|
||||
|
||||
void ImGui_ImplEmscripten_Shutdown()
|
||||
{
|
||||
ImGui_ImplEmscripten_Data* bd = ImGui_ImplEmscripten_GetBackendData();
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@ IMGUI_IMPL_API void ImGui_ImplEmscripten_SetTargetDevicePixelRatio(float target_
|
|||
// Return the scale used to convert browser CSS pixel coordinates to Dear ImGui coordinates. Valid after Init().
|
||||
IMGUI_IMPL_API ImVec2 ImGui_ImplEmscripten_GetCssToImGuiScale();
|
||||
|
||||
// Refresh display size and scaling properties immediately. Call after changing the canvas framebuffer or CSS size.
|
||||
IMGUI_IMPL_API void ImGui_ImplEmscripten_UpdateDisplayProperties();
|
||||
|
||||
// Input translation helpers.
|
||||
IMGUI_IMPL_API ImGuiMouseButton ImGui_ImplEmscripten_TranslateMouseButton(unsigned short emscripten_button);
|
||||
IMGUI_IMPL_API ImGuiKey ImGui_ImplEmscripten_TranslateKey(const char* emscripten_key);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue