mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Extract CEditor::HandleCursorMovement
function
This commit is contained in:
parent
4372932480
commit
e04eee9d44
|
@ -6812,18 +6812,8 @@ void CEditor::PlaceBorderTiles()
|
||||||
pT->m_pTiles[i].m_Index = 1;
|
pT->m_pTiles[i].m_Index = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEditor::OnUpdate()
|
void CEditor::HandleCursorMovement()
|
||||||
{
|
{
|
||||||
CUIElementBase::Init(UI()); // update static pointer because game and editor use separate UI
|
|
||||||
|
|
||||||
if(!m_EditorWasUsedBefore)
|
|
||||||
{
|
|
||||||
m_EditorWasUsedBefore = true;
|
|
||||||
Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle cursor movement
|
|
||||||
{
|
|
||||||
static float s_MouseX = 0.0f;
|
static float s_MouseX = 0.0f;
|
||||||
static float s_MouseY = 0.0f;
|
static float s_MouseY = 0.0f;
|
||||||
|
|
||||||
|
@ -6882,7 +6872,19 @@ void CEditor::OnUpdate()
|
||||||
m_MouseWorldNoParaX = aPoints[0] + WorldWidth * (s_MouseX / Graphics()->WindowWidth());
|
m_MouseWorldNoParaX = aPoints[0] + WorldWidth * (s_MouseX / Graphics()->WindowWidth());
|
||||||
m_MouseWorldNoParaY = aPoints[1] + WorldHeight * (s_MouseY / Graphics()->WindowHeight());
|
m_MouseWorldNoParaY = aPoints[1] + WorldHeight * (s_MouseY / Graphics()->WindowHeight());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEditor::OnUpdate()
|
||||||
|
{
|
||||||
|
CUIElementBase::Init(UI()); // update static pointer because game and editor use separate UI
|
||||||
|
|
||||||
|
if(!m_EditorWasUsedBefore)
|
||||||
|
{
|
||||||
|
m_EditorWasUsedBefore = true;
|
||||||
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HandleCursorMovement();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEditor::OnRender()
|
void CEditor::OnRender()
|
||||||
|
|
|
@ -848,6 +848,8 @@ public:
|
||||||
void UpdateMentions() override { m_Mentions++; }
|
void UpdateMentions() override { m_Mentions++; }
|
||||||
void ResetMentions() override { m_Mentions = 0; }
|
void ResetMentions() override { m_Mentions = 0; }
|
||||||
|
|
||||||
|
void HandleCursorMovement();
|
||||||
|
|
||||||
CLayerGroup *m_apSavedBrushes[10];
|
CLayerGroup *m_apSavedBrushes[10];
|
||||||
|
|
||||||
void RefreshFilteredFileList();
|
void RefreshFilteredFileList();
|
||||||
|
|
Loading…
Reference in a new issue