mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
added aspect ratio in display modes list in settings
This commit is contained in:
parent
9f323857af
commit
101d9de3c3
|
@ -39,6 +39,17 @@ inline float frandom() { return rand()/(float)(RAND_MAX); }
|
|||
inline int f2fx(float v) { return (int)(v*(float)(1<<10)); }
|
||||
inline float fx2f(int v) { return v*(1.0f/(1<<10)); }
|
||||
|
||||
inline unsigned gcd(unsigned a, unsigned b)
|
||||
{
|
||||
while(b != 0)
|
||||
{
|
||||
unsigned c = a % b;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
class fxp
|
||||
{
|
||||
int value;
|
||||
|
|
|
@ -627,7 +627,8 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
// display mode list
|
||||
static float s_ScrollValue = 0;
|
||||
int OldSelected = -1;
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %dx%d %d bit", Localize("Current"), s_GfxScreenWidth, s_GfxScreenHeight, s_GfxColorDepth);
|
||||
int G = gcd(s_GfxScreenWidth, s_GfxScreenHeight);
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %dx%d %d bit (%d:%d)", Localize("Current"), s_GfxScreenWidth, s_GfxScreenHeight, s_GfxColorDepth, s_GfxScreenWidth/G, s_GfxScreenHeight/G);
|
||||
UiDoListboxStart(&s_NumNodes , &ModeList, 24.0f, Localize("Display Modes"), aBuf, s_NumNodes, 1, OldSelected, s_ScrollValue);
|
||||
|
||||
for(int i = 0; i < s_NumNodes; ++i)
|
||||
|
@ -643,7 +644,8 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
CListboxItem Item = UiDoListboxNextItem(&s_aModes[i], OldSelected == i);
|
||||
if(Item.m_Visible)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), " %dx%d %d bit", s_aModes[i].m_Width, s_aModes[i].m_Height, Depth);
|
||||
int G = gcd(s_aModes[i].m_Width, s_aModes[i].m_Height);
|
||||
str_format(aBuf, sizeof(aBuf), " %dx%d %d bit (%d:%d)", s_aModes[i].m_Width, s_aModes[i].m_Height, Depth, s_aModes[i].m_Width/G, s_aModes[i].m_Height/G);
|
||||
UI()->DoLabelScaled(&Item.m_Rect, aBuf, 16.0f, -1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue