Commit graph

18 commits

Author SHA1 Message Date
Daniel Gibson
51270dd390 Store imgui.ini and user.imstyle in dhewm3 config dir instead of $PWD 2024-06-04 10:52:30 +02:00
Daniel Gibson
5376c6d74c HighDPI support, hopefully 2024-06-03 14:49:23 +02:00
Daniel Gibson
7aa6c6a70f "Properly" scale ImGui font by reloading font with scaled size 2024-06-02 16:50:28 +02:00
Daniel Gibson
410d2791ae Dhewm3SettingsMenu: More video settings, a few other tweaks 2024-05-30 08:59:28 +02:00
Daniel Gibson
1697831e74 ImGui: Draw ImGui cursor on black bars in main menu; tweak some colors
In the main menu the ImGui/SDL/System cursor was only drawn when it was
over an ImGui window, so only the Doom3 cursor is shown when outside
of ImGui windows.
The only problem with this is that the Doom3 cursor is only shown in
the parst of the window actually covered by the main menu, not the black
bars that are drawn on the left/right for widescreen-resolutions when
scaling the menu to 4:3 is enabled (which it is by default).
So now the ImGui cursor is also drawn when the cursor is on those
black bars (if any).

Also tweaked the windowtitle background colors a bit.
2024-05-30 01:26:40 +02:00
Daniel Gibson
7af7508a7f ImGui stuff: Some tweaks
* Binding menu makes sure that the AllBindingsMenu always gets focus
  when opened
* Give binding-related popups slightly rounder edges
* Move Game Options tab behind Video and Audio Options
* Make warning overlays a bit less translucent
2024-05-28 04:49:24 +02:00
Daniel Gibson
4bdee4f638 Dhewm3SettingsMenu: Improve cursor handling and opening menu ingame
Pause the game (with g_stopTime) when the settings menu is opened
while ingame, unpause it when it's closed.
If the menu is open while ingame and an ImGui window has focus,
the mouse cursor is shown. If the player clicks outside an ImGui window,
it gets unfocused and the cursor is hidden and the player can look
around. Pressing F10 (or whatever key is bound to "dhewm3Settings")
will give focus back to an open ImGui window, pressing it again then
will close the settings window, pressing it once again afterwards will
open the settings window again.

handleMouseGrab() (in sys/events.cpp) now checks if sys_imgui thinks
that a cursor should be shown (via D3::ImGuiHooks::ShouldShowCursor())
and if so, shows it and ungrabs the mouse. This, together with
D3::ImGuiHooks::NewFrame() checking ShouldShowCursor() to (unset)
ImGuiConfigFlags_NoMouseCursorChange, should prevent flickering cursor
problems that sometimes occurred when ImGui's SDL2 backend and dhewm3
disagreed on whether the cursor should be visible.
2024-05-28 04:49:24 +02:00
Daniel Gibson
c0b6660389 ImGui styles: Allow writing only changed values to C++ code 2024-05-26 03:56:28 +02:00
Daniel Gibson
894aa67a8f Dhewm3SettingsMenu: Add button to copy current style to clipboard as C++ 2024-05-25 18:16:00 +02:00
Daniel Gibson
bb0511ac7b sys_imgui.cpp: Move code to read/write style to imgui_savestyle.cpp
it's nicely self-contained, I'll release it as a mini-library/addon
for Dear ImGui on https://github.com/DanielGibson/Snippets/
2024-05-25 06:58:19 +02:00
Daniel Gibson
2e8cbc1344 Allow saving ImGui Userstyles
You can pry X macros from my cold dead hands
2024-05-24 16:16:47 +02:00
Daniel Gibson
ef529cf49a Bind F10 to open dhewm3Settings menu, unless F10 is already bound
Also fix MSVC build: For some reason Microsoft's sad excuse of a compiler
 only sets __cplusplus to a value from this millenium if the
/Zc:__cplusplus compiler option is set, but that's only supported from
VS2017 15.7 on. The alternative is to use _MSVC_LANG, which always holds
the version that __cplusplus *should* have...
2024-05-23 19:29:38 +02:00
Daniel Gibson
6d508eac17 Some functions that will be used by the ImGui keybinding menu 2024-05-22 19:46:38 +02:00
Daniel Gibson
c9a8901dbd ImGui: Improve integration, use scalable font, Control Options menu 2024-05-22 19:46:38 +02:00
Daniel Gibson
86be2eb513 initial support for DPI scaling of imgui 2024-05-22 19:46:38 +02:00
Daniel Gibson
ffaf135758 Start ImGui-based settings menu
the integration of that at least, the menu is still a stub
2024-05-22 19:46:38 +02:00
Daniel Gibson
8fce796680 improve imgui integration 2024-05-22 19:46:38 +02:00
Daniel Gibson
c0c82e763a Initial ImGui integration in the engine
still a bit hacky, but shows imgui windows that can be clicked etc
2024-05-22 19:46:38 +02:00