mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Parallax Zoom: Zoom preview button in Editor
Known issue: Quad Env Points are scaled incorrectly for Groups with ParallaxZoom != 100 (in Zoom mode).
This commit is contained in:
parent
5bf7f60bf6
commit
54f7a9817d
|
@ -132,9 +132,11 @@ void CLayerGroup::Convert(CUIRect *pRect)
|
|||
|
||||
void CLayerGroup::Mapping(float *pPoints)
|
||||
{
|
||||
float ParallaxZoom = m_pMap->m_pEditor->m_PreviewZoom ? m_ParallaxZoom : 100.0f;
|
||||
|
||||
m_pMap->m_pEditor->RenderTools()->MapScreenToWorld(
|
||||
m_pMap->m_pEditor->m_WorldOffsetX, m_pMap->m_pEditor->m_WorldOffsetY,
|
||||
m_ParallaxX, m_ParallaxY, 100.0f, m_OffsetX, m_OffsetY,
|
||||
m_ParallaxX, m_ParallaxY, ParallaxZoom, m_OffsetX, m_OffsetY,
|
||||
m_pMap->m_pEditor->Graphics()->ScreenAspect(), m_pMap->m_pEditor->m_WorldZoom, pPoints);
|
||||
|
||||
pPoints[0] += m_pMap->m_pEditor->m_EditorOffsetX;
|
||||
|
@ -865,6 +867,17 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
|
||||
TB_Top.VSplitLeft(5.0f, nullptr, &TB_Top);
|
||||
|
||||
// zoom button
|
||||
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
||||
static int s_ZoomButton = 0;
|
||||
// TODO: do we need a keyboard shortcut?
|
||||
if(DoButton_Editor(&s_ZoomButton, "Zoom", m_PreviewZoom, &Button, 0, "Toggles preview of how layers will be zoomed in-game"))
|
||||
{
|
||||
m_PreviewZoom = !m_PreviewZoom;
|
||||
}
|
||||
|
||||
TB_Top.VSplitLeft(5.0f, nullptr, &TB_Top);
|
||||
|
||||
// grid button
|
||||
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
||||
static int s_GridButton = 0;
|
||||
|
@ -2708,6 +2721,7 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
m_Brush.m_OffsetY += pGroup->m_OffsetY;
|
||||
m_Brush.m_ParallaxX = pGroup->m_ParallaxX;
|
||||
m_Brush.m_ParallaxY = pGroup->m_ParallaxY;
|
||||
m_Brush.m_ParallaxZoom = pGroup->m_ParallaxZoom;
|
||||
m_Brush.Render();
|
||||
float w, h;
|
||||
m_Brush.GetSize(&w, &h);
|
||||
|
|
|
@ -781,6 +781,7 @@ public:
|
|||
|
||||
m_GuiActive = true;
|
||||
m_ProofBorders = false;
|
||||
m_PreviewZoom = false;
|
||||
|
||||
m_ShowTileInfo = false;
|
||||
m_ShowDetail = true;
|
||||
|
@ -954,6 +955,7 @@ public:
|
|||
bool m_ShowMousePointer;
|
||||
bool m_GuiActive;
|
||||
bool m_ProofBorders;
|
||||
bool m_PreviewZoom;
|
||||
float m_MouseX = 0.0f;
|
||||
float m_MouseY = 0.0f;
|
||||
float m_MouseWorldX = 0.0f;
|
||||
|
|
Loading…
Reference in a new issue