mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 03:28:19 +00:00
show alpha2 country code strings next to the flag in the country code selectors. Closes #805
This commit is contained in:
parent
8d0cc2a825
commit
10c3e844d7
|
@ -69,6 +69,7 @@ void CCountryFlags::LoadCountryflagsIndexfile()
|
||||||
// add entry
|
// add entry
|
||||||
CCountryFlag CountryFlag;
|
CCountryFlag CountryFlag;
|
||||||
CountryFlag.m_CountryCode = CountryCode;
|
CountryFlag.m_CountryCode = CountryCode;
|
||||||
|
str_copy(CountryFlag.m_aCountryCodeString, aOrigin, sizeof(CountryFlag.m_aCountryCodeString));
|
||||||
CountryFlag.m_Texture = Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, Info.m_Format, 0);
|
CountryFlag.m_Texture = Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, Info.m_Format, 0);
|
||||||
mem_free(Info.m_pData);
|
mem_free(Info.m_pData);
|
||||||
str_format(aBuf, sizeof(aBuf), "loaded country flag '%s'", aOrigin);
|
str_format(aBuf, sizeof(aBuf), "loaded country flag '%s'", aOrigin);
|
||||||
|
|
|
@ -12,9 +12,10 @@ public:
|
||||||
struct CCountryFlag
|
struct CCountryFlag
|
||||||
{
|
{
|
||||||
int m_CountryCode;
|
int m_CountryCode;
|
||||||
|
char m_aCountryCodeString[8];
|
||||||
int m_Texture;
|
int m_Texture;
|
||||||
|
|
||||||
bool operator<(const CCountryFlag &Other) { return m_CountryCode < Other.m_CountryCode; }
|
bool operator<(const CCountryFlag &Other) { return str_comp(m_aCountryCodeString, Other.m_aCountryCodeString) < 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
void OnInit();
|
void OnInit();
|
||||||
|
|
|
@ -1125,7 +1125,9 @@ int CMenus::Render()
|
||||||
CListboxItem Item = UiDoListboxNextItem(&pEntry->m_CountryCode, OldSelected == i);
|
CListboxItem Item = UiDoListboxNextItem(&pEntry->m_CountryCode, OldSelected == i);
|
||||||
if(Item.m_Visible)
|
if(Item.m_Visible)
|
||||||
{
|
{
|
||||||
Item.m_Rect.Margin(10.0f, &Item.m_Rect);
|
CUIRect Label;
|
||||||
|
Item.m_Rect.Margin(5.0f, &Item.m_Rect);
|
||||||
|
Item.m_Rect.HSplitBottom(10.0f, &Item.m_Rect, &Label);
|
||||||
float OldWidth = Item.m_Rect.w;
|
float OldWidth = Item.m_Rect.w;
|
||||||
Item.m_Rect.w = Item.m_Rect.h*2;
|
Item.m_Rect.w = Item.m_Rect.h*2;
|
||||||
Item.m_Rect.x += (OldWidth-Item.m_Rect.w)/ 2.0f;
|
Item.m_Rect.x += (OldWidth-Item.m_Rect.w)/ 2.0f;
|
||||||
|
@ -1135,6 +1137,7 @@ int CMenus::Render()
|
||||||
IGraphics::CQuadItem QuadItem(Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
|
IGraphics::CQuadItem QuadItem(Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
|
||||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||||
Graphics()->QuadsEnd();
|
Graphics()->QuadsEnd();
|
||||||
|
UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,9 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
|
||||||
CListboxItem Item = UiDoListboxNextItem(&pEntry->m_CountryCode, OldSelected == i);
|
CListboxItem Item = UiDoListboxNextItem(&pEntry->m_CountryCode, OldSelected == i);
|
||||||
if(Item.m_Visible)
|
if(Item.m_Visible)
|
||||||
{
|
{
|
||||||
Item.m_Rect.Margin(10.0f, &Item.m_Rect);
|
CUIRect Label;
|
||||||
|
Item.m_Rect.Margin(5.0f, &Item.m_Rect);
|
||||||
|
Item.m_Rect.HSplitBottom(10.0f, &Item.m_Rect, &Label);
|
||||||
float OldWidth = Item.m_Rect.w;
|
float OldWidth = Item.m_Rect.w;
|
||||||
Item.m_Rect.w = Item.m_Rect.h*2;
|
Item.m_Rect.w = Item.m_Rect.h*2;
|
||||||
Item.m_Rect.x += (OldWidth-Item.m_Rect.w)/ 2.0f;
|
Item.m_Rect.x += (OldWidth-Item.m_Rect.w)/ 2.0f;
|
||||||
|
@ -225,6 +227,7 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
|
||||||
IGraphics::CQuadItem QuadItem(Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
|
IGraphics::CQuadItem QuadItem(Item.m_Rect.x, Item.m_Rect.y, Item.m_Rect.w, Item.m_Rect.h);
|
||||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||||
Graphics()->QuadsEnd();
|
Graphics()->QuadsEnd();
|
||||||
|
UI()->DoLabel(&Label, pEntry->m_aCountryCodeString, 10.0f, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue