mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 13:08:47 +02:00
Merge branch 'master' into viewport
# Conflicts: # imgui.cpp # imgui.h
This commit is contained in:
31
imgui.cpp
31
imgui.cpp
@ -43,6 +43,7 @@ DOCUMENTATION
|
||||
- How can I load multiple fonts?
|
||||
- How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic?
|
||||
- How can I use the drawing facilities without an ImGui window? (using ImDrawList API)
|
||||
- How can I use Dear ImGui on a platform that doesn't have a mouse or a keyboard? (input share, remoting, gamepad)
|
||||
- I integrated Dear ImGui in my engine and the text or lines are blurry..
|
||||
- I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around..
|
||||
- How can I help?
|
||||
@ -834,6 +835,21 @@ CODE
|
||||
- You can create your own ImDrawList instance. You'll need to initialize them ImGui::GetDrawListSharedData(), or create your own ImDrawListSharedData,
|
||||
and then call your rendered code with your own ImDrawList or ImDrawData data.
|
||||
|
||||
Q: How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display)
|
||||
A: - You can control Dear ImGui with a gamepad. Read about navigation in "Using gamepad/keyboard navigation controls".
|
||||
(short version: map gamepad inputs into the io.NavInputs[] array + set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad)
|
||||
- You can share your computer mouse seamlessly with your console/tablet/phone using Synergy (https://symless.com/synergy)
|
||||
This is the preferred solution for developer productivity.
|
||||
In particular, the "micro-synergy-client" repository (https://github.com/symless/micro-synergy-client) has simple
|
||||
and portable source code (uSynergy.c/.h) for a small embeddable client that you can use on any platform to connect
|
||||
to your host computer, based on the Synergy 1.x protocol. Make sure you download the Synergy 1 server on your computer.
|
||||
Console SDK also sometimes provide equivalent tooling or wrapper for Synergy-like protocols.
|
||||
- You may also use a third party solution such as Remote ImGui (https://github.com/JordiRos/remoteimgui) which sends
|
||||
the vertices to render over the local network, allowing you to use Dear ImGui even on a screen-less machine.
|
||||
- For touch inputs, you can increase the hit box of widgets (via the style.TouchPadding setting) to accommodate
|
||||
for the lack of precision of touch inputs, but it is recommended you use a mouse or gamepad to allow optimizing
|
||||
for screen real-estate and precision.
|
||||
|
||||
Q: I integrated Dear ImGui in my engine and the text or lines are blurry..
|
||||
A: In your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f).
|
||||
Also make sure your orthographic projection matrix and io.DisplaySize matches your actual framebuffer dimension.
|
||||
@ -1115,6 +1131,7 @@ ImGuiIO::ImGuiIO()
|
||||
|
||||
// Platform Functions
|
||||
BackendPlatformName = BackendRendererName = NULL;
|
||||
BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL;
|
||||
GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations
|
||||
SetClipboardTextFn = SetClipboardTextFn_DefaultImpl;
|
||||
ClipboardUserData = NULL;
|
||||
@ -4163,6 +4180,8 @@ bool ImGui::IsMousePosValid(const ImVec2* mouse_pos)
|
||||
return mouse_pos->x >= MOUSE_INVALID && mouse_pos->y >= MOUSE_INVALID;
|
||||
}
|
||||
|
||||
// Return the delta from the initial clicking position.
|
||||
// This is locked and return 0.0f until the mouse moves past a distance threshold at least once.
|
||||
// NB: This is only valid if IsMousePosValid(). Back-ends in theory should always keep mouse position valid when dragging even outside the client window.
|
||||
ImVec2 ImGui::GetMouseDragDelta(int button, float lock_threshold)
|
||||
{
|
||||
@ -4333,6 +4352,10 @@ static bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size
|
||||
child_window->ChildId = id;
|
||||
child_window->AutoFitChildAxises = auto_fit_axises;
|
||||
|
||||
// Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually.
|
||||
// While this is not really documented/defined, it seems that the expected thing to do.
|
||||
parent_window->DC.CursorPos = child_window->Pos;
|
||||
|
||||
// Process navigation-in immediately so NavInit can run on first frame
|
||||
if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll))
|
||||
{
|
||||
@ -6435,10 +6458,10 @@ ImVec2 ImGui::GetCursorScreenPos()
|
||||
return window->DC.CursorPos;
|
||||
}
|
||||
|
||||
void ImGui::SetCursorScreenPos(const ImVec2& screen_pos)
|
||||
void ImGui::SetCursorScreenPos(const ImVec2& pos)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
window->DC.CursorPos = screen_pos;
|
||||
window->DC.CursorPos = pos;
|
||||
window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos);
|
||||
}
|
||||
|
||||
@ -6476,12 +6499,12 @@ void ImGui::SetScrollY(float scroll_y)
|
||||
window->ScrollTargetCenterRatio.y = 0.0f;
|
||||
}
|
||||
|
||||
void ImGui::SetScrollFromPosY(float pos_y, float center_y_ratio)
|
||||
void ImGui::SetScrollFromPosY(float local_y, float center_y_ratio)
|
||||
{
|
||||
// We store a target position so centering can occur on the next frame when we are guaranteed to have a known window size
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);
|
||||
window->ScrollTarget.y = (float)(int)(pos_y + window->Scroll.y);
|
||||
window->ScrollTarget.y = (float)(int)(local_y + window->Scroll.y);
|
||||
window->ScrollTargetCenterRatio.y = center_y_ratio;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user