@@ -11,15 +11,15 @@ input routing, configs and screenshots. An application links `sysLib` (premake p
1111| ` sys_window.cpp/.h ` | Window creation, SDL init, game loop (` sysHostInit ` , ` sysHostGameLoop ` , ` sysHostTerminate ` ) |
1212| ` sys_host.cpp/.h ` | ` g_pHost ` (` CGameHost ` ) — systems, frame, video modes, cursor, input events |
1313| ` sys_state.cpp/.h ` | ` CAppStateBase ` , ` eqAppStateMng ` — app states |
14- | ` sys_in_console.cpp/.h ` | ` g_consoleInput ` (` CEqConsoleInput ` ) — developer console, log, ImGui frame |
14+ | ` sys_in_console.cpp/.h ` | ` g_consoleInput ` (` CEqConsoleInput ` ) — developer console, log |
1515| ` sys_in_joystick.cpp/.h ` | ` CEqGameControllerSDL ` — game controllers |
1616| ` cfgloader.cpp/.h ` | ` WriteCfgFile ` , ` writecfg ` |
1717| ` sys_version.cpp/.h ` | ` ENGINE_NAME ` , ` ENGINE_VERSION ` , ` COMPILE_* ` , ` GetEngineBuildNumber() ` |
18- | ` imgui/imgui_impl_sys.* ` | ImGui platform backend for SDL |
1918| ` scripting/ ` | Engine Lua state and bindings ([ scripting_esl_overview.md] ( scripting_esl_overview.md ) ) |
2019
2120` sysLib ` also compiles ` shared/input ` ([ input_overview.md] ( input_overview.md ) ) and uses
22- ` renderUtilLib ` , ` equiLib ` , ` movieLib ` , ` scriptLib ` , SDL2 and the ImGui backend.
21+ ` renderUtilLib ` , ` equiLib ` , ` movieLib ` , ` scriptLib ` , SDL2 and ` imguiBackendLib ` (` g_imGuiHost ` ,
22+ ` shared/imgui_backend ` , which also contains the ImGui platform backend for SDL).
2323
2424## Start-up and shutdown
2525
@@ -39,7 +39,8 @@ WinMain / main
3939 │ │ ├─ window (vid_mode, vid_fullscreen, vid_screen), command line (+cmd value)
4040 │ │ ├─ g_matSystem->Init() RHI on the SDL window
4141 │ │ ├─ g_fontCache, g_localizer (+GAME_VERSION, BUILD_NUMBER tokens),
42- │ │ │ debugoverlay, equi::Manager, g_inputCommandBinder, g_consoleInput (ImGui)
42+ │ │ │ debugoverlay, g_imGuiHost (ImGui on the SDL window), equi::Manager,
43+ │ │ │ g_inputCommandBinder, g_consoleInput
4344 │ │ └─ REGISTER_INTERNAL_SHADERS() material shaders compiled into the application
4445 │ └─ CEqGameControllerSDL::Init()
4546 ├─ sysHostGameLoop()
@@ -130,15 +131,17 @@ frame the loop sleeps `sys_sleep` ms (default 1).
1301311 . Measures time. With ` sys_maxfps ` set, the frame is skipped until enough time passed; the frame
131132 time is clamped to 0.001–0.1 s.
1321332 . ` g_onBeginFrame ` , controller button repeats, cursor state.
133- 3 . ` BeginScene ` : ` g_matSystem->BeginFrame ` , ` r_wireframe ` / ` r_overdraw ` , console / ImGui frame
134- start.
134+ 3 . ` BeginScene ` : ` g_matSystem->BeginFrame ` , console frame start, ImGui frame start
135+ (` g_imGuiHost->BeginFrame ` , debug menus while the console is open), ` r_wireframe ` /
136+ ` r_overdraw ` .
1351374 . ` eqAppStateMng::UpdateStates(dt × state timescale × sys_timescale) ` — the current state
136138 renders and queues its command buffers.
1371395 . EqUI render, full-screen edge AA, ` g_matSystem->SubmitQueuedCommandsAwaitable() ` .
1381406 . Debug overlay with engine statistics (FPS, draw / dispatch counts, GPU and system memory),
139- ` r_showFPS ` , ` r_showFPSGraph ` , input debug drawing.
140- 7 . ` EndScene ` : screenshot (without console / ImGui), console and ImGui drawing,
141- ` g_matSystem->EndFrame() ` .
141+ ` r_showFPS ` , ` r_showFPSGraph ` . Screenshot (without console / ImGui), then one render pass with
142+ the debug overlay, input debug drawing, console (` g_consoleInput->EndFrame ` ) and ImGui
143+ (` g_imGuiHost->EndFrame ` ).
144+ 7 . ` EndScene ` : ` g_matSystem->EndFrame() ` .
1421458 . Pending fullscreen toggle, ` g_onEndFrame ` .
143146
144147` GetFrameTime() ` returns the current frame time; ` GetWindowSize() ` , ` GetDefaultFont() ` ,
@@ -165,29 +168,37 @@ dispatched by `CGameHost`:
165168
166169| Event | Order |
167170| ---| ---|
168- | Keyboard | console → EqUI → state ` HandleKeyPress ` |
169- | Mouse buttons | console / ImGui → EqUI → (touch emulation with ` m_clicks_to_touch ` ) → state ` HandleMouseClick ` |
171+ | Keyboard | console toggle key → ImGui → console → EqUI → state ` HandleKeyPress ` |
172+ | Mouse buttons | ImGui → console → EqUI → (touch emulation with ` m_clicks_to_touch ` ) → state ` HandleMouseClick ` |
170173| Mouse movement | console / ImGui position → EqUI → ` g_inputCommandBinder->OnVectorEvent(MOU_MOVE) ` → state ` HandleMouseMove ` |
171- | Mouse wheel | console → binder (` MOU_MOVE ` ) → state ` HandleMouseWheel ` |
174+ | Mouse wheel | ImGui → console → binder (` MOU_MOVE ` ) → state ` HandleMouseWheel ` |
172175| Controller buttons / axes | binder → state ` HandleKeyPress ` / ` HandleJoyAxis ` |
173176| Touch | binder touch zones |
174- | Text input | console |
177+ | Text input | ImGui → console |
175178
176179Keyboard keys and mouse buttons reach command bindings only if the state forwards them to
177180` g_inputCommandBinder->OnPressEvent ` (see [ input_overview.md] ( input_overview.md ) ). Input is ignored
178181for 0.25 s after the window regains focus.
179182
183+ ImGui (` g_imGuiHost->Input* ` ) receives keys, mouse buttons, wheel and text first. While an ImGui
184+ item is hovered, active or focused, or ImGui wants the mouse / keyboard
185+ (` g_imGuiHost->IsImGuiItemsInFocus() ` ), the event goes no further; key releases still reach the
186+ console so its modifier state does not stick.
187+
180188## Developer console — ` g_consoleInput `
181189
182- - Opened by the ` +con_toggle ` command (bind it to a key, e.g. ` bind GRAVE +con_toggle ` in
183- ` cfg/config_default.cfg ` ), or ` con_show ` , ` con_show_full ` , ` con_hide ` ; ` clear ` , ` help ` .
190+ - Opened by the key bound to ` toggleconsole ` (` bind GRAVE toggleconsole ` in
191+ ` cfg/config_default.cfg ` ). ` CGameHost::Key_Event ` checks this key before any other input
192+ handling, so it works while ImGui has focus; with the console open, Shift + the key toggles the
193+ log view. Also ` con_toggle ` / ` +con_toggle ` , ` con_show ` , ` con_show_full ` , ` con_hide ` ; ` clear ` ,
194+ ` help ` .
184195- Executes console commands (see [ framework_core.md] ( framework_core.md ) ) with autocompletion,
185196 variants, history and a log view. With the Lua state initialized, input that fails as a command
186197 is executed as Lua (` SetAlternateHandler ` , see [ scripting_esl_overview.md] ( scripting_esl_overview.md ) ).
187198- ConVars: ` con_size ` , ` con_suggest ` , ` con_minicon ` , ` con_minicon_time ` .
188- - The console owns the ImGui frame (` g_imGuiHost ` , ` shared/imgui_backend ` ): ImGui windows registered
189- with ` g_imGuiHost->AddDebugHandler ` are always drawn, and the debug menu bar with
190- ` AddDebugMenu(path, handler) ` entries is shown while the console is open.
199+ - ImGui is run by the host (` g_imGuiHost ` , ` shared/imgui_backend ` ), not the console: ImGui
200+ windows registered with ` g_imGuiHost->AddDebugHandler ` are always drawn, and the debug menu bar
201+ with ` AddDebugMenu(path, handler) ` entries is shown while the console is open.
191202- ` CEqConsoleInput::SpewInit ` captures engine log output for the console log from the start.
192203
193204## Configuration files
0 commit comments