IMGui windows get smaller when resizing down OS window


#1

I found this here DisplaySize update on OS window resize which shows my problem. I’m settings io.DisplaySize to 1920, 1080 which is my display size but the window is still getting smaller and I can’t click the buttons after resizing down. I can’t read text on the window either.

I modified the example code and am using that as a base for my project. The funny thing is when I run the unedited sample (dx11 sample) the windows don’t have this problem. I don’t even see where you’re setting io.displaysize in the sample so it must be something that I changed in my project to cause this problem. I don’t know what though. All I’m doing is loading a few models. The code in my project and the sample is pretty much the same.

I tried this too:

		RECT* rect =  new RECT();
	GetClientRect(hwnd, rect);
	io.DisplaySize.x = (float)rect->right;
	io.DisplaySize.y = (float)rect->bottom;

#2

I don’t even see where you’re setting io.displaysize in the sample

You can use your text editor “Search function” and find, e.g. in imgui_impl_win32.cpp

    // Setup display size (every frame to accommodate for window resizing)
    RECT rect;
    ::GetClientRect(g_hWnd, &rect);
    io.DisplaySize = ImVec2((float)(rect.right - rect.left), (float)(rect.bottom - rect.top));

#3

its not working. :joy_cat:


#4

ok i got it to work. I wasn’t resizing my window right.