Closed otavepto closed 4 months ago
Hi,
OverlayHookState::Reset
is sent back to the user so that the user is aware that a window/swapchain size has changed. It allows the user to do things when the game has been resized.
As for the overlay not resizing, I don't know what you are talking about. This library is not about drawing a fullscreen overlay, it allows someone to draw an overlay.
If you want your overlay to be the same size as your game, you just set your window size, like in the example :
Interesting, I can't achieve the same behavior. On my end, even after using the suggested code the overlay stays the same, io.DisplaySize
still holds the old window size.
Since it's working in the example, then it's something wrong on my end. Thanks nonetheless.
I apologize for nagging lately.
Well, Maybe InGameOverlay has a bug, but if you have an issue, you should procure a reproductible example so people can work on the issue.
I'm trying to reproduce the issue right now, but I don't understand what might not be working.
No need to apologize. Better ask questions if you don't know/understand something.
I figured it out, I compared the code I have with the example and the only part I didn't copy was this one https://github.com/Nemirtingas/ingame_overlay/blob/843888fd1fee1ed29cf74490a49dd9ece6d2eabe/tests/overlay_example/library_main.cpp#L162-L177
I thought it just prevents input confusion between game's window and overlay's window so just for testing I ignored it, but it turns out that HideOverlayInputs(bool flag)
has a very important side effect, the boolean flag eventually propagates to this part of the code
https://github.com/Nemirtingas/ingame_overlay/blob/843888fd1fee1ed29cf74490a49dd9ece6d2eabe/src/Windows/WindowsHook.cpp#L219-L224
Which does exactly what I suggested previously in point 1 😄 Told you it must be something wrong on my end. I truly apologize for what might seem like a waste of time, trust me it's quite difficult for someone who is not familiar with any of that to get things running the first time. Your project and the example (which I must read carefully) makes it an easy walk in the park. Thank you for this project really.
Learning something is never a waste of time. Glad you figured it out. 👍
Currently on Dx12/Dx11 and probably others when the game's window is changed the overlay size stays the same and doesn't update. This is (to my knowledge) the part which invokes the
OveralyHookReady
with state ==Reset
https://github.com/Nemirtingas/ingame_overlay/blob/843888fd1fee1ed29cf74490a49dd9ece6d2eabe/src/Windows/DX12Hook.cpp#L457-L468I'm relying solely on the callbacks OverlayProc and OverlayHookReady to get notifications, and as a workaround I have this code inside the callback for
OverlayHookReady
The above code is copied from ImGui backend for win32 https://github.com/ocornut/imgui/blob/fbf45ad149b10ff8d9cb97aefe0dc5a9562fd66e/backends/imgui_impl_win32.cpp#L373-L382
I have 2 suggestions:
Calling
ImGui_ImplWin32_NewFrame()
here beforeImGui::NewFrame()
https://github.com/Nemirtingas/ingame_overlay/blob/843888fd1fee1ed29cf74490a49dd9ece6d2eabe/src/Windows/DX12Hook.cpp#L384-L390 You can see in the example of ImGui that this function is indeed called beforeNewFrame
https://github.com/ocornut/imgui/blob/fbf45ad149b10ff8d9cb97aefe0dc5a9562fd66e/examples/example_win32_directx12/main.cpp#L140-L143Or, inside
ResizeTarget
after this lineYou can update the window size, similar to the workaround I did.
Also wanted to ask, what's the point of invoking the callback
OverlayHookReady
with state ==Reset
?, I didn't understand it very well.I can submit a PR for suggestion 1 if you see this is a fitting change, I just don't know how to do this similarly for Linux/Mac, haven't looked at the other ImGui examples yet.
Please feel completely free to close this one if it's not fitting, out of scope, too much burden, etc...