summaryrefslogtreecommitdiff
path: root/src/guiFormSpecMenu.h
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2014-08-20 23:42:27 +0100
committersapier <Sapier at GMX dot net>2014-11-30 17:50:09 +0100
commitd1d6a97b1cd05ec34358b6519fc232fc158cf521 (patch)
treed2cc619058b22fcfa30dc431ec05b8c36a02777c /src/guiFormSpecMenu.h
parentdceb9f7d6058785cf60d9dbcc8eecdcee1053412 (diff)
downloadminetest-d1d6a97b1cd05ec34358b6519fc232fc158cf521.tar.gz
minetest-d1d6a97b1cd05ec34358b6519fc232fc158cf521.tar.bz2
minetest-d1d6a97b1cd05ec34358b6519fc232fc158cf521.zip
Scale form elements consistently
The ratios between the sizes of form elements, including text, is now fixed, aside from variations caused by rounding. This makes form layout almost fully predictable, and particularly independent of player's screen size. The proportions of non-text elements are the traditional proportions. For compatibility, the way in which element positions and sizes are specified remains unchanged, in all its baroqueness, with one exception. The exception is that the position of a label[] element is now defined in terms of the vertically center of the first line of the label, rather than the bottom of the first line of the label. This change allows a label to be precisely aligned with button text or an edit box, which are positioned in a centering manner. Label positioning remains consistent with the previous system, just more precisely defined. Make multi-line label[] elements work properly. Previously the code set a bounding rectangle assuming that there would be only a single line, and as a result a multi-line label would be cut somewhere in the middle of the second line. Now multi-line labels not only work, but have guaranteed line spacing relative to inventory slots, to aid alignment. Incidentally fix tabheader[] elements which were being constrained to the wrong width. Given an unusually large form, in variable-size mode, the form rendering system now chooses a scale that will fit the entire form on the screen, if that doesn't make elements too small. Fixed-size forms, including the main menu, are have their sizes fixed in inch terms. The fixed size for fixed-size forms and the preferred and minimum sizes for variable-size forms all scale according to the gui_scaling parameter.
Diffstat (limited to 'src/guiFormSpecMenu.h')
-rw-r--r--src/guiFormSpecMenu.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h
index df988f5a5..455aeaab8 100644
--- a/src/guiFormSpecMenu.h
+++ b/src/guiFormSpecMenu.h
@@ -348,10 +348,11 @@ private:
unsigned int m_formspec_version;
typedef struct {
+ bool explicit_size;
+ v2f invsize;
v2s32 size;
core::rect<s32> rect;
v2s32 basepos;
- int bp_set;
v2u32 screensize;
std::wstring focused_fieldname;
GUITable::TableOptions table_options;
@@ -398,6 +399,7 @@ private:
void parseListColors(parserData* data,std::string element);
void parseTooltip(parserData* data,std::string element);
bool parseVersionDirect(std::string data);
+ bool parseSizeDirect(parserData* data, std::string element);
void parseScrollBar(parserData* data, std::string element);
/**
@@ -415,6 +417,7 @@ private:
clickpos m_doubleclickdetect[2];
int m_btn_height;
+ gui::IGUIFont *m_font;
std::wstring getLabelByID(s32 id);
std::wstring getNameByID(s32 id);