Ratio, percentage or pixels
The three accepted spellings for a position or a size.
Several properties are written with two numbers separated by a space: x y. This is the case for pos, size, maxSize, origin, rotationOrigin, logoSize and reflection.
Each number accepts three spellings, and you can mix them within the same pair.
| Spelling | Example | What it means |
|---|---|---|
| Ratio (the default) | 0.5 0.25 | a proportion of the screen, from 0 to 1 |
| Percentage | 50% 25% | the same thing, written differently |
| Pixels | 960p 270p | real pixels, p suffix |
<pos>0.5 0.5</pos> <!-- the center -->
<pos>50% 50%</pos> <!-- exactly the same -->
<pos>960p 540p</pos> <!-- the center… of a 1920×1080 screen only -->
Ratio or percentage: to be preferred
x is a proportion of the width, y of the height. A component at 0.5 0.5 is at the center of a 1920×1080 as of a 640×480. That is what lets a theme fit several screens.
Pixels: a fixed position
A pixel is a pixel. 960p is 960 pixels from the left edge, period.
It adapts to nothing: on a screen less than 960 pixels wide, the component is off screen. It is an absolute position, the opposite of the ratio.
Pixels are therefore only justified for what must stay fixed whatever the resolution: the thickness of a rule, an offset of a few points. For everything else, take the ratio.
The special case of fontSize
fontSize takes only one number, and its unit depends on its value:
| Value | What it means |
|---|---|
< 1 | a proportion of the screen's short side — 0.05 = 5% of the height in 16:9 |
>= 1 | a 240p reference size, which Recalbox multiplies for the screen |
Above 1, the value is not pixels. It is a size designed for a 240-line screen, multiplied one notch at each resolution step: ×1 up to a short side of 288 pixels, ×2 up to 576, ×4 at 1080p. <fontSize>8</fontSize> therefore makes 16 pixels on a 480p screen and 32 pixels at 1080p. The same rule applies everywhere — menu texts included.
<fontSize>0.045</fontSize> <!-- 4.5% of the short side: adapts everywhere, to be preferred -->
<fontSize>8</fontSize> <!-- “240p” size: 16 px at 480p, 32 px at 1080p -->