mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Resize window without restarting client
This commit is contained in:
parent
74f4ad77d6
commit
644fec7e55
|
@ -459,6 +459,12 @@ void CCommandProcessorFragment_SDL::Cmd_VSync(const CCommandBuffer::SCommand_VSy
|
||||||
*pCommand->m_pRetOk = SDL_GL_SetSwapInterval(pCommand->m_VSync) == 0;
|
*pCommand->m_pRetOk = SDL_GL_SetSwapInterval(pCommand->m_VSync) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCommandProcessorFragment_SDL::Cmd_Resize(const CCommandBuffer::SCommand_Resize *pCommand)
|
||||||
|
{
|
||||||
|
SDL_SetWindowSize(m_pWindow, pCommand->m_Width, pCommand->m_Height);
|
||||||
|
glViewport(0, 0, pCommand->m_Width, pCommand->m_Height);
|
||||||
|
}
|
||||||
|
|
||||||
void CCommandProcessorFragment_SDL::Cmd_VideoModes(const CCommandBuffer::SCommand_VideoModes *pCommand)
|
void CCommandProcessorFragment_SDL::Cmd_VideoModes(const CCommandBuffer::SCommand_VideoModes *pCommand)
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
@ -505,6 +511,7 @@ bool CCommandProcessorFragment_SDL::RunCommand(const CCommandBuffer::SCommand *p
|
||||||
{
|
{
|
||||||
case CCommandBuffer::CMD_SWAP: Cmd_Swap(static_cast<const CCommandBuffer::SCommand_Swap *>(pBaseCommand)); break;
|
case CCommandBuffer::CMD_SWAP: Cmd_Swap(static_cast<const CCommandBuffer::SCommand_Swap *>(pBaseCommand)); break;
|
||||||
case CCommandBuffer::CMD_VSYNC: Cmd_VSync(static_cast<const CCommandBuffer::SCommand_VSync *>(pBaseCommand)); break;
|
case CCommandBuffer::CMD_VSYNC: Cmd_VSync(static_cast<const CCommandBuffer::SCommand_VSync *>(pBaseCommand)); break;
|
||||||
|
case CCommandBuffer::CMD_RESIZE: Cmd_Resize(static_cast<const CCommandBuffer::SCommand_Resize *>(pBaseCommand)); break;
|
||||||
case CCommandBuffer::CMD_VIDEOMODES: Cmd_VideoModes(static_cast<const CCommandBuffer::SCommand_VideoModes *>(pBaseCommand)); break;
|
case CCommandBuffer::CMD_VIDEOMODES: Cmd_VideoModes(static_cast<const CCommandBuffer::SCommand_VideoModes *>(pBaseCommand)); break;
|
||||||
case CMD_INIT: Cmd_Init(static_cast<const SCommand_Init *>(pBaseCommand)); break;
|
case CMD_INIT: Cmd_Init(static_cast<const SCommand_Init *>(pBaseCommand)); break;
|
||||||
case CMD_SHUTDOWN: Cmd_Shutdown(static_cast<const SCommand_Shutdown *>(pBaseCommand)); break;
|
case CMD_SHUTDOWN: Cmd_Shutdown(static_cast<const SCommand_Shutdown *>(pBaseCommand)); break;
|
||||||
|
|
|
@ -157,6 +157,7 @@ private:
|
||||||
void Cmd_Shutdown(const SCommand_Shutdown *pCommand);
|
void Cmd_Shutdown(const SCommand_Shutdown *pCommand);
|
||||||
void Cmd_Swap(const CCommandBuffer::SCommand_Swap *pCommand);
|
void Cmd_Swap(const CCommandBuffer::SCommand_Swap *pCommand);
|
||||||
void Cmd_VSync(const CCommandBuffer::SCommand_VSync *pCommand);
|
void Cmd_VSync(const CCommandBuffer::SCommand_VSync *pCommand);
|
||||||
|
void Cmd_Resize(const CCommandBuffer::SCommand_Resize *pCommand);
|
||||||
void Cmd_VideoModes(const CCommandBuffer::SCommand_VideoModes *pCommand);
|
void Cmd_VideoModes(const CCommandBuffer::SCommand_VideoModes *pCommand);
|
||||||
public:
|
public:
|
||||||
CCommandProcessorFragment_SDL();
|
CCommandProcessorFragment_SDL();
|
||||||
|
|
|
@ -786,7 +786,7 @@ int CGraphics_Threaded::IssueInit()
|
||||||
if(g_Config.m_GfxBorderless) Flags |= IGraphicsBackend::INITFLAG_BORDERLESS;
|
if(g_Config.m_GfxBorderless) Flags |= IGraphicsBackend::INITFLAG_BORDERLESS;
|
||||||
if(g_Config.m_GfxFullscreen) Flags |= IGraphicsBackend::INITFLAG_FULLSCREEN;
|
if(g_Config.m_GfxFullscreen) Flags |= IGraphicsBackend::INITFLAG_FULLSCREEN;
|
||||||
if(g_Config.m_GfxVsync) Flags |= IGraphicsBackend::INITFLAG_VSYNC;
|
if(g_Config.m_GfxVsync) Flags |= IGraphicsBackend::INITFLAG_VSYNC;
|
||||||
if(g_Config.m_DbgResizable) Flags |= IGraphicsBackend::INITFLAG_RESIZABLE;
|
if(g_Config.m_GfxResizable) Flags |= IGraphicsBackend::INITFLAG_RESIZABLE;
|
||||||
|
|
||||||
return m_pBackend->Init("DDNet Client", &g_Config.m_GfxScreen, &g_Config.m_GfxScreenWidth, &g_Config.m_GfxScreenHeight, g_Config.m_GfxFsaaSamples, Flags, &m_DesktopScreenWidth, &m_DesktopScreenHeight);
|
return m_pBackend->Init("DDNet Client", &g_Config.m_GfxScreen, &g_Config.m_GfxScreenWidth, &g_Config.m_GfxScreenHeight, g_Config.m_GfxFsaaSamples, Flags, &m_DesktopScreenWidth, &m_DesktopScreenHeight);
|
||||||
}
|
}
|
||||||
|
@ -910,6 +910,29 @@ bool CGraphics_Threaded::SetWindowScreen(int Index)
|
||||||
return m_pBackend->SetWindowScreen(Index);
|
return m_pBackend->SetWindowScreen(Index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGraphics_Threaded::Resize(int w, int h)
|
||||||
|
{
|
||||||
|
if(m_ScreenWidth == w && m_ScreenHeight == h)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(h > 4*w/5)
|
||||||
|
h = 4*w/5;
|
||||||
|
if(w > 21*h/9)
|
||||||
|
w = 21*h/9;
|
||||||
|
|
||||||
|
m_ScreenWidth = w;
|
||||||
|
m_ScreenHeight = h;
|
||||||
|
|
||||||
|
CCommandBuffer::SCommand_Resize Cmd;
|
||||||
|
Cmd.m_Width = w;
|
||||||
|
Cmd.m_Height = h;
|
||||||
|
m_pCommandBuffer->AddCommand(Cmd);
|
||||||
|
|
||||||
|
// kick the command buffer
|
||||||
|
KickCommandBuffer();
|
||||||
|
WaitForIdle();
|
||||||
|
}
|
||||||
|
|
||||||
int CGraphics_Threaded::GetWindowScreen()
|
int CGraphics_Threaded::GetWindowScreen()
|
||||||
{
|
{
|
||||||
return m_pBackend->GetWindowScreen();
|
return m_pBackend->GetWindowScreen();
|
||||||
|
|
|
@ -85,6 +85,7 @@ public:
|
||||||
CMD_VSYNC,
|
CMD_VSYNC,
|
||||||
CMD_SCREENSHOT,
|
CMD_SCREENSHOT,
|
||||||
CMD_VIDEOMODES,
|
CMD_VIDEOMODES,
|
||||||
|
CMD_RESIZE,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -215,6 +216,14 @@ public:
|
||||||
bool *m_pRetOk;
|
bool *m_pRetOk;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SCommand_Resize : public SCommand
|
||||||
|
{
|
||||||
|
SCommand_Resize() : SCommand(CMD_RESIZE) {}
|
||||||
|
|
||||||
|
int m_Width;
|
||||||
|
int m_Height;
|
||||||
|
};
|
||||||
|
|
||||||
struct SCommand_Texture_Create : public SCommand
|
struct SCommand_Texture_Create : public SCommand
|
||||||
{
|
{
|
||||||
SCommand_Texture_Create() : SCommand(CMD_TEXTURE_CREATE) {}
|
SCommand_Texture_Create() : SCommand(CMD_TEXTURE_CREATE) {}
|
||||||
|
@ -446,6 +455,7 @@ public:
|
||||||
virtual bool Fullscreen(bool State);
|
virtual bool Fullscreen(bool State);
|
||||||
virtual void SetWindowBordered(bool State);
|
virtual void SetWindowBordered(bool State);
|
||||||
virtual bool SetWindowScreen(int Index);
|
virtual bool SetWindowScreen(int Index);
|
||||||
|
virtual void Resize(int w, int h);
|
||||||
virtual int GetWindowScreen();
|
virtual int GetWindowScreen();
|
||||||
|
|
||||||
virtual int WindowActive();
|
virtual int WindowActive();
|
||||||
|
|
|
@ -65,7 +65,7 @@ void CInput::MouseRelative(float *x, float *y)
|
||||||
*y = ny;
|
*y = ny;
|
||||||
#else
|
#else
|
||||||
int nx = 0, ny = 0;
|
int nx = 0, ny = 0;
|
||||||
float Sens = ((g_Config.m_ClDyncam && g_Config.m_ClDyncamMousesens) ? g_Config.m_ClDyncamMousesens : g_Config.m_InpMousesens) / 50.0f;
|
float Sens = ((g_Config.m_ClDyncam && g_Config.m_ClDyncamMousesens) ? g_Config.m_ClDyncamMousesens : g_Config.m_InpMousesens) / 100.0f;
|
||||||
|
|
||||||
SDL_GetRelativeMouseState(&nx,&ny);
|
SDL_GetRelativeMouseState(&nx,&ny);
|
||||||
|
|
||||||
|
@ -173,10 +173,9 @@ int CInput::Update()
|
||||||
switch (Event.type)
|
switch (Event.type)
|
||||||
{
|
{
|
||||||
case SDL_TEXTINPUT:
|
case SDL_TEXTINPUT:
|
||||||
{
|
if(!IgnoreKeys)
|
||||||
AddEvent(Event.text.text, 0, IInput::FLAG_TEXT);
|
AddEvent(Event.text.text, 0, IInput::FLAG_TEXT);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
// handle keys
|
// handle keys
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
Key = KeycodeToKey(Event.key.keysym.sym);
|
Key = KeycodeToKey(Event.key.keysym.sym);
|
||||||
|
@ -222,15 +221,24 @@ int CInput::Update()
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
// Ignore keys following a focus gain as they may be part of global
|
// Ignore keys following a focus gain as they may be part of global
|
||||||
// shortcuts
|
// shortcuts
|
||||||
if(Event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
|
switch (Event.window.event)
|
||||||
IgnoreKeys = true;
|
|
||||||
#if defined(CONF_PLATFORM_MACOSX) // Todo: remove this when fixed in SDL
|
|
||||||
if(Event.window.event == SDL_WINDOWEVENT_MAXIMIZED)
|
|
||||||
{
|
{
|
||||||
MouseModeAbsolute();
|
case SDL_WINDOWEVENT_RESIZED:
|
||||||
MouseModeRelative();
|
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||||
}
|
Graphics()->Resize(Event.window.data1, Event.window.data2);
|
||||||
|
break;
|
||||||
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
|
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
|
// TODO: Check if from FOCUS_LOST til FOCUS_GAINED is good enough, maybe also ENTER and LEAVE
|
||||||
|
IgnoreKeys = true;
|
||||||
|
break;
|
||||||
|
#if defined(CONF_PLATFORM_MACOSX) // Todo: remove this when fixed in SDL
|
||||||
|
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||||
|
MouseModeAbsolute();
|
||||||
|
MouseModeRelative();
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// other messages
|
// other messages
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
virtual bool SetWindowScreen(int Index) = 0;
|
virtual bool SetWindowScreen(int Index) = 0;
|
||||||
virtual bool SetVSync(bool State) = 0;
|
virtual bool SetVSync(bool State) = 0;
|
||||||
virtual int GetWindowScreen() = 0;
|
virtual int GetWindowScreen() = 0;
|
||||||
|
virtual void Resize(int w, int h) = 0;
|
||||||
|
|
||||||
virtual void Clear(float r, float g, float b) = 0;
|
virtual void Clear(float r, float g, float b) = 0;
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,7 @@ MACRO_CONFIG_INT(GfxAlphabits, gfx_alphabits, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIE
|
||||||
MACRO_CONFIG_INT(GfxColorDepth, gfx_color_depth, 24, 16, 24, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Colors 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, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Clear screen before rendering")
|
//MACRO_CONFIG_INT(GfxClear, gfx_clear, 1, 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(GfxVsync, gfx_vsync, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Vertical sync")
|
||||||
|
MACRO_CONFIG_INT(GfxResizable, gfx_resizable, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Enables window resizing")
|
||||||
MACRO_CONFIG_INT(GfxDisplayAllModes, gfx_display_all_modes, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
|
MACRO_CONFIG_INT(GfxDisplayAllModes, gfx_display_all_modes, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
|
||||||
MACRO_CONFIG_INT(GfxTextureCompression, gfx_texture_compression, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use texture compression")
|
MACRO_CONFIG_INT(GfxTextureCompression, gfx_texture_compression, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use texture compression")
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
|
@ -167,7 +168,6 @@ MACRO_CONFIG_INT(DbgPref, dbg_pref, 0, 0, 1, CFGFLAG_SERVER, "Performance output
|
||||||
MACRO_CONFIG_INT(DbgGraphs, dbg_graphs, 0, 0, 1, CFGFLAG_CLIENT, "Performance graphs")
|
MACRO_CONFIG_INT(DbgGraphs, dbg_graphs, 0, 0, 1, CFGFLAG_CLIENT, "Performance graphs")
|
||||||
MACRO_CONFIG_INT(DbgHitch, dbg_hitch, 0, 0, 0, CFGFLAG_SERVER, "Hitch warnings")
|
MACRO_CONFIG_INT(DbgHitch, dbg_hitch, 0, 0, 0, CFGFLAG_SERVER, "Hitch warnings")
|
||||||
MACRO_CONFIG_STR(DbgStressServer, dbg_stress_server, 32, "localhost", CFGFLAG_CLIENT, "Server to stress")
|
MACRO_CONFIG_STR(DbgStressServer, dbg_stress_server, 32, "localhost", CFGFLAG_CLIENT, "Server to stress")
|
||||||
MACRO_CONFIG_INT(DbgResizable, dbg_resizable, 0, 0, 0, CFGFLAG_CLIENT, "Enables window resizing")
|
|
||||||
|
|
||||||
// DDRace
|
// DDRace
|
||||||
MACRO_CONFIG_STR(SvWelcome, sv_welcome, 64, "", CFGFLAG_SERVER, "Message that will be displayed to players who join the server")
|
MACRO_CONFIG_STR(SvWelcome, sv_welcome, 64, "", CFGFLAG_SERVER, "Message that will be displayed to players who join the server")
|
||||||
|
|
|
@ -488,7 +488,7 @@ bool CControls::OnMouseMove(float x, float y)
|
||||||
{
|
{
|
||||||
m_OldMouseX = x;
|
m_OldMouseX = x;
|
||||||
m_OldMouseY = y;
|
m_OldMouseY = y;
|
||||||
m_MousePos[g_Config.m_ClDummy] = vec2((x - g_Config.m_GfxScreenWidth/2), (y - g_Config.m_GfxScreenHeight/2));
|
m_MousePos[g_Config.m_ClDummy] = vec2((x - Graphics()->Width()/2), (y - Graphics()->Height()/2));
|
||||||
ClampMousePos();
|
ClampMousePos();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -61,7 +61,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
||||||
COL_VERSION,
|
COL_VERSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
static CColumn s_aCols[] = {
|
CColumn s_aCols[] = {
|
||||||
{-1, -1, " ", -1, 2.0f, 0, {0}, {0}},
|
{-1, -1, " ", -1, 2.0f, 0, {0}, {0}},
|
||||||
{COL_FLAG_LOCK, -1, " ", -1, 14.0f, 0, {0}, {0}},
|
{COL_FLAG_LOCK, -1, " ", -1, 14.0f, 0, {0}, {0}},
|
||||||
{COL_FLAG_FAV, -1, " ", -1, 14.0f, 0, {0}, {0}},
|
{COL_FLAG_FAV, -1, " ", -1, 14.0f, 0, {0}, {0}},
|
||||||
|
|
|
@ -850,7 +850,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
||||||
g_Config.m_GfxColorDepth = Depth;
|
g_Config.m_GfxColorDepth = Depth;
|
||||||
g_Config.m_GfxScreenWidth = s_aModes[NewSelected].m_Width;
|
g_Config.m_GfxScreenWidth = s_aModes[NewSelected].m_Width;
|
||||||
g_Config.m_GfxScreenHeight = s_aModes[NewSelected].m_Height;
|
g_Config.m_GfxScreenHeight = s_aModes[NewSelected].m_Height;
|
||||||
CheckSettings = true;
|
Graphics()->Resize(g_Config.m_GfxScreenWidth, g_Config.m_GfxScreenHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// switches
|
// switches
|
||||||
|
@ -935,8 +935,6 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
||||||
m_NeedRestartGraphics = true;
|
m_NeedRestartGraphics = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
CUIRect Text;
|
CUIRect Text;
|
||||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||||
MainView.HSplitTop(20.0f, &Text, &MainView);
|
MainView.HSplitTop(20.0f, &Text, &MainView);
|
||||||
|
|
|
@ -158,7 +158,7 @@ bool CSpectator::OnMouseMove(float x, float y)
|
||||||
{
|
{
|
||||||
m_OldMouseX = x;
|
m_OldMouseX = x;
|
||||||
m_OldMouseY = y;
|
m_OldMouseY = y;
|
||||||
m_SelectorMouse = vec2((x - g_Config.m_GfxScreenWidth/2), (y - g_Config.m_GfxScreenHeight/2));
|
m_SelectorMouse = vec2((x - Graphics()->ScreenWidth()/2), (y - Graphics()->ScreenHeight()/2));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
UI()->ConvertMouseMove(&x, &y);
|
UI()->ConvertMouseMove(&x, &y);
|
||||||
|
|
|
@ -335,7 +335,7 @@ void CRenderTools::RenderTeleOverlay(CTeleTile *pTele, int w, int h, float Scale
|
||||||
int EndY = (int)(ScreenY1/Scale)+1;
|
int EndY = (int)(ScreenY1/Scale)+1;
|
||||||
int EndX = (int)(ScreenX1/Scale)+1;
|
int EndX = (int)(ScreenX1/Scale)+1;
|
||||||
|
|
||||||
if(EndX - StartX > g_Config.m_GfxScreenWidth / g_Config.m_GfxTextOverlay || EndY - StartY > g_Config.m_GfxScreenHeight / g_Config.m_GfxTextOverlay)
|
if(EndX - StartX > Graphics()->ScreenWidth() / g_Config.m_GfxTextOverlay || EndY - StartY > Graphics()->ScreenHeight() / g_Config.m_GfxTextOverlay)
|
||||||
return; // its useless to render text at this distance
|
return; // its useless to render text at this distance
|
||||||
|
|
||||||
for(int y = StartY; y < EndY; y++)
|
for(int y = StartY; y < EndY; y++)
|
||||||
|
@ -380,7 +380,7 @@ void CRenderTools::RenderSpeedupOverlay(CSpeedupTile *pSpeedup, int w, int h, fl
|
||||||
int EndY = (int)(ScreenY1/Scale)+1;
|
int EndY = (int)(ScreenY1/Scale)+1;
|
||||||
int EndX = (int)(ScreenX1/Scale)+1;
|
int EndX = (int)(ScreenX1/Scale)+1;
|
||||||
|
|
||||||
if(EndX - StartX > g_Config.m_GfxScreenWidth / g_Config.m_GfxTextOverlay || EndY - StartY > g_Config.m_GfxScreenHeight / g_Config.m_GfxTextOverlay)
|
if(EndX - StartX > Graphics()->ScreenWidth() / g_Config.m_GfxTextOverlay || EndY - StartY > Graphics()->ScreenHeight() / g_Config.m_GfxTextOverlay)
|
||||||
return; // its useless to render text at this distance
|
return; // its useless to render text at this distance
|
||||||
|
|
||||||
for(int y = StartY; y < EndY; y++)
|
for(int y = StartY; y < EndY; y++)
|
||||||
|
@ -449,7 +449,7 @@ void CRenderTools::RenderSwitchOverlay(CSwitchTile *pSwitch, int w, int h, float
|
||||||
int EndY = (int)(ScreenY1/Scale)+1;
|
int EndY = (int)(ScreenY1/Scale)+1;
|
||||||
int EndX = (int)(ScreenX1/Scale)+1;
|
int EndX = (int)(ScreenX1/Scale)+1;
|
||||||
|
|
||||||
if(EndX - StartX > g_Config.m_GfxScreenWidth / g_Config.m_GfxTextOverlay || EndY - StartY > g_Config.m_GfxScreenHeight / g_Config.m_GfxTextOverlay)
|
if(EndX - StartX > Graphics()->ScreenWidth() / g_Config.m_GfxTextOverlay || EndY - StartY > Graphics()->ScreenHeight() / g_Config.m_GfxTextOverlay)
|
||||||
return; // its useless to render text at this distance
|
return; // its useless to render text at this distance
|
||||||
|
|
||||||
for(int y = StartY; y < EndY; y++)
|
for(int y = StartY; y < EndY; y++)
|
||||||
|
@ -507,7 +507,7 @@ void CRenderTools::RenderTuneOverlay(CTuneTile *pTune, int w, int h, float Scale
|
||||||
int EndY = (int)(ScreenY1/Scale)+1;
|
int EndY = (int)(ScreenY1/Scale)+1;
|
||||||
int EndX = (int)(ScreenX1/Scale)+1;
|
int EndX = (int)(ScreenX1/Scale)+1;
|
||||||
|
|
||||||
if(EndX - StartX > g_Config.m_GfxScreenWidth / g_Config.m_GfxTextOverlay || EndY - StartY > g_Config.m_GfxScreenHeight / g_Config.m_GfxTextOverlay)
|
if(EndX - StartX > Graphics()->ScreenWidth() / g_Config.m_GfxTextOverlay || EndY - StartY > Graphics()->ScreenHeight() / g_Config.m_GfxTextOverlay)
|
||||||
return; // its useless to render text at this distance
|
return; // its useless to render text at this distance
|
||||||
|
|
||||||
for(int y = StartY; y < EndY; y++)
|
for(int y = StartY; y < EndY; y++)
|
||||||
|
|
|
@ -5524,8 +5524,8 @@ void CEditor::UpdateAndRender()
|
||||||
tx = s_MouseX;
|
tx = s_MouseX;
|
||||||
ty = s_MouseY;
|
ty = s_MouseY;
|
||||||
|
|
||||||
s_MouseX = (rx / (float)g_Config.m_GfxScreenWidth) * UI()->Screen()->w;
|
s_MouseX = (rx / (float)Graphics()->ScreenWidth()) * UI()->Screen()->w;
|
||||||
s_MouseY = (ry / (float)g_Config.m_GfxScreenHeight) * UI()->Screen()->h;
|
s_MouseY = (ry / (float)Graphics()->ScreenHeight()) * UI()->Screen()->h;
|
||||||
|
|
||||||
s_MouseX = clamp(s_MouseX, 0.0f, UI()->Screen()->w);
|
s_MouseX = clamp(s_MouseX, 0.0f, UI()->Screen()->w);
|
||||||
s_MouseY = clamp(s_MouseY, 0.0f, UI()->Screen()->h);
|
s_MouseY = clamp(s_MouseY, 0.0f, UI()->Screen()->h);
|
||||||
|
|
Loading…
Reference in a new issue