-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GLFW window Resize effect on Imgui UI #7225
Comments
The logic you posted seems to work here so I think you omitted something. By the way the better sizing logic (simpler for width, correct for height) would be: ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowSize(ImVec2(viewport->Size.x * 0.20f, viewport->Size.y));
ImGui::SetNextWindowPos(viewport->Pos);
ImGui::Begin("Side Panel", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove); |
Hi ocornut, Thanks for the reply and my apologies for the late reply. Unfortunately I still see the same effect.
Video attached. WhatsApp.Video.2024-01-16.at.10.41.12.PM.mp4 |
Thank @ocornut, I was able to make it work with solutions mentioned in your suggested thread - though I still see resolution problem on various screens and while resizing. any comment on that? how to handle imgui resolution on different density screens? I am pasting code for other's reference.
|
Sorry that's too vague. Feel free to details and check other issues. |
Version/Branch of Dear ImGui:
master
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
MSVC 2022
Full config/build information:
No response
Details:
Hi,
I am trying to explore IMGUI for our next project. First of all great efforts. Really appreciable. Since I new so I created a quick UI with the code below. All I wanted was to create a side panel that should stick to the left top and upon resizing the window it should remain stick during mouse resize drag. I tried many methods but couldn't figure it out I also searched online and repo but couldn't get any clue. Maybe I am new to this library but experts here can best guide me.
Also the resolution looks very different on various screens like very tiny on one screen and satisfactory on another.
`
#include "imgui/imgui.h"
#include "imgui/imgui_impl_glfw.h"
#include "imgui/imgui_impl_opengl3.h"
#include <GLFW/glfw3.h>
float sidePanelWidth = 200.0f;
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
// You can adjust this multiplier as needed
const float panelWidthMultiplier = 0.25f;
sidePanelWidth = static_cast(width) * panelWidthMultiplier;
}
void renderSidePanel() {
// Your side panel rendering code goes here
ImGui::Text("Side Panel Content");
// Add more ImGui widgets as needed
}
int main() {
// Initialize GLFW and create a window
if (!glfwInit()) return -1;
}
`
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: