mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Allow zooming to levels. Close #3923
This commit is contained in:
parent
4a13ba2536
commit
1a6de7caf8
|
@ -183,7 +183,7 @@ void CCamera::OnConsoleInit()
|
||||||
{
|
{
|
||||||
Console()->Register("zoom+", "", CFGFLAG_CLIENT, ConZoomPlus, this, "Zoom increase");
|
Console()->Register("zoom+", "", CFGFLAG_CLIENT, ConZoomPlus, this, "Zoom increase");
|
||||||
Console()->Register("zoom-", "", CFGFLAG_CLIENT, ConZoomMinus, this, "Zoom decrease");
|
Console()->Register("zoom-", "", CFGFLAG_CLIENT, ConZoomMinus, this, "Zoom decrease");
|
||||||
Console()->Register("zoom", "", CFGFLAG_CLIENT, ConZoomReset, this, "Zoom reset");
|
Console()->Register("zoom", "?i", CFGFLAG_CLIENT, ConZoom, this, "Change zoom");
|
||||||
Console()->Register("set_view", "i[x]i[y]", CFGFLAG_CLIENT, ConSetView, this, "Set camera position to x and y in the map");
|
Console()->Register("set_view", "i[x]i[y]", CFGFLAG_CLIENT, ConSetView, this, "Set camera position to x and y in the map");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,9 +209,10 @@ void CCamera::ConZoomMinus(IConsole::IResult *pResult, void *pUserData)
|
||||||
pSelf->ScaleZoom(1 / ZoomStep);
|
pSelf->ScaleZoom(1 / ZoomStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CCamera::ConZoomReset(IConsole::IResult *pResult, void *pUserData)
|
void CCamera::ConZoom(IConsole::IResult *pResult, void *pUserData)
|
||||||
{
|
{
|
||||||
((CCamera *)pUserData)->ChangeZoom(pow(ZoomStep, g_Config.m_ClDefaultZoom - 10));
|
int TargetLevel = pResult->NumArguments() ? clamp(pResult->GetInteger(0), 0, 20) : g_Config.m_ClDefaultZoom;
|
||||||
|
((CCamera *)pUserData)->ChangeZoom(pow(ZoomStep, TargetLevel - 10));
|
||||||
}
|
}
|
||||||
void CCamera::ConSetView(IConsole::IResult *pResult, void *pUserData)
|
void CCamera::ConSetView(IConsole::IResult *pResult, void *pUserData)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
private:
|
private:
|
||||||
static void ConZoomPlus(IConsole::IResult *pResult, void *pUserData);
|
static void ConZoomPlus(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConZoomMinus(IConsole::IResult *pResult, void *pUserData);
|
static void ConZoomMinus(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConZoomReset(IConsole::IResult *pResult, void *pUserData);
|
static void ConZoom(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConSetView(IConsole::IResult *pResult, void *pUserData);
|
static void ConSetView(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
|
||||||
vec2 m_ForceFreeviewPos;
|
vec2 m_ForceFreeviewPos;
|
||||||
|
|
Loading…
Reference in a new issue