unify(gadget): Merge and move GUI gadgets and related code#2672
unify(gadget): Merge and move GUI gadgets and related code#2672xezon merged 2 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetPushButton.cpp | Merged ZH features: adds buttonTriggersOnMouseDown() helper and wires it into GWM_LEFT_DOWN / GWM_LEFT_UP handling; logic is correct |
| Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp | Adds WIN_STATUS_SHORTCUT_BUTTON text alignment to drawButtonText(); shortcut path hard-codes top-left offset (origin.x+2, origin.y+0) |
| Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp | Adds centeredVertically/leftMargin/topMargin defaults for TextData in parseStaticTextData(), matching ZH behaviour |
| Core/GameEngine/CMakeLists.txt | Uncomments Gadget header and source entries to include Core gadget files in the build |
| Generals/Code/GameEngine/CMakeLists.txt | Comments out Gadget source/header entries now that they live in Core/ |
| scripts/cpp/unify_move_files.py | Appends commented-out unify_file() calls recording which gadget files were moved; entries are all commented out (no active execution) |
| Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp | ZH version (no hardcoded margin init); margin setup is now handled in GameWindowManagerScript.cpp for both games |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[GWM_LEFT_DOWN received] --> B{buttonTriggersOnMouseDown?}
B -- WIN_STATUS_ON_MOUSE_DOWN set --> C[Send GBM_SELECTED immediately]
B -- WIN_STATUS_CHECK_LIKE set --> D[Toggle selected state]
D --> E[Send GBM_SELECTED immediately]
B -- Normal button --> F[Set WIN_STATE_SELECTED only]
G[GWM_LEFT_UP received] --> H{WIN_STATUS_CHECK_LIKE?}
H -- Yes --> I[Return MSG_IGNORED]
H -- No, and was selected --> J{buttonTriggersOnMouseDown?}
J -- Yes already fired --> K[Clear selected, no re-send]
J -- No --> L[Send GBM_SELECTED now]
L --> K
Reviews (3): Last reviewed commit: "unify(gadget): Move Gadget files to Core..." | Re-trigger Greptile
Regarding the Greptile findings: Smoke testing completed on Base Generals. The StaticText gadgets render correctly with no layout regressions.
|
xezon
left a comment
There was a problem hiding this comment.
Looks ok in principle.
Needs documention in the pull desc what Generals gets. For example it gets ON_MOUSE_DOWN support.
df6b718 to
f579457
Compare
|
Please rename (gadgets) to (gadget) because the gadget code is named "gadget" |
f579457 to
7d65fa6
Compare
Fixed |
This PR initiates the unification of the GUI categories by merging and moving the Gadgets group (including their W3D implementations) into the shared core folder, 34 files.
In Base Generals, the text margin logic was hardcoded directly in
W3DTextEntry. Zero Hour refactored this by moving the initialization intoGameWindowManagerScript.cpp. To unify the behavior between both games, I replicated this shift for Base Generals as well. Note thatGameWindowManagerScript.cppis only receiving this small logic merge and isn't being moved yet, as it belongs to the Core GUI group which will be handled later.Inherited Zero Hour Features (Base Generals)
WIN_STATUS_ON_MOUSE_DOWNsupport viabuttonTriggersOnMouseDown(), allowing specific buttons to execute their actions immediately on click rather than waiting for the mouse button to be released.WIN_STATUS_CHECK_LIKE) now implicitly and universally trigger their logic on Mouse Down rather than Mouse Up.WIN_STATUS_SHORTCUT_BUTTONto forcefully align text to the top-left corner of the button.