AMFP Enhanced
C++ reference: the code this unofficial fork added
Toggle main menu visibility
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
13
static
const
float
kLuxMenuReferenceHeight
= 768.0f;
14
15
/** Screen pixels per menu unit (1 = stock). */
16
inline
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. */
23
inline
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
kLuxMenuReferenceHeight
static const float kLuxMenuReferenceHeight
Definition
LuxMenuScale.h:13
LuxMenuScale
float LuxMenuScale(float afScreenHeight, bool abFix)
Screen pixels per menu unit (1 = stock).
Definition
LuxMenuScale.h:16
LuxMenuVirtualSize
void LuxMenuVirtualSize(float afScreenW, float afScreenH, bool abFix, float &afOutW, float &afOutH)
The menu's virtual canvas for a screen size.
Definition
LuxMenuScale.h:23
Game
src
game
LuxMenuScale.h
Generated by
1.18.0