File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1128,6 +1128,12 @@ void GWToolbox::Draw(IDirect3DDevice9* device)
11281128 }
11291129 }
11301130
1131+ // Non-UI modules have no window of their own but may still paint an overlay
1132+ // this frame (e.g. Texmod's recording banner).
1133+ for (size_t i = 0 ; i < other_modules_enabled.size (); i++) {
1134+ other_modules_enabled[i]->Draw (device);
1135+ }
1136+
11311137#ifdef _DEBUG
11321138 // Feel free to uncomment to play with ImGui's features
11331139 // ImGui::ShowDemoWindow();
Original file line number Diff line number Diff line change @@ -946,13 +946,7 @@ void TexmodModule::Terminate()
946946{
947947 TeardownTextureCapture ();
948948 ShutdownGMod (); // synchronously unloads every pack from gMod
949- ToolboxWidget::Terminate ();
950- }
951-
952- void TexmodModule::RegisterSettingsContent ()
953- {
954- // Plain-module settings: skip ToolboxUIElement's visibility/size/position UI.
955- ToolboxModule::RegisterSettingsContent ();
949+ ToolboxModule::Terminate ();
956950}
957951
958952void TexmodModule::DrawSettingsInternal ()
Original file line number Diff line number Diff line change 11#pragma once
22
3- #include < ToolboxWidget .h>
3+ #include < ToolboxModule .h>
44
55// ---------------------------------------------------------------------------
66// TexmodModule
1010// priority: when two packs replace the same texture, the one higher in the list
1111// wins, so reordering re-adds packs in the desired order.
1212//
13- // A widget (not a plain module) only so it gets a per-frame Draw() for the texture-
14- // recording overlay; its settings are still registered like a plain module .
13+ // Draw() ( a plain- module render hook) is used only to paint the texture-recording
14+ // overlay; the module has no window of its own .
1515// ---------------------------------------------------------------------------
16- class TexmodModule final : public ToolboxWidget {
16+ class TexmodModule final : public ToolboxModule {
1717public:
1818 static TexmodModule& Instance ()
1919 {
@@ -35,9 +35,6 @@ class TexmodModule final : public ToolboxWidget {
3535 void LoadSettings (ToolboxIni* ini) override ;
3636 void SaveSettings (ToolboxIni* ini) override ;
3737
38- // Register settings like a plain module (no widget visibility/position controls).
39- void RegisterSettingsContent () override ;
40-
4138private:
4239 TexmodModule () = default ;
4340};
Original file line number Diff line number Diff line change 77using SectionDrawCallback = std::function<void (const std::string& section, bool is_showing)>;
88class ToolboxModule ;
99class ToolboxIni ;
10+ struct IDirect3DDevice9 ;
1011
1112struct SectionDrawCallbackInfo {
1213 float weighting{};
@@ -72,6 +73,12 @@ class ToolboxModule {
7273 // Update. Will always be called once every frame. Delta in seconds
7374 virtual void Update (float ) { }
7475
76+ // Called once per render frame, inside the ImGui frame, for every enabled module.
77+ // UI elements override this to draw their window; a plain module can use it to
78+ // paint an overlay (e.g. on the background draw list), which it otherwise can't
79+ // do from Update() (that runs on the game thread, outside the ImGui frame).
80+ virtual void Draw (IDirect3DDevice9*) { }
81+
7582 // This is provided (and called), but use ImGui::GetIO() during update/render if possible.
7683 virtual bool WndProc (UINT , WPARAM , LPARAM ) { return false ; }
7784
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ class ToolboxUIElement : public ToolboxModule {
99 [[nodiscard]] bool IsUIElement () const override { return true ; }
1010
1111 // Draw user interface. Will be called every frame if the element is visible
12- virtual void Draw (IDirect3DDevice9*) { }
12+ void Draw (IDirect3DDevice9*) override { }
1313
1414 void UpdateLocationAgainstSnappedFrame ();
1515 static void UpdateCachedFrameStates ();
You can’t perform that action at this time.
0 commit comments