add condition for animations

This commit is contained in:
Andrii 2020-05-17 04:39:23 +03:00 committed by heinrich5991
parent b24f12cec8
commit df6e7ef454

View file

@ -1049,6 +1049,8 @@ void CEditor::DoToolbar(CUIRect ToolBar)
TB_Top.HSplitBottom(2.5f, &TB_Top, 0); TB_Top.HSplitBottom(2.5f, &TB_Top, 0);
TB_Bottom.HSplitTop(2.5f, 0, &TB_Bottom); TB_Bottom.HSplitTop(2.5f, 0, &TB_Bottom);
// top line buttons
{
if(m_Dialog == DIALOG_NONE) if(m_Dialog == DIALOG_NONE)
{ {
// ctrl+o or ctrl+l to open // ctrl+o or ctrl+l to open
@ -1222,28 +1224,6 @@ void CEditor::DoToolbar(CUIRect ToolBar)
TB_Top.VSplitLeft(5.0f, 0, &TB_Top); TB_Top.VSplitLeft(5.0f, 0, &TB_Top);
// animation speed
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_AnimFasterButton = 0;
if(DoButton_Ex(&s_AnimFasterButton, "A+", 0, &Button, 0, "Increase animation speed", CUI::CORNER_L))
m_AnimateSpeed += 0.5f;
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_AnimNormalButton = 0;
if(DoButton_Ex(&s_AnimNormalButton, "1", 0, &Button, 0, "Normal animation speed", 0))
m_AnimateSpeed = 1.0f;
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_AnimSlowerButton = 0;
if(DoButton_Ex(&s_AnimSlowerButton, "A-", 0, &Button, 0, "Decrease animation speed", CUI::CORNER_R))
{
if(m_AnimateSpeed > 0.5f)
m_AnimateSpeed -= 0.5f;
}
TB_Top.VSplitLeft(5.0f, &Button, &TB_Top);
// brush manipulation // brush manipulation
{ {
int Enabled = m_Brush.IsEmpty() ? -1 : 0; int Enabled = m_Brush.IsEmpty() ? -1 : 0;
@ -1266,8 +1246,6 @@ void CEditor::DoToolbar(CUIRect ToolBar)
} }
// rotate buttons // rotate buttons
TB_Top.VSplitLeft(5.0f, &Button, &TB_Top);
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_RotationAmount = 90; static int s_RotationAmount = 90;
bool TileLayer = false; bool TileLayer = false;
@ -1281,7 +1259,6 @@ void CEditor::DoToolbar(CUIRect ToolBar)
} }
s_RotationAmount = UiDoValueSelector(&s_RotationAmount, &Button, "", s_RotationAmount, TileLayer ? 90 : 1, 359, TileLayer ? 90 : 1, TileLayer ? 10.0f : 2.0f, "Rotation of the brush in degrees. Use left mouse button to drag and change the value. Hold shift to be more precise.", true); s_RotationAmount = UiDoValueSelector(&s_RotationAmount, &Button, "", s_RotationAmount, TileLayer ? 90 : 1, 359, TileLayer ? 90 : 1, TileLayer ? 10.0f : 2.0f, "Rotation of the brush in degrees. Use left mouse button to drag and change the value. Hold shift to be more precise.", true);
TB_Top.VSplitLeft(5.0f, &Button, &TB_Top);
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top); TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_CcwButton = 0; static int s_CcwButton = 0;
if(DoButton_Ex(&s_CcwButton, "CCW", Enabled, &Button, 0, "[R] Rotates the brush counter clockwise", CUI::CORNER_L) || (Input()->KeyPress(KEY_R) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0)) if(DoButton_Ex(&s_CcwButton, "CCW", Enabled, &Button, 0, "[R] Rotates the brush counter clockwise", CUI::CORNER_L) || (Input()->KeyPress(KEY_R) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0))
@ -1297,8 +1274,64 @@ void CEditor::DoToolbar(CUIRect ToolBar)
for(int i = 0; i < m_Brush.m_lLayers.size(); i++) for(int i = 0; i < m_Brush.m_lLayers.size(); i++)
m_Brush.m_lLayers[i]->BrushRotate(s_RotationAmount/360.0f*pi*2); m_Brush.m_lLayers[i]->BrushRotate(s_RotationAmount/360.0f*pi*2);
} }
TB_Top.VSplitLeft(5.0f, &Button, &TB_Top);
} }
// animation speed
if(m_Animate)
{
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_AnimFasterButton = 0;
if(DoButton_Ex(&s_AnimFasterButton, "A+", 0, &Button, 0, "Increase animation speed", CUI::CORNER_L))
m_AnimateSpeed += 0.5f;
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_AnimNormalButton = 0;
if(DoButton_Ex(&s_AnimNormalButton, "1", 0, &Button, 0, "Normal animation speed", 0))
m_AnimateSpeed = 1.0f;
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_AnimSlowerButton = 0;
if(DoButton_Ex(&s_AnimSlowerButton, "A-", 0, &Button, 0, "Decrease animation speed", CUI::CORNER_R))
{
if(m_AnimateSpeed > 0.5f)
m_AnimateSpeed -= 0.5f;
}
TB_Top.VSplitLeft(5.0f, &Button, &TB_Top);
}
// grid zoom
if(m_GridActive)
{
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_GridIncreaseButton = 0;
if(DoButton_Ex(&s_GridIncreaseButton, "G-", 0, &Button, 0, "Decrease grid", CUI::CORNER_L))
{
if(m_GridFactor > 1)
m_GridFactor--;
}
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_GridNormalButton = 0;
if(DoButton_Ex(&s_GridNormalButton, "1", 0, &Button, 0, "Normal grid", 0))
m_GridFactor = 1;
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
static int s_GridDecreaseButton = 0;
if(DoButton_Ex(&s_GridDecreaseButton, "G+", 0, &Button, 0, "Increase grid", CUI::CORNER_R))
{
if(m_GridFactor < 15)
m_GridFactor++;
}
TB_Top.VSplitLeft(5.0f, &Button, &TB_Top);
}
}
// Bottom line buttons
{
// refocus button // refocus button
{ {
TB_Bottom.VSplitLeft(45.0f, &Button, &TB_Bottom); TB_Bottom.VSplitLeft(45.0f, &Button, &TB_Bottom);
@ -1386,35 +1419,6 @@ void CEditor::DoToolbar(CUIRect ToolBar)
} }
} }
// grid zoom
if(m_GridActive)
{
TB_Bottom.VSplitLeft(30.0f, &Button, &TB_Bottom);
static int s_GridIncreaseButton = 0;
if(DoButton_Ex(&s_GridIncreaseButton, "G-", 0, &Button, 0, "Decrease grid", CUI::CORNER_L))
{
if(m_GridFactor > 1)
m_GridFactor--;
}
TB_Bottom.VSplitLeft(30.0f, &Button, &TB_Bottom);
static int s_GridNormalButton = 0;
if(DoButton_Ex(&s_GridNormalButton, "1", 0, &Button, 0, "Normal grid", 0))
m_GridFactor = 1;
TB_Bottom.VSplitLeft(30.0f, &Button, &TB_Bottom);
static int s_GridDecreaseButton = 0;
if(DoButton_Ex(&s_GridDecreaseButton, "G+", 0, &Button, 0, "Increase grid", CUI::CORNER_R))
{
if(m_GridFactor < 15)
m_GridFactor++;
}
TB_Bottom.VSplitLeft(5.0f, &Button, &TB_Bottom);
}
// do add quad/sound button // do add quad/sound button
CLayer *pLayer = GetSelectedLayer(0); CLayer *pLayer = GetSelectedLayer(0);
if(pLayer && (pLayer->m_Type == LAYERTYPE_QUADS || pLayer->m_Type == LAYERTYPE_SOUNDS)) if(pLayer && (pLayer->m_Type == LAYERTYPE_QUADS || pLayer->m_Type == LAYERTYPE_SOUNDS))
@ -1480,6 +1484,8 @@ void CEditor::DoToolbar(CUIRect ToolBar)
if(DoButton_Editor(&s_BrushDrawModeButton, "Destructive", m_BrushDrawDestructive, &Button, 0, "[ctrl+d] Toggle brush draw mode") || if(DoButton_Editor(&s_BrushDrawModeButton, "Destructive", m_BrushDrawDestructive, &Button, 0, "[ctrl+d] Toggle brush draw mode") ||
(Input()->KeyPress(KEY_D) && ctrlPressed)) (Input()->KeyPress(KEY_D) && ctrlPressed))
m_BrushDrawDestructive = !m_BrushDrawDestructive; m_BrushDrawDestructive = !m_BrushDrawDestructive;
TB_Bottom.VSplitLeft(5.0f, &Button, &TB_Bottom);
}
} }
} }