Skip to content
Browse files

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

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.
  • Loading branch information
Zefram authored and sapier committed Nov 30, 2014
1 parent dceb9f7 commit d1d6a97b1cd05ec34358b6519fc232fc158cf521
Showing with 287 additions and 209 deletions.
  1. +0 −3 src/constants.h
  2. +283 −205 src/guiFormSpecMenu.cpp
  3. +4 −1 src/guiFormSpecMenu.h
@@ -100,9 +100,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define LEGACY_SCALING (2./3.)
#define DEFAULT_FONT_SIZE (14)
#define DEFAULT_IMGSIZE (48.0)
#define DEFAULT_XSPACING ((15.0 + (1.0 / 3.0)))
#define DEFAULT_YSPACING (9.0)


0 comments on commit d1d6a97

Please sign in to comment.