Commit graph

29 commits

Author SHA1 Message Date
Daniel Gibson
44d19a4175 Implement GLimp_SetScreenParms() for "vid_restart partial"
"vid_restart partial" only changes the window size or its fullscreen
(or windowed) state, without recreating everything.
If that fails (or antialiasing settings have changed), it will fall back
to a full vid_restart (this behavior is different than original
 "vid_restart partial" that probably was implemented in Vanilla Doom3
 but not dhewm3)

This is used for Alt-Enter (which toggles between fullscreen and
windowed state) and when pressing the Apply button in the new Video Menu
2024-06-11 16:45:34 +02:00
Daniel Gibson
ac8eec932b Add r_windowResizable to configure if window is resizable
incl. setting in SettingsMenu

With SDL 2.0.5 and newer this change is applied immediately,
2.0.0 to 2.0.4 need a vid_restart
(with SDL1.2 we don't support it at all)
2024-06-08 11:39:21 +02:00
Daniel Gibson
28b753d50b Fix crash in Dhewm3SettingsMenu after switching fullscreen w/ Alt-Enter
Seems like calling ImGui::CalcTextSize() is only safe after
(or at the end of) NewFrame()
2024-06-07 13:39:51 +02:00
Daniel Gibson
cff73ff591 Dhewm3SettingsMenu: Remove testing printfs 2024-06-07 11:53:04 +02:00
Daniel Gibson
81d912ab4b Give Dhewm3SettingsMenu a sane default size and position 2024-06-04 10:32:28 +02:00
Daniel Gibson
a9bee9f76e Fix build on Windows/MSVC
for some reason <algorithm> dragged in <cstdio> which chocked on the
use_idStr_snPrintf #defines from Str.h
"fixed" by including <algorithm> first
also shut up some compiler warnings about signed/unsigned mismatch
2024-06-03 19:25:50 +02:00
Daniel Gibson
5376c6d74c HighDPI support, hopefully 2024-06-03 14:49:23 +02:00
Daniel Gibson
67a0dc8c46 Dhewm3SettingsMenu: Save number of BindingColumns in a CVar
so it gets saved in the config

also added another Game Option and added separators to that menu
2024-06-02 15:39:18 +02:00
Daniel Gibson
10312f6998 Allow disabling Dear ImGui integration in CMake
and do it automatically when using SDL1.2, as it requires SDL2
(or SDL3 once we support it)
2024-06-02 14:07:29 +02:00
Daniel Gibson
ecee402927 Dhewm3SettingsMenu: properly handle playername encoding and length
ImGui uses UTF-8 for strings, Doom3 uses ISO8859-1, so the playername
must be translated.
Also it seems like the playername should have at least 40 chars,
at least that's the limit imposed by the original Doom3 menu
2024-06-02 13:18:37 +02:00
Daniel Gibson
30e4a9bb51 Dhewm3SettingsMenu: Add game options and m_invertLook 2024-06-02 07:20:11 +02:00
Daniel Gibson
bd22f55f56 Dhewm3SettingsMenu: Support new sound CVars, show OpenAL info 2024-06-01 07:11:14 +02:00
Daniel Gibson
7b6fdc845a Dhewm3SettingsMenu: Add Audio Options, make Video Options nicer 2024-05-31 15:58:12 +02:00
Daniel Gibson
410d2791ae Dhewm3SettingsMenu: More video settings, a few other tweaks 2024-05-30 08:59:28 +02:00
Daniel Gibson
2aaaeb1456 Dhewm3SettingsMenu: Added VSync option 2024-05-30 05:55:53 +02:00
Daniel Gibson
139020f52b Dhewm3SettingsMenu: More video options 2024-05-30 05:02:59 +02:00
Daniel Gibson
0e341176d4 Dhewm3SettingsMenu: Start implementing video options 2024-05-30 05:00:52 +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
53906538e6 Dhewm3SettingsMenu: Scroll within the tabs and similar tweaks 2024-05-24 17:05:37 +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
2892e416f5 Add keybinding menu to Dhewm3SettingsMenu
I first developed that as a prototype in
https://github.com/DanielGibson/dhewm3/blob/imgui/neo/libs/imgui/examples/example_sdl2_opengl2/main.cpp
there one can also find a commit history from writing that code, even
though not all commit messages are overly helpful :-p
2024-05-23 19:28:10 +02:00
Daniel Gibson
8554487bf5 Dhewm3SettingsMenu: Get rid of obscureBindingEntries list
they're part of the regular list now. this will help with the actual
binding implementation I'll merge next
2024-05-22 19:46:38 +02:00
Daniel Gibson
9e4fe84eb8 Dhewm3SettingsMenu: some more joystick settings, stub of a binding menu
I actually did this before the prototyping of a keybindings menu
in the imgui example code, so the prototype is actually based on this.
I'll merge the code from the prototype back once it's done.
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