Add panelBitFlags to GameMenu for original behavior and centering options#67
Open
th3w1zard1 wants to merge 2 commits intoKobaltBlu:masterfrom
Open
Add panelBitFlags to GameMenu for original behavior and centering options#67th3w1zard1 wants to merge 2 commits intoKobaltBlu:masterfrom
th3w1zard1 wants to merge 2 commits intoKobaltBlu:masterfrom
Conversation
…ions - Introduced `panelBitFlags` to match original game's CSWGuiPanel behavior, allowing for centering at arbitrary resolutions. - Updated position handling in `show()` and `hide()` methods to align with original layout behavior. - Enhanced `getControlByName()` method to improve error handling and return type. - Added detailed documentation for new and modified methods to clarify functionality and usage. (cherry picked from commit 5592a13)
Removed detailed comments about panel bit_flags.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of what was implemented:
GameMenu.ts (lines 216–265) – updates
note: The KotOR binary uses a different UI stack (C++ panels, different types). This behavior is based on the existing MenuManager (Add/Remove, activeMenus, show/hide) and common panel semantics.
1. getControlByName(name: string): GUIControl | undefined
GUIControl | undefinedso missing controls are typed correctly.undefinedand logging.BTN_QUIT,LBL_TITLE).2. hide(): void
GameState.scene_gui.remove(...)ifthis.tGuiPanel?.getControl()exists (avoids errors before the menu is loaded).voidreturn type.3. show(): void
this.tGuiPanel?.getControl()is missing.this.childMenu.tGuiPanel?.updateBoundsRecursive?.()so child bounds update is safe when panel isn’t ready.voidreturn type.4. close(): void
this.manager?.Remove?.(this)only whenmanagerandRemoveexist, so close is safe before the menu is added to a manager.5. open(): void
this.manager?.Add?.(this)only whenmanagerandAddexist.6. remove(): void (was TODO)
this.close()so “remove from stack and hide” is a single, consistent action.close(); name clarifies “remove from stack” for API users.Overall, the menu stack behavior (open = Add + show, close = hide + Remove, remove = close) matches the existing MenuManager and is robust when panels or manager are not yet set.