mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
changed some stupid things
This commit is contained in:
parent
509be82c4b
commit
37c970bc49
|
@ -649,147 +649,37 @@ static int gs_ListBoxItemsPerRow;
|
||||||
static float gs_ListBoxScrollValue;
|
static float gs_ListBoxScrollValue;
|
||||||
static bool gs_ListBoxItemActivated;
|
static bool gs_ListBoxItemActivated;
|
||||||
|
|
||||||
void CMenus::UiDoListboxStart(const void *pID, const CUIRect *pRect, float RowHeight, const char *pTitle, const char *pBottomText, int NumItems,
|
void CMenus::UiDoListboxHeader(const CUIRect *pRect, const char *pTitle, float HeaderHeight, float Spaceing)
|
||||||
int ItemsPerRow, int SelectedIndex, float ScrollValue)
|
|
||||||
{
|
{
|
||||||
CUIRect Scroll, Row;
|
CUIRect Header;
|
||||||
CUIRect View = *pRect;
|
CUIRect View = *pRect;
|
||||||
CUIRect Header, Footer;
|
|
||||||
|
|
||||||
// background
|
// background
|
||||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
View.HSplitTop(ms_ListheaderHeight+Spaceing, &Header, 0);
|
||||||
|
RenderTools()->DrawUIRect(&Header, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_T, 5.0f);
|
||||||
|
|
||||||
// draw header
|
// draw header
|
||||||
View.HSplitTop(ms_ListheaderHeight, &Header, &View);
|
View.HSplitTop(ms_ListheaderHeight, &Header, &View);
|
||||||
UI()->DoLabel(&Header, pTitle, Header.h*ms_FontmodHeight, 0);
|
UI()->DoLabel(&Header, pTitle, Header.h*ms_FontmodHeight, 0);
|
||||||
|
|
||||||
// draw footers
|
View.HSplitTop(Spaceing, &Header, &View);
|
||||||
View.HSplitBottom(ms_ListheaderHeight, &View, &Footer);
|
|
||||||
Footer.VSplitLeft(10.0f, 0, &Footer);
|
|
||||||
UI()->DoLabel(&Footer, pBottomText, Footer.h*ms_FontmodHeight, 0);
|
|
||||||
|
|
||||||
// list background
|
|
||||||
View.HSplitTop(2.0f, 0, &View);
|
|
||||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), 0, 0.0f);
|
|
||||||
|
|
||||||
// prepare the scroll
|
|
||||||
View.VSplitRight(20.0f, &View, &Scroll);
|
|
||||||
|
|
||||||
// setup the variables
|
// setup the variables
|
||||||
gs_ListBoxOriginalView = View;
|
gs_ListBoxOriginalView = View;
|
||||||
gs_ListBoxSelectedIndex = SelectedIndex;
|
|
||||||
gs_ListBoxNewSelected = SelectedIndex;
|
|
||||||
gs_ListBoxItemIndex = 0;
|
|
||||||
gs_ListBoxRowHeight = RowHeight;
|
|
||||||
gs_ListBoxNumItems = NumItems;
|
|
||||||
gs_ListBoxItemsPerRow = ItemsPerRow;
|
|
||||||
gs_ListBoxDoneEvents = 0;
|
|
||||||
gs_ListBoxScrollValue = ScrollValue;
|
|
||||||
gs_ListBoxItemActivated = false;
|
|
||||||
|
|
||||||
// do the scrollbar
|
|
||||||
View.HSplitTop(gs_ListBoxRowHeight, &Row, 0);
|
|
||||||
|
|
||||||
int NumViewable = (int)(gs_ListBoxOriginalView.h/Row.h) + 1;
|
|
||||||
int Num = (NumItems+gs_ListBoxItemsPerRow-1)/gs_ListBoxItemsPerRow-NumViewable+1;
|
|
||||||
if(Num < 0)
|
|
||||||
Num = 0;
|
|
||||||
if(Num > 0)
|
|
||||||
{
|
|
||||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP) && UI()->MouseInside(&View))
|
|
||||||
gs_ListBoxScrollValue -= 3.0f/Num;
|
|
||||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN) && UI()->MouseInside(&View))
|
|
||||||
gs_ListBoxScrollValue += 3.0f/Num;
|
|
||||||
|
|
||||||
if(gs_ListBoxScrollValue < 0.0f) gs_ListBoxScrollValue = 0.0f;
|
|
||||||
if(gs_ListBoxScrollValue > 1.0f) gs_ListBoxScrollValue = 1.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Scroll.HMargin(5.0f, &Scroll);
|
void CMenus::UiDoListboxStart(const void *pID, float RowHeight, const char *pBottomText, int NumItems,
|
||||||
gs_ListBoxScrollValue = DoScrollbarV(pID, &Scroll, gs_ListBoxScrollValue);
|
int ItemsPerRow, int SelectedIndex, float ScrollValue, const CUIRect *pRect)
|
||||||
|
|
||||||
// the list
|
|
||||||
gs_ListBoxView = gs_ListBoxOriginalView;
|
|
||||||
gs_ListBoxView.VMargin(5.0f, &gs_ListBoxView);
|
|
||||||
UI()->ClipEnable(&gs_ListBoxView);
|
|
||||||
gs_ListBoxView.y -= gs_ListBoxScrollValue*Num*Row.h;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMenus::UiDoListboxStartVideo(const void *pID, const CUIRect *pRect, float RowHeight, const char *pTitle, const char *pBottomText, int NumItems,
|
|
||||||
int ItemsPerRow, int SelectedIndex, float ScrollValue, float ButtonHeight, float Spaceing)
|
|
||||||
{
|
{
|
||||||
CUIRect Scroll, Row, Left, Right;
|
CUIRect View, Scroll, Row;
|
||||||
CUIRect View = *pRect;
|
if(pRect)
|
||||||
|
View = *pRect;
|
||||||
|
else
|
||||||
|
View = gs_ListBoxOriginalView;
|
||||||
CUIRect Header, Footer;
|
CUIRect Header, Footer;
|
||||||
|
|
||||||
// background
|
// background
|
||||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_B, 5.0f);
|
||||||
|
|
||||||
// draw header
|
|
||||||
View.HSplitTop(ms_ListheaderHeight, &Header, &View);
|
|
||||||
UI()->DoLabel(&Header, pTitle, Header.h*ms_FontmodHeight, 0);
|
|
||||||
|
|
||||||
// supported modes button
|
|
||||||
View.HSplitTop(Spaceing, 0, &View);
|
|
||||||
View.HSplitTop(ButtonHeight, &Left, &View);
|
|
||||||
Left.VSplitMid(&Left, &Right);
|
|
||||||
Left.VSplitRight(1.5f, &Left, 0);
|
|
||||||
Right.VSplitLeft(1.5f, 0, &Right);
|
|
||||||
static int s_GfxDisplayAllModes = 0;
|
|
||||||
if(DoButton_CheckBox(&s_GfxDisplayAllModes, Localize("Show only supported"), g_Config.m_GfxDisplayAllModes^1, &Left))
|
|
||||||
{
|
|
||||||
g_Config.m_GfxDisplayAllModes ^= 1;
|
|
||||||
m_NumModes = Graphics()->GetVideoModes(m_aModes, MAX_RESOLUTIONS);
|
|
||||||
UpdateVideoFormats();
|
|
||||||
|
|
||||||
bool Found = false;
|
|
||||||
for(int i = 0; i < m_NumVideoFormats; i++)
|
|
||||||
{
|
|
||||||
int G = gcd(g_Config.m_GfxScreenWidth, g_Config.m_GfxScreenHeight);
|
|
||||||
if(m_aVideoFormats[i].m_WidthValue == g_Config.m_GfxScreenWidth/G && m_aVideoFormats[i].m_HeightValue == g_Config.m_GfxScreenHeight/G)
|
|
||||||
{
|
|
||||||
m_CurrentVideoFormat = i;
|
|
||||||
Found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!Found)
|
|
||||||
m_CurrentVideoFormat = 0;
|
|
||||||
|
|
||||||
UpdatedFilteredVideoModes();
|
|
||||||
}
|
|
||||||
|
|
||||||
// format changer
|
|
||||||
{
|
|
||||||
RenderTools()->DrawUIRect(&Right, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
|
||||||
CUIRect Text, Value, Unit;
|
|
||||||
Right.VSplitLeft(Right.w/3.0f, &Text, &Right);
|
|
||||||
Right.VSplitMid(&Value, &Unit);
|
|
||||||
|
|
||||||
char aBuf[32];
|
|
||||||
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Format"));
|
|
||||||
Text.y += 2.0f;
|
|
||||||
UI()->DoLabel(&Text, aBuf, Text.h*ms_FontmodHeight*0.8f, 0);
|
|
||||||
|
|
||||||
Unit.y += 2.0f;
|
|
||||||
if((float)m_aVideoFormats[m_CurrentVideoFormat].m_WidthValue/(float)m_aVideoFormats[m_CurrentVideoFormat].m_HeightValue >= 1.55f)
|
|
||||||
UI()->DoLabel(&Unit, Localize("Wide"), Unit.h*ms_FontmodHeight*0.8f, 0);
|
|
||||||
else
|
|
||||||
UI()->DoLabel(&Unit, Localize("Letterbox"), Unit.h*ms_FontmodHeight*0.8f, 0);
|
|
||||||
|
|
||||||
str_format(aBuf, sizeof(aBuf), "%d:%d", m_aVideoFormats[m_CurrentVideoFormat].m_WidthValue, m_aVideoFormats[m_CurrentVideoFormat].m_HeightValue);
|
|
||||||
static int s_VideoFormatButton = 0;
|
|
||||||
if(DoButton_Menu(&s_VideoFormatButton, aBuf, 0, &Value))
|
|
||||||
{
|
|
||||||
m_CurrentVideoFormat++;
|
|
||||||
if(m_CurrentVideoFormat == m_NumVideoFormats)
|
|
||||||
m_CurrentVideoFormat = 0;
|
|
||||||
|
|
||||||
UpdatedFilteredVideoModes();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw footers
|
// draw footers
|
||||||
View.HSplitBottom(ms_ListheaderHeight, &View, &Footer);
|
View.HSplitBottom(ms_ListheaderHeight, &View, &Footer);
|
||||||
|
@ -797,7 +687,6 @@ void CMenus::UiDoListboxStartVideo(const void *pID, const CUIRect *pRect, float
|
||||||
UI()->DoLabel(&Footer, pBottomText, Footer.h*ms_FontmodHeight, 0);
|
UI()->DoLabel(&Footer, pBottomText, Footer.h*ms_FontmodHeight, 0);
|
||||||
|
|
||||||
// list background
|
// list background
|
||||||
View.HSplitTop(Spaceing, 0, &View);
|
|
||||||
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), 0, 0.0f);
|
RenderTools()->DrawUIRect(&View, vec4(0.0f, 0.0f, 0.0f, 0.25f), 0, 0.0f);
|
||||||
|
|
||||||
// prepare the scroll
|
// prepare the scroll
|
||||||
|
@ -1906,7 +1795,8 @@ int CMenus::Render()
|
||||||
ActSelection = Country;
|
ActSelection = Country;
|
||||||
static float s_ScrollValue = 0.0f;
|
static float s_ScrollValue = 0.0f;
|
||||||
int OldSelected = -1;
|
int OldSelected = -1;
|
||||||
UiDoListboxStart(&s_ScrollValue, &Box, 50.0f, Localize("Country"), "", m_pClient->m_pCountryFlags->Num(), 6, OldSelected, s_ScrollValue);
|
UiDoListboxHeader(&Box, Localize("Country"), 20.0f, 2.0f);
|
||||||
|
UiDoListboxStart(&s_ScrollValue, 50.0f, "", m_pClient->m_pCountryFlags->Num(), 6, OldSelected, s_ScrollValue);
|
||||||
|
|
||||||
for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i)
|
for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,10 +99,9 @@ class CMenus : public CComponent
|
||||||
CUIRect m_HitRect;
|
CUIRect m_HitRect;
|
||||||
};
|
};
|
||||||
|
|
||||||
void UiDoListboxStart(const void *pID, const CUIRect *pRect, float RowHeight, const char *pTitle, const char *pBottomText, int NumItems,
|
void UiDoListboxHeader(const CUIRect *pRect, const char *pTitle, float HeaderHeight, float Spaceing);
|
||||||
int ItemsPerRow, int SelectedIndex, float ScrollValue);
|
void UiDoListboxStart(const void *pID, float RowHeight, const char *pBottomText, int NumItems,
|
||||||
void UiDoListboxStartVideo(const void *pID, const CUIRect *pRect, float RowHeight, const char *pTitle, const char *pBottomText, int NumItems,
|
int ItemsPerRow, int SelectedIndex, float ScrollValue, const CUIRect *pRect=0);
|
||||||
int ItemsPerRow, int SelectedIndex, float ScrollValue, float ButtonHeight, float Spaceing);
|
|
||||||
CListboxItem UiDoListboxNextItem(const void *pID, bool Selected = false);
|
CListboxItem UiDoListboxNextItem(const void *pID, bool Selected = false);
|
||||||
CListboxItem UiDoListboxNextRow();
|
CListboxItem UiDoListboxNextRow();
|
||||||
int UiDoListboxEnd(float *pScrollValue, bool *pItemActivated);
|
int UiDoListboxEnd(float *pScrollValue, bool *pItemActivated);
|
||||||
|
|
|
@ -1153,7 +1153,8 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
|
||||||
// friends list(remove friend)
|
// friends list(remove friend)
|
||||||
static float s_ScrollValue = 0;
|
static float s_ScrollValue = 0;
|
||||||
static int s_FriendsList = 0;
|
static int s_FriendsList = 0;
|
||||||
UiDoListboxStart(&s_FriendsList, &List, 30.0f, "", "", m_lFriends.size(), 1, m_FriendlistSelectedIndex, s_ScrollValue);
|
UiDoListboxHeader(&List, "", 20.0f, 2.0f);
|
||||||
|
UiDoListboxStart(&s_FriendsList, 30.0f, "", m_lFriends.size(), 1, m_FriendlistSelectedIndex, s_ScrollValue);
|
||||||
|
|
||||||
m_lFriends.sort_range();
|
m_lFriends.sort_range();
|
||||||
for(int i = 0; i < m_lFriends.size(); ++i)
|
for(int i = 0; i < m_lFriends.size(); ++i)
|
||||||
|
|
|
@ -416,7 +416,8 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
||||||
|
|
||||||
static int s_DemoListId = 0;
|
static int s_DemoListId = 0;
|
||||||
static float s_ScrollValue = 0;
|
static float s_ScrollValue = 0;
|
||||||
UiDoListboxStart(&s_DemoListId, &ListBox, 17.0f, Localize("Demos"), aFooterLabel, m_lDemos.size(), 1, m_DemolistSelectedIndex, s_ScrollValue);
|
UiDoListboxHeader(&ListBox, Localize("Demos"), 20.0f, 2.0f);
|
||||||
|
UiDoListboxStart(&s_DemoListId, 17.0f, aFooterLabel, m_lDemos.size(), 1, m_DemolistSelectedIndex, s_ScrollValue);
|
||||||
for(sorted_array<CDemoItem>::range r = m_lDemos.all(); !r.empty(); r.pop_front())
|
for(sorted_array<CDemoItem>::range r = m_lDemos.all(); !r.empty(); r.pop_front())
|
||||||
{
|
{
|
||||||
CListboxItem Item = UiDoListboxNextItem((void*)(&r.front()));
|
CListboxItem Item = UiDoListboxNextItem((void*)(&r.front()));
|
||||||
|
|
|
@ -316,7 +316,8 @@ void CMenus::RenderServerControlServer(CUIRect MainView)
|
||||||
static int s_VoteList = 0;
|
static int s_VoteList = 0;
|
||||||
static float s_ScrollValue = 0;
|
static float s_ScrollValue = 0;
|
||||||
CUIRect List = MainView;
|
CUIRect List = MainView;
|
||||||
UiDoListboxStart(&s_VoteList, &List, 24.0f, "", "", m_pClient->m_pVoting->m_NumVoteOptions, 1, m_CallvoteSelectedOption, s_ScrollValue);
|
UiDoListboxHeader(&List, "", 20.0f, 2.0f);
|
||||||
|
UiDoListboxStart(&s_VoteList, 24.0f, "", m_pClient->m_pVoting->m_NumVoteOptions, 1, m_CallvoteSelectedOption, s_ScrollValue);
|
||||||
|
|
||||||
for(CVoteOptionClient *pOption = m_pClient->m_pVoting->m_pFirst; pOption; pOption = pOption->m_pNext)
|
for(CVoteOptionClient *pOption = m_pClient->m_pVoting->m_pFirst; pOption; pOption = pOption->m_pNext)
|
||||||
{
|
{
|
||||||
|
@ -351,7 +352,8 @@ void CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
|
||||||
static int s_VoteList = 0;
|
static int s_VoteList = 0;
|
||||||
static float s_ScrollValue = 0;
|
static float s_ScrollValue = 0;
|
||||||
CUIRect List = MainView;
|
CUIRect List = MainView;
|
||||||
UiDoListboxStart(&s_VoteList, &List, 24.0f, "", "", NumOptions, 1, Selected, s_ScrollValue);
|
UiDoListboxHeader(&List, "", 20.0f, 2.0f);
|
||||||
|
UiDoListboxStart(&s_VoteList, 24.0f, "", NumOptions, 1, Selected, s_ScrollValue);
|
||||||
|
|
||||||
for(int i = 0; i < NumOptions; i++)
|
for(int i = 0; i < NumOptions; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -318,7 +318,8 @@ void CMenus::RenderSkinSelection(CUIRect MainView)
|
||||||
s_InitSkinlist = false;
|
s_InitSkinlist = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UiDoListboxStart(&s_InitSkinlist, &MainView, 50.0f, Localize("Skins"), "", s_paSkinList.size(), 4, -1, s_ScrollValue);
|
UiDoListboxHeader(&MainView, Localize("Skins"), 20.0f, 2.0f);
|
||||||
|
UiDoListboxStart(&s_InitSkinlist, 50.0f, "", s_paSkinList.size(), 4, -1, s_ScrollValue);
|
||||||
|
|
||||||
for(int i = 0; i < s_paSkinList.size(); ++i)
|
for(int i = 0; i < s_paSkinList.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -404,7 +405,8 @@ void CMenus::RenderSkinPartSelection(CUIRect MainView)
|
||||||
const char *const s_apTitles[6] = {Localize("Bodies"), Localize("Tattoos"), Localize("Decoration"),
|
const char *const s_apTitles[6] = {Localize("Bodies"), Localize("Tattoos"), Localize("Decoration"),
|
||||||
Localize("Hands"), Localize("Feet"), Localize("Eyes")};
|
Localize("Hands"), Localize("Feet"), Localize("Eyes")};
|
||||||
|
|
||||||
UiDoListboxStart(&s_InitSkinPartList, &MainView, 50.0f, s_apTitles[p], "", s_paList[p].size(), 4, -1, s_ScrollValue);
|
UiDoListboxHeader(&MainView, s_apTitles[p], 20.0f, 2.0f);
|
||||||
|
UiDoListboxStart(&s_InitSkinPartList, 50.0f, "", s_paList[p].size(), 4, -1, s_ScrollValue);
|
||||||
|
|
||||||
for(int i = 0; i < s_paList[p].size(); ++i)
|
for(int i = 0; i < s_paList[p].size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -551,7 +553,8 @@ void CMenus::RenderLanguageSelection(CUIRect MainView)
|
||||||
|
|
||||||
int OldSelected = s_SelectedLanguage;
|
int OldSelected = s_SelectedLanguage;
|
||||||
|
|
||||||
UiDoListboxStart(&s_LanguageList , &MainView, 24.0f, Localize("Language"), "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue);
|
UiDoListboxHeader(&MainView, Localize("Language"), 20.0f, 2.0f);
|
||||||
|
UiDoListboxStart(&s_LanguageList, 24.0f, "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue);
|
||||||
|
|
||||||
for(sorted_array<CLanguage>::range r = s_Languages.all(); !r.empty(); r.pop_front())
|
for(sorted_array<CLanguage>::range r = s_Languages.all(); !r.empty(); r.pop_front())
|
||||||
{
|
{
|
||||||
|
@ -780,7 +783,8 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
|
||||||
MainView.HSplitTop(10.0f, 0, &MainView);
|
MainView.HSplitTop(10.0f, 0, &MainView);
|
||||||
static float s_ScrollValue = 0.0f;
|
static float s_ScrollValue = 0.0f;
|
||||||
int OldSelected = -1;
|
int OldSelected = -1;
|
||||||
UiDoListboxStart(&s_ScrollValue, &MainView, 40.0f, Localize("Country"), "", m_pClient->m_pCountryFlags->Num(), 18, OldSelected, s_ScrollValue);
|
UiDoListboxHeader(&MainView, Localize("Country"), 20.0f, 2.0f);
|
||||||
|
UiDoListboxStart(&s_ScrollValue, 40.0f, "", m_pClient->m_pCountryFlags->Num(), 18, OldSelected, s_ScrollValue);
|
||||||
|
|
||||||
for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i)
|
for(int i = 0; i < m_pClient->m_pCountryFlags->Num(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -1397,12 +1401,85 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
||||||
|
|
||||||
// display mode list
|
// display mode list
|
||||||
{
|
{
|
||||||
|
// custom list header
|
||||||
|
CUIRect Header, Left, Right;
|
||||||
|
MainView.HSplitTop(ButtonHeight*2.0f+Spaceing*2.0f, &Header, 0);
|
||||||
|
RenderTools()->DrawUIRect(&Header, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_T, 5.0f);
|
||||||
|
|
||||||
|
// draw header
|
||||||
|
MainView.HSplitTop(ButtonHeight, &Header, &MainView);
|
||||||
|
UI()->DoLabel(&Header, Localize("Resolutions"), Header.h*ms_FontmodHeight, 0);
|
||||||
|
|
||||||
|
// supported modes button
|
||||||
|
MainView.HSplitTop(Spaceing, 0, &MainView);
|
||||||
|
MainView.HSplitTop(ButtonHeight, &Left, &MainView);
|
||||||
|
Left.VSplitMid(&Left, &Right);
|
||||||
|
Left.VSplitRight(1.5f, &Left, 0);
|
||||||
|
Right.VSplitLeft(1.5f, 0, &Right);
|
||||||
|
static int s_GfxDisplayAllModes = 0;
|
||||||
|
if(DoButton_CheckBox(&s_GfxDisplayAllModes, Localize("Show only supported"), g_Config.m_GfxDisplayAllModes^1, &Left))
|
||||||
|
{
|
||||||
|
g_Config.m_GfxDisplayAllModes ^= 1;
|
||||||
|
m_NumModes = Graphics()->GetVideoModes(m_aModes, MAX_RESOLUTIONS);
|
||||||
|
UpdateVideoFormats();
|
||||||
|
|
||||||
|
bool Found = false;
|
||||||
|
for(int i = 0; i < m_NumVideoFormats; i++)
|
||||||
|
{
|
||||||
|
int G = gcd(g_Config.m_GfxScreenWidth, g_Config.m_GfxScreenHeight);
|
||||||
|
if(m_aVideoFormats[i].m_WidthValue == g_Config.m_GfxScreenWidth/G && m_aVideoFormats[i].m_HeightValue == g_Config.m_GfxScreenHeight/G)
|
||||||
|
{
|
||||||
|
m_CurrentVideoFormat = i;
|
||||||
|
Found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!Found)
|
||||||
|
m_CurrentVideoFormat = 0;
|
||||||
|
|
||||||
|
UpdatedFilteredVideoModes();
|
||||||
|
}
|
||||||
|
|
||||||
|
// format changer
|
||||||
|
{
|
||||||
|
RenderTools()->DrawUIRect(&Right, vec4(0.0f, 0.0f, 0.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
|
CUIRect Text, Value, Unit;
|
||||||
|
Right.VSplitLeft(Right.w/3.0f, &Text, &Right);
|
||||||
|
Right.VSplitMid(&Value, &Unit);
|
||||||
|
|
||||||
|
char aBuf[32];
|
||||||
|
str_format(aBuf, sizeof(aBuf), "%s:", Localize("Format"));
|
||||||
|
Text.y += 2.0f;
|
||||||
|
UI()->DoLabel(&Text, aBuf, Text.h*ms_FontmodHeight*0.8f, 0);
|
||||||
|
|
||||||
|
Unit.y += 2.0f;
|
||||||
|
if((float)m_aVideoFormats[m_CurrentVideoFormat].m_WidthValue/(float)m_aVideoFormats[m_CurrentVideoFormat].m_HeightValue >= 1.55f)
|
||||||
|
UI()->DoLabel(&Unit, Localize("Wide"), Unit.h*ms_FontmodHeight*0.8f, 0);
|
||||||
|
else
|
||||||
|
UI()->DoLabel(&Unit, Localize("Letterbox"), Unit.h*ms_FontmodHeight*0.8f, 0);
|
||||||
|
|
||||||
|
str_format(aBuf, sizeof(aBuf), "%d:%d", m_aVideoFormats[m_CurrentVideoFormat].m_WidthValue, m_aVideoFormats[m_CurrentVideoFormat].m_HeightValue);
|
||||||
|
static int s_VideoFormatButton = 0;
|
||||||
|
if(DoButton_Menu(&s_VideoFormatButton, aBuf, 0, &Value))
|
||||||
|
{
|
||||||
|
m_CurrentVideoFormat++;
|
||||||
|
if(m_CurrentVideoFormat == m_NumVideoFormats)
|
||||||
|
m_CurrentVideoFormat = 0;
|
||||||
|
|
||||||
|
UpdatedFilteredVideoModes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MainView.HSplitTop(Spaceing, 0, &MainView);
|
||||||
|
|
||||||
static float s_ScrollValue = 0;
|
static float s_ScrollValue = 0;
|
||||||
static int s_DisplayModeList = 0;
|
static int s_DisplayModeList = 0;
|
||||||
int OldSelected = -1;
|
int OldSelected = -1;
|
||||||
int G = gcd(s_GfxScreenWidth, s_GfxScreenHeight);
|
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);
|
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);
|
||||||
UiDoListboxStartVideo(&s_DisplayModeList , &MainView, 24.0f, Localize("Display Modes"), aBuf, m_NumFilteredVideoModes, 1, OldSelected, s_ScrollValue, ButtonHeight, Spaceing); // ugly
|
UiDoListboxStart(&s_DisplayModeList, 24.0f, aBuf, m_NumFilteredVideoModes, 1, OldSelected, s_ScrollValue, &MainView);
|
||||||
|
|
||||||
for(int i = 0; i < m_NumFilteredVideoModes; ++i)
|
for(int i = 0; i < m_NumFilteredVideoModes; ++i)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue