mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
-removed color depth config variable
-updated fake list of resolutions -make sure resolutions are sorted in menu
This commit is contained in:
parent
e3da49eac3
commit
d3f642a641
|
@ -37,27 +37,18 @@
|
|||
|
||||
|
||||
static CVideoMode g_aFakeModes[] = {
|
||||
{320,240,8,8,8}, {400,300,8,8,8}, {640,480,8,8,8},
|
||||
{320,200,8,8,8}, {320,240,8,8,8}, {400,300,8,8,8},
|
||||
{512,384,8,8,8}, {640,400,8,8,8}, {640,480,8,8,8},
|
||||
{720,400,8,8,8}, {768,576,8,8,8}, {800,600,8,8,8},
|
||||
{1024,600,8,8,8}, {1024,768,8,8,8}, {1152,864,8,8,8},
|
||||
{1280,768,8,8,8}, {1280,800,8,8,8}, {1280,960,8,8,8},
|
||||
{1280,1024,8,8,8}, {1368,768,8,8,8}, {1400,1050,8,8,8},
|
||||
{1440,900,8,8,8}, {1440,1050,8,8,8}, {1600,1000,8,8,8},
|
||||
{1600,1200,8,8,8}, {1680,1050,8,8,8}, {1792,1344,8,8,8},
|
||||
{1800,1440,8,8,8}, {1856,1392,8,8,8}, {1920,1080,8,8,8},
|
||||
{1920,1200,8,8,8}, {1920,1440,8,8,8}, {1920,2400,8,8,8},
|
||||
{2048,1536,8,8,8},
|
||||
|
||||
{320,240,5,6,5}, {400,300,5,6,5}, {640,480,5,6,5},
|
||||
{720,400,5,6,5}, {768,576,5,6,5}, {800,600,5,6,5},
|
||||
{1024,600,5,6,5}, {1024,768,5,6,5}, {1152,864,5,6,5},
|
||||
{1280,768,5,6,5}, {1280,800,5,6,5}, {1280,960,5,6,5},
|
||||
{1280,1024,5,6,5}, {1368,768,5,6,5}, {1400,1050,5,6,5},
|
||||
{1440,900,5,6,5}, {1440,1050,5,6,5}, {1600,1000,5,6,5},
|
||||
{1600,1200,5,6,5}, {1680,1050,5,6,5}, {1792,1344,5,6,5},
|
||||
{1800,1440,5,6,5}, {1856,1392,5,6,5}, {1920,1080,5,6,5},
|
||||
{1920,1200,5,6,5}, {1920,1440,5,6,5}, {1920,2400,5,6,5},
|
||||
{2048,1536,5,6,5}
|
||||
{1280,600,8,8,8}, {1280,720,8,8,8}, {1280,768,8,8,8},
|
||||
{1280,800,8,8,8}, {1280,960,8,8,8}, {1280,1024,8,8,8},
|
||||
{1360,768,8,8,8}, {1366,768,8,8,8}, {1368,768,8,8,8},
|
||||
{1400,1050,8,8,8}, {1440,900,8,8,8}, {1440,1050,8,8,8},
|
||||
{1600,900,8,8,8}, {1600,1000,8,8,8}, {1600,1200,8,8,8},
|
||||
{1680,1050,8,8,8}, {1792,1344,8,8,8}, {1800,1440,8,8,8},
|
||||
{1856,1392,8,8,8}, {1920,1080,8,8,8}, {1920,1200,8,8,8},
|
||||
{1920,1440,8,8,8}, {1920,2400,8,8,8}, {2048,1536,8,8,8}
|
||||
};
|
||||
|
||||
void CGraphics_OpenGL::Flush()
|
||||
|
|
|
@ -19,27 +19,18 @@
|
|||
#include "graphics_threaded.h"
|
||||
|
||||
static CVideoMode g_aFakeModes[] = {
|
||||
{320,240,8,8,8}, {400,300,8,8,8}, {640,480,8,8,8},
|
||||
{320,200,8,8,8}, {320,240,8,8,8}, {400,300,8,8,8},
|
||||
{512,384,8,8,8}, {640,400,8,8,8}, {640,480,8,8,8},
|
||||
{720,400,8,8,8}, {768,576,8,8,8}, {800,600,8,8,8},
|
||||
{1024,600,8,8,8}, {1024,768,8,8,8}, {1152,864,8,8,8},
|
||||
{1280,768,8,8,8}, {1280,800,8,8,8}, {1280,960,8,8,8},
|
||||
{1280,1024,8,8,8}, {1368,768,8,8,8}, {1400,1050,8,8,8},
|
||||
{1440,900,8,8,8}, {1440,1050,8,8,8}, {1600,1000,8,8,8},
|
||||
{1600,1200,8,8,8}, {1680,1050,8,8,8}, {1792,1344,8,8,8},
|
||||
{1800,1440,8,8,8}, {1856,1392,8,8,8}, {1920,1080,8,8,8},
|
||||
{1920,1200,8,8,8}, {1920,1440,8,8,8}, {1920,2400,8,8,8},
|
||||
{2048,1536,8,8,8},
|
||||
|
||||
{320,240,5,6,5}, {400,300,5,6,5}, {640,480,5,6,5},
|
||||
{720,400,5,6,5}, {768,576,5,6,5}, {800,600,5,6,5},
|
||||
{1024,600,5,6,5}, {1024,768,5,6,5}, {1152,864,5,6,5},
|
||||
{1280,768,5,6,5}, {1280,800,5,6,5}, {1280,960,5,6,5},
|
||||
{1280,1024,5,6,5}, {1368,768,5,6,5}, {1400,1050,5,6,5},
|
||||
{1440,900,5,6,5}, {1440,1050,5,6,5}, {1600,1000,5,6,5},
|
||||
{1600,1200,5,6,5}, {1680,1050,5,6,5}, {1792,1344,5,6,5},
|
||||
{1800,1440,5,6,5}, {1856,1392,5,6,5}, {1920,1080,5,6,5},
|
||||
{1920,1200,5,6,5}, {1920,1440,5,6,5}, {1920,2400,5,6,5},
|
||||
{2048,1536,5,6,5}
|
||||
{1280,600,8,8,8}, {1280,720,8,8,8}, {1280,768,8,8,8},
|
||||
{1280,800,8,8,8}, {1280,960,8,8,8}, {1280,1024,8,8,8},
|
||||
{1360,768,8,8,8}, {1366,768,8,8,8}, {1368,768,8,8,8},
|
||||
{1400,1050,8,8,8}, {1440,900,8,8,8}, {1440,1050,8,8,8},
|
||||
{1600,900,8,8,8}, {1600,1000,8,8,8}, {1600,1200,8,8,8},
|
||||
{1680,1050,8,8,8}, {1792,1344,8,8,8}, {1800,1440,8,8,8},
|
||||
{1856,1392,8,8,8}, {1920,1080,8,8,8}, {1920,1200,8,8,8},
|
||||
{1920,1440,8,8,8}, {1920,2400,8,8,8}, {2048,1536,8,8,8}
|
||||
};
|
||||
|
||||
void CGraphics_Threaded::FlushVertices()
|
||||
|
|
|
@ -44,6 +44,8 @@ class CVideoMode
|
|||
public:
|
||||
int m_Width, m_Height;
|
||||
int m_Red, m_Green, m_Blue;
|
||||
|
||||
bool operator<(const CVideoMode &Other) { return Other.m_Width < m_Width; }
|
||||
};
|
||||
|
||||
class IGraphics : public IInterface
|
||||
|
|
|
@ -62,7 +62,6 @@ MACRO_CONFIG_INT(GfxScreenHeight, gfx_screen_height, 0, 0, 0, CFGFLAG_SAVE|CFGFL
|
|||
MACRO_CONFIG_INT(GfxBorderless, gfx_borderless, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Borderless window (not to be used with fullscreen)")
|
||||
MACRO_CONFIG_INT(GfxFullscreen, gfx_fullscreen, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fullscreen")
|
||||
MACRO_CONFIG_INT(GfxAlphabits, gfx_alphabits, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Alpha bits for framebuffer (fullscreen only)")
|
||||
MACRO_CONFIG_INT(GfxColorDepth, gfx_color_depth, 24, 16, 24, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Colors bits for framebuffer (fullscreen only)")
|
||||
MACRO_CONFIG_INT(GfxClear, gfx_clear, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Clear screen before rendering")
|
||||
MACRO_CONFIG_INT(GfxVsync, gfx_vsync, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Vertical sync")
|
||||
MACRO_CONFIG_INT(GfxDisplayAllModes, gfx_display_all_modes, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
|
||||
|
|
|
@ -1387,12 +1387,12 @@ void CMenus::UpdateVideoFormats()
|
|||
|
||||
void CMenus::UpdatedFilteredVideoModes()
|
||||
{
|
||||
m_NumFilteredVideoModes = 0;
|
||||
m_lFilteredVideoModes.clear();
|
||||
for(int i = 0; i < m_NumModes; i++)
|
||||
{
|
||||
int G = gcd(m_aModes[i].m_Width, m_aModes[i].m_Height);
|
||||
if(m_aVideoFormats[m_CurrentVideoFormat].m_WidthValue == m_aModes[i].m_Width/G && m_aVideoFormats[m_CurrentVideoFormat].m_HeightValue == m_aModes[i].m_Height/G)
|
||||
m_aFilteredVideoModes[m_NumFilteredVideoModes++] = m_aModes[i];
|
||||
m_lFilteredVideoModes.add(m_aModes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -399,10 +399,9 @@ class CMenus : public CComponent
|
|||
};
|
||||
|
||||
CVideoFormat m_aVideoFormats[MAX_RESOLUTIONS];
|
||||
CVideoMode m_aFilteredVideoModes[MAX_RESOLUTIONS];
|
||||
sorted_array<CVideoMode> m_lFilteredVideoModes;
|
||||
int m_NumVideoFormats;
|
||||
int m_CurrentVideoFormat;
|
||||
int m_NumFilteredVideoModes;
|
||||
void UpdateVideoFormats();
|
||||
void UpdatedFilteredVideoModes();
|
||||
|
||||
|
|
|
@ -1128,7 +1128,6 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
|
||||
static int s_GfxScreenWidth = g_Config.m_GfxScreenWidth;
|
||||
static int s_GfxScreenHeight = g_Config.m_GfxScreenHeight;
|
||||
static int s_GfxColorDepth = g_Config.m_GfxColorDepth;
|
||||
static int s_GfxBorderless = g_Config.m_GfxBorderless;
|
||||
static int s_GfxFullscreen = g_Config.m_GfxFullscreen;
|
||||
static int s_GfxVsync = g_Config.m_GfxVsync;
|
||||
|
@ -1342,24 +1341,22 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
static int s_DisplayModeList = 0;
|
||||
int OldSelected = -1;
|
||||
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_DisplayModeList, 20.0f, aBuf, m_NumFilteredVideoModes, 1, OldSelected, s_ScrollValue, &MainView);
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %dx%d (%d:%d)", Localize("Current"), s_GfxScreenWidth, s_GfxScreenHeight, s_GfxScreenWidth/G, s_GfxScreenHeight/G);
|
||||
UiDoListboxStart(&s_DisplayModeList, 20.0f, aBuf, m_lFilteredVideoModes.size(), 1, OldSelected, s_ScrollValue, &MainView);
|
||||
|
||||
for(int i = 0; i < m_NumFilteredVideoModes; ++i)
|
||||
for(int i = 0; i < m_lFilteredVideoModes.size(); ++i)
|
||||
{
|
||||
const int Depth = m_aFilteredVideoModes[i].m_Red+m_aFilteredVideoModes[i].m_Green+m_aFilteredVideoModes[i].m_Blue > 16 ? 24 : 16;
|
||||
if(g_Config.m_GfxColorDepth == Depth &&
|
||||
g_Config.m_GfxScreenWidth == m_aFilteredVideoModes[i].m_Width &&
|
||||
g_Config.m_GfxScreenHeight == m_aFilteredVideoModes[i].m_Height)
|
||||
if(g_Config.m_GfxScreenWidth == m_lFilteredVideoModes[i].m_Width &&
|
||||
g_Config.m_GfxScreenHeight == m_lFilteredVideoModes[i].m_Height)
|
||||
{
|
||||
OldSelected = i;
|
||||
}
|
||||
|
||||
CListboxItem Item = UiDoListboxNextItem(&m_aFilteredVideoModes[i], OldSelected == i);
|
||||
CListboxItem Item = UiDoListboxNextItem(&m_lFilteredVideoModes[i], OldSelected == i);
|
||||
if(Item.m_Visible)
|
||||
{
|
||||
int G = gcd(m_aFilteredVideoModes[i].m_Width, m_aFilteredVideoModes[i].m_Height);
|
||||
str_format(aBuf, sizeof(aBuf), " %dx%d %d bit", m_aFilteredVideoModes[i].m_Width, m_aFilteredVideoModes[i].m_Height, Depth);
|
||||
int G = gcd(m_lFilteredVideoModes[i].m_Width, m_lFilteredVideoModes[i].m_Height);
|
||||
str_format(aBuf, sizeof(aBuf), " %dx%d", m_lFilteredVideoModes[i].m_Width, m_lFilteredVideoModes[i].m_Height);
|
||||
if(i == OldSelected)
|
||||
{
|
||||
TextRender()->TextColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
@ -1380,10 +1377,8 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
const int NewSelected = UiDoListboxEnd(&s_ScrollValue, 0);
|
||||
if(OldSelected != NewSelected)
|
||||
{
|
||||
const int Depth = m_aFilteredVideoModes[NewSelected].m_Red+m_aFilteredVideoModes[NewSelected].m_Green+m_aFilteredVideoModes[NewSelected].m_Blue > 16 ? 24 : 16;
|
||||
g_Config.m_GfxColorDepth = Depth;
|
||||
g_Config.m_GfxScreenWidth = m_aFilteredVideoModes[NewSelected].m_Width;
|
||||
g_Config.m_GfxScreenHeight = m_aFilteredVideoModes[NewSelected].m_Height;
|
||||
g_Config.m_GfxScreenWidth = m_lFilteredVideoModes[NewSelected].m_Width;
|
||||
g_Config.m_GfxScreenHeight = m_lFilteredVideoModes[NewSelected].m_Height;
|
||||
CheckSettings = true;
|
||||
}
|
||||
}
|
||||
|
@ -1402,7 +1397,6 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
{
|
||||
g_Config.m_GfxScreenWidth = Graphics()->GetDesktopScreenWidth();
|
||||
g_Config.m_GfxScreenHeight = Graphics()->GetDesktopScreenHeight();
|
||||
g_Config.m_GfxColorDepth = 24;
|
||||
g_Config.m_GfxBorderless = 0;
|
||||
g_Config.m_GfxFullscreen = 1;
|
||||
g_Config.m_GfxVsync = 1;
|
||||
|
@ -1444,7 +1438,6 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
{
|
||||
if(s_GfxScreenWidth == g_Config.m_GfxScreenWidth &&
|
||||
s_GfxScreenHeight == g_Config.m_GfxScreenHeight &&
|
||||
s_GfxColorDepth == g_Config.m_GfxColorDepth &&
|
||||
s_GfxBorderless == g_Config.m_GfxBorderless &&
|
||||
s_GfxFullscreen == g_Config.m_GfxFullscreen &&
|
||||
s_GfxVsync == g_Config.m_GfxVsync &&
|
||||
|
|
Loading…
Reference in a new issue