Skip to content
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

Integrate Dear ImGui and implement a new settings menu with it + more #576

Merged
merged 67 commits into from
Jun 17, 2024

Commits on May 22, 2024

  1. Configuration menu
    Copy the full SHA
    07f7d14 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    33ed999 View commit details
    Browse the repository at this point in the history
  3. Initial ImGui integration in the engine

    still a bit hacky, but shows imgui windows that can be clicked etc
    DanielGibson committed May 22, 2024
    Configuration menu
    Copy the full SHA
    c0c82e7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8fce796 View commit details
    Browse the repository at this point in the history
  5. Start ImGui-based settings menu

    the integration of that at least, the menu is still a stub
    DanielGibson committed May 22, 2024
    Configuration menu
    Copy the full SHA
    ffaf135 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    86be2eb View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c9a8901 View commit details
    Browse the repository at this point in the history
  8. Update ImGui to 1.90.6

    DanielGibson committed May 22, 2024
    Configuration menu
    Copy the full SHA
    0418f62 View commit details
    Browse the repository at this point in the history
  9. Add idStr::(V)Format(), make idList compatible with C++ foreach

    idStr::(V)Format() is a static (v)printf-like function that returns
    and idStr. Can be used like a better va(), or for
    idStr mystr = idStr::Format( "number of items: %d", myarr.Num() );
    DanielGibson committed May 22, 2024
    Configuration menu
    Copy the full SHA
    7023475 View commit details
    Browse the repository at this point in the history
  10. 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.
    DanielGibson committed May 22, 2024
    Configuration menu
    Copy the full SHA
    9e4fe84 View commit details
    Browse the repository at this point in the history
  11. Workaround for missing " or " string in Doom3 demo for Windows

    The original binding menu uses #str_07183 between keys - this
    should be " or ", but in the windows demo that entry is missing
    in strings/english.lang
    DanielGibson committed May 22, 2024
    Configuration menu
    Copy the full SHA
    809bbfc View commit details
    Browse the repository at this point in the history
  12. 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
    DanielGibson committed May 22, 2024
    Configuration menu
    Copy the full SHA
    8554487 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    6d508ea View commit details
    Browse the repository at this point in the history

Commits on May 23, 2024

  1. 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
    DanielGibson committed May 23, 2024
    Configuration menu
    Copy the full SHA
    2892e41 View commit details
    Browse the repository at this point in the history
  2. 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...
    DanielGibson committed May 23, 2024
    Configuration menu
    Copy the full SHA
    ef529cf View commit details
    Browse the repository at this point in the history

Commits on May 24, 2024

  1. Allow saving ImGui Userstyles

    You can pry X macros from my cold dead hands
    DanielGibson committed May 24, 2024
    Configuration menu
    Copy the full SHA
    2e8cbc1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5390653 View commit details
    Browse the repository at this point in the history

Commits on May 25, 2024

  1. 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/
    DanielGibson committed May 25, 2024
    Configuration menu
    Copy the full SHA
    bb0511a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fd36e8e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    99b65a3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    894aa67 View commit details
    Browse the repository at this point in the history
  5. imgui_savestyle.cpp - some improvements

    - write code uses fewer/shorter string literals
    - code generated by WriteImGuiStyleToCode() has nicer alignment
    - small improvements in some comments
    DanielGibson committed May 25, 2024
    Configuration menu
    Copy the full SHA
    2a7683e View commit details
    Browse the repository at this point in the history

Commits on May 26, 2024

  1. Configuration menu
    Copy the full SHA
    c0b6660 View commit details
    Browse the repository at this point in the history

Commits on May 28, 2024

  1. 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.
    DanielGibson committed May 28, 2024
    Configuration menu
    Copy the full SHA
    4bdee4f View commit details
    Browse the repository at this point in the history
  2. 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
    DanielGibson committed May 28, 2024
    Configuration menu
    Copy the full SHA
    7af7508 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2024

  1. 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.
    DanielGibson committed May 29, 2024
    Configuration menu
    Copy the full SHA
    1697831 View commit details
    Browse the repository at this point in the history

Commits on May 30, 2024

  1. Configuration menu
    Copy the full SHA
    0e34117 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    139020f View commit details
    Browse the repository at this point in the history
  3. Allow changing r_swapInterval (VSync) on-the-fly

    Not supported with SDL1.2 - but that's only still supported by dhewm3
    because I'm too lazy to rip it out :-p
    DanielGibson committed May 30, 2024
    Configuration menu
    Copy the full SHA
    e3d67f0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2aaaeb1 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    410d279 View commit details
    Browse the repository at this point in the history
  6. Add optional "nores" argument to Com_ExecMachineSpec_f()

    if set, the display resolution (r_mode) is not modified
    DanielGibson committed May 30, 2024
    Configuration menu
    Copy the full SHA
    fcbc757 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    337b339 View commit details
    Browse the repository at this point in the history

Commits on May 31, 2024

  1. Configuration menu
    Copy the full SHA
    7b6fdc8 View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2024

  1. Several OpenAL improvements

    - s_scaleDownAndClamp CVar so the clamping and scaling down of all
      sounds (that is done to prevent clipping) can be disabled
      (enabled by default)
    - s_alOutputLimiter CVar to allow configuring ALC_SOFT_output_limiter
      which (if enabled) reduces the overall volume if it gets too loud,
      to avoid clipping (defaults to -1 = "let OpenAL decide")
    - s_alHRTF to allow enabling or disabling HRTF, requires ALC_SOFT_HRTF
      (defaults to -1 = "let OpenAL decide")
    
    Those CVars can be changed at runtime and are applied immediately
    (in case of s_alHRTF and s_alOutputLimiter by resetting the OpenAL
     device, just like we do when a disconnect is detected)
    DanielGibson committed Jun 1, 2024
    Configuration menu
    Copy the full SHA
    2c58845 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bd22f55 View commit details
    Browse the repository at this point in the history

Commits on Jun 2, 2024

  1. New input CVars: in_allowAlwaysRunInSP, m_invertLook

    in_allowAlwaysRunInSP allows using in_alwaysRun and in_toggleRun
    in Single Player (it'll still drain your stamina!)
    
    m_invertLook allows inverting mouse look, both for up/down and
    left/right, if you're into that kind of thing
    DanielGibson committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    50d7129 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    30e4a9b View commit details
    Browse the repository at this point in the history
  3. Add some functions to handle UTF-8 strings

    - convert to/from ISO8859-1 (Doom3's "High ASCII" encoding)
    - count Unicode codepoints in UTF-8 string
    - cut UTF-8 string off after N codepoints
    - use the conversion function to replace iconv in sys/events.cpp
    DanielGibson committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    6dc36c6 View commit details
    Browse the repository at this point in the history
  4. 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
    DanielGibson committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    ecee402 View commit details
    Browse the repository at this point in the history
  5. 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)
    DanielGibson committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    10312f6 View commit details
    Browse the repository at this point in the history
  6. 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
    DanielGibson committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    67a0dc8 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7f62e9a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    cb5d988 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    7aa6c6a View commit details
    Browse the repository at this point in the history

Commits on Jun 3, 2024

  1. Fix ImGui with r_fillWindowAlphaChan

    turns out ImGui also messes with the windows alpha chan, so, it
    must render before the alpha chan is filled
    DanielGibson committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    28d81ed View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5376c6d View commit details
    Browse the repository at this point in the history
  3. 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
    DanielGibson committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    a9bee9f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1b344d4 View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2024

  1. Configuration menu
    Copy the full SHA
    c317e60 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    81d912a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    51270dd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ab5d590 View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2024

  1. ImGui: Apply patch from upstream that fixes tooltips of disabled buttons

    Upstream commit: "Disabled: nested tooltips or other non-child window
     within a BeginDisabled() block disable the disabled state. (dhewm#211, #7640)"
    
    Should be in the next Dear ImGui release
    DanielGibson committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    af34aba View commit details
    Browse the repository at this point in the history
  2. Always optimize code of some integrated libraries, even in Debug builds

    the stb libs, miniz and minizip are now always optimized to speed up
    performance, esp. level loading times, in debug builds.
    
    So far the stb libs implementation were dragged into the source file
    that uses them, now I created additional source files just for them so
    those can be optimized while the engine source files using those libs
    can remain unoptimized in debug builds.
    DanielGibson committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    e8b8f5c View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2024

  1. Configuration menu
    Copy the full SHA
    863dc48 View commit details
    Browse the repository at this point in the history
  2. Adjust imgui_savestyle.cpp for 1.90.8

    ImGuiDir now is a proper enum, not just a typedef of int that happens
    to have a similar name to the actual enum
    DanielGibson committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    49ed8ec View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2024

  1. Configuration menu
    Copy the full SHA
    cff73ff View commit details
    Browse the repository at this point in the history
  2. 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()
    DanielGibson committed Jun 7, 2024
    Configuration menu
    Copy the full SHA
    28b753d View commit details
    Browse the repository at this point in the history
  3. Make dhewm3 window resizable (when using SDL2)

    is this really all that's needed?!
    DanielGibson committed Jun 7, 2024
    Configuration menu
    Copy the full SHA
    ab67687 View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2024

  1. Configuration menu
    Copy the full SHA
    a6870ca View commit details
    Browse the repository at this point in the history
  2. 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)
    DanielGibson committed Jun 8, 2024
    Configuration menu
    Copy the full SHA
    ac8eec9 View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2024

  1. 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
    DanielGibson committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    44d19a4 View commit details
    Browse the repository at this point in the history
  2. Fix toggling fullscreen mode with vid_restart partial, esp for Alt-Enter

    Toggling with Alt-Enter relies on idRenderSystem::IsFullScreen() which
    returns glConfig.isFullscreen
    
    That can only work if GLimp_SetScreenParms() actually sets
    glConfig.isFullscreen
    
    Thanks j4reporting for reporting this! :)
    DanielGibson committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    c096a86 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    387430a View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2024

  1. Add glimpParms_t GLimp_GetCurState() to get current window state

    it's queried from SDL so it should be up-to-date.
    Using it in GLimp_SetScreenParms(), as it mostly did the same SDL calls
    to get the current state for the partial vid_restart
    DanielGibson committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    94738f1 View commit details
    Browse the repository at this point in the history
  2. Dhewm3SettingsMenu: Rework resolution/windowed/MSAA part of Video Opt…

    …ions
    
    Now the CVars are set immediately and "Apply" only does
    `vid_restart partial`, while "Reset" resets the CVars to the values
    that were set when opening the menu.
    This also works the other way around: Changing a CVar (in the console
    or other menu or r_fullscreen with Alt-Enter) is immediately reflected
    in the menu.
    
    Furthermore, "fullscreen desktop" now is its own setting (=> can be set
    even if windowed mode is selected), to accommodate switchting between
    windowed and fullscreen with Alt-Enter
    DanielGibson committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    9eff1d9 View commit details
    Browse the repository at this point in the history