mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
feat(main_menu): add exit button and refactor layout with ColumnLayout
- Add `should_close_window()` method to force window close from UI. - Replace standalone button with ColumnLayout for proper centering. - Add "Exit" button that calls `should_close_window()`. - Update ESC key handling to only close window when game is not running. - Fix ColumnLayout to respect parent's anchor instead of hardcoded TOP_LEFT. - Remove unused parameter name in Image::update for consistency.
This commit is contained in:
@@ -16,7 +16,7 @@ void ColumnLayout::layout() {
|
||||
int y = 0;
|
||||
for (auto& child : children) {
|
||||
child->set_offset({0, y});
|
||||
child->set_anchor(Anchor::TOP_LEFT);
|
||||
child->set_anchor(m_anchor);
|
||||
y += child->height() + m_spacing;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user