AMFP Enhanced
C++ reference: the code this unofficial fork added
Loading...
Searching...
No Matches
LuxMenuScale.h
Go to the documentation of this file.
1/*
2 * AMFP-2026: menu size on high-resolution screens. The main and pause menu windows (Options,
3 * Load game, Profiles, pop-ups) are authored in screen pixels for the 1024x768-era screens the
4 * engine targeted, so they shrank as screens grew: a third of a 1080p screen, a quarter of a
5 * Retina panel. The menu GUI set gets a virtual canvas of screen / k, k = height / 768 (never
6 * below 1): windows keep their 768p proportions at any resolution, items placed by relative
7 * size stay put. Main config [Graphics] FixMenuScale="false" restores the stock pixel sizes.
8 * Pure, unit tested in tests/cpp/test_menu_scale.cpp.
9 */
10#ifndef LUX_MENU_SCALE_H
11#define LUX_MENU_SCALE_H
12
13static const float kLuxMenuReferenceHeight = 768.0f;
14
15/** Screen pixels per menu unit (1 = stock). */
16inline float LuxMenuScale(float afScreenHeight, bool abFix)
17{
18 if(!abFix || !(afScreenHeight > kLuxMenuReferenceHeight)) return 1.0f;
19 return afScreenHeight / kLuxMenuReferenceHeight;
20}
21
22/** The menu's virtual canvas for a screen size. */
23inline void LuxMenuVirtualSize(float afScreenW, float afScreenH, bool abFix, float& afOutW, float& afOutH)
24{
25 float k = LuxMenuScale(afScreenH, abFix);
26 afOutW = afScreenW / k;
27 afOutH = afScreenH / k;
28}
29
30#endif
static const float kLuxMenuReferenceHeight
float LuxMenuScale(float afScreenHeight, bool abFix)
Screen pixels per menu unit (1 = stock).
void LuxMenuVirtualSize(float afScreenW, float afScreenH, bool abFix, float &afOutW, float &afOutH)
The menu's virtual canvas for a screen size.