mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
refactor(ui): move scale property to subclasses and fix resize event handling
Remove scale from base Widget class and add per-type set_scale/scale methods to Button, Image, and Label. Dispatch separate WindowResizeEvent alongside existing FrameBufferResizeEvent. Correct centering calculations from `+` to `-` in main menu and world UI managers.
This commit is contained in:
@@ -15,7 +15,10 @@ Label& Label::set_color(Color color) {
|
||||
m_text.color = color;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Label& Label::set_scale(float scale) {
|
||||
m_scale = scale;
|
||||
return *this;
|
||||
}
|
||||
void Label::update(float dt) { on_update(dt); }
|
||||
|
||||
void Label::on_update(float dt) { (void)dt; }
|
||||
@@ -43,5 +46,5 @@ float Label::width() const { return m_real_width * m_scale; }
|
||||
float Label::height() const { return m_real_height * m_scale; }
|
||||
float Label::offset_x() const { return m_offset_x; }
|
||||
float Label::offset_y() const { return m_offset_y; }
|
||||
|
||||
float Label::scale() const { return m_scale; }
|
||||
} // namespace Cubed
|
||||
Reference in New Issue
Block a user