GUI: Scale GUI object on resize

This commit is contained in:
Eugene Sandulenko 2021-03-26 01:16:26 +01:00
parent 735ec7367d
commit 81e194d458
4 changed files with 19 additions and 9 deletions

View file

@ -29,6 +29,15 @@
namespace GUI {
#define SCALEVALUE(val) (val > 0 ? val * g_gui.getScaleFactor() : val)
GuiObject::GuiObject(int x, int y, int w, int h) : _useRTL(true), _firstWidget(nullptr) {
_x = SCALEVALUE(x);
_y = SCALEVALUE(y);
_w = SCALEVALUE(w);
_h = SCALEVALUE(h);
}
GuiObject::GuiObject(const Common::String &name)
: _x(-1000), _y(-1000), _w(0), _h(0), _useRTL(true), _name(name), _firstWidget(nullptr) {
}
@ -38,6 +47,13 @@ GuiObject::~GuiObject() {
_firstWidget = nullptr;
}
void GuiObject::resize(int x, int y, int w, int h) {
_x = SCALEVALUE(x);
_y = SCALEVALUE(y);
_w = SCALEVALUE(w);
_h = SCALEVALUE(h);
}
void GuiObject::reflowLayout() {
if (!_name.empty()) {
int16 w, h;