mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fix editor buttons for 5:4 resolutions
This commit is contained in:
parent
915bce38fc
commit
01024252b5
|
@ -984,7 +984,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
||||||
InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", "", CallbackSaveCopyMap, this);
|
InvokeFileDialog(IStorage::TYPE_SAVE, FILETYPE_MAP, "Save map", "Save", "maps", "", CallbackSaveCopyMap, this);
|
||||||
|
|
||||||
// detail button
|
// detail button
|
||||||
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
|
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
||||||
static int s_HqButton = 0;
|
static int s_HqButton = 0;
|
||||||
if(DoButton_Editor(&s_HqButton, "HD", m_ShowDetail, &Button, 0, "[ctrl+h] Toggle High Detail") ||
|
if(DoButton_Editor(&s_HqButton, "HD", m_ShowDetail, &Button, 0, "[ctrl+h] Toggle High Detail") ||
|
||||||
(Input()->KeyPress(KEY_H) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))))
|
(Input()->KeyPress(KEY_H) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL))))
|
||||||
|
@ -1017,6 +1017,16 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
||||||
|
|
||||||
TB_Top.VSplitLeft(5.0f, 0, &TB_Top);
|
TB_Top.VSplitLeft(5.0f, 0, &TB_Top);
|
||||||
|
|
||||||
|
// grid button
|
||||||
|
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
||||||
|
static int s_GridButton = 0;
|
||||||
|
if(DoButton_Editor(&s_GridButton, "Grid", m_GridActive, &Button, 0, "Toggle Grid"))
|
||||||
|
{
|
||||||
|
m_GridActive = !m_GridActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
TB_Top.VSplitLeft(5.0f, 0, &TB_Top);
|
||||||
|
|
||||||
// tile info button
|
// tile info button
|
||||||
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
TB_Top.VSplitLeft(40.0f, &Button, &TB_Top);
|
||||||
static int s_TileInfoButton = 0;
|
static int s_TileInfoButton = 0;
|
||||||
|
@ -1038,7 +1048,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
||||||
m_AllowPlaceUnusedTiles = !m_AllowPlaceUnusedTiles;
|
m_AllowPlaceUnusedTiles = !m_AllowPlaceUnusedTiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
TB_Top.VSplitLeft(15.0f, 0, &TB_Top);
|
TB_Top.VSplitLeft(10.0f, 0, &TB_Top);
|
||||||
|
|
||||||
// zoom group
|
// zoom group
|
||||||
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
|
TB_Top.VSplitLeft(30.0f, &Button, &TB_Top);
|
||||||
|
@ -1106,7 +1116,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotate buttons
|
// rotate buttons
|
||||||
TB_Top.VSplitLeft(15.0f, &Button, &TB_Top);
|
TB_Top.VSplitLeft(10.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;
|
||||||
|
@ -1139,38 +1149,20 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// quad manipulation
|
// refocus button
|
||||||
|
TB_Bottom.VSplitLeft(45.0f, &Button, &TB_Bottom);
|
||||||
|
static int s_RefocusButton = 0;
|
||||||
|
if(DoButton_Editor(&s_RefocusButton, "Refocus", m_WorldOffsetX&&m_WorldOffsetY?0:-1, &Button, 0, "[HOME] Restore map focus") || (m_EditBoxActive == 0 && Input()->KeyPress(KEY_HOME)))
|
||||||
{
|
{
|
||||||
// do add button
|
m_WorldOffsetX = 0;
|
||||||
TB_Top.VSplitLeft(10.0f, &Button, &TB_Top);
|
m_WorldOffsetY = 0;
|
||||||
TB_Top.VSplitLeft(60.0f, &Button, &TB_Top);
|
}
|
||||||
static int s_NewButton = 0;
|
|
||||||
|
|
||||||
CLayerQuads *pQLayer = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
TB_Bottom.VSplitLeft(5.0f, 0, &TB_Bottom);
|
||||||
//CLayerTiles *tlayer = (CLayerTiles *)get_selected_layer_type(0, LAYERTYPE_TILES);
|
|
||||||
if(DoButton_Editor(&s_NewButton, "Add Quad", pQLayer?0:-1, &Button, 0, "Adds a new quad"))
|
|
||||||
{
|
|
||||||
if(pQLayer)
|
|
||||||
{
|
|
||||||
float Mapping[4];
|
|
||||||
CLayerGroup *g = GetSelectedGroup();
|
|
||||||
g->Mapping(Mapping);
|
|
||||||
int AddX = f2fx(Mapping[0] + (Mapping[2]-Mapping[0])/2);
|
|
||||||
int AddY = f2fx(Mapping[1] + (Mapping[3]-Mapping[1])/2);
|
|
||||||
|
|
||||||
CQuad *q = pQLayer->NewQuad();
|
|
||||||
for(int i = 0; i < 5; i++)
|
|
||||||
{
|
|
||||||
q->m_aPoints[i].x += AddX;
|
|
||||||
q->m_aPoints[i].y += AddY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// tile manipulation
|
// tile manipulation
|
||||||
{
|
{
|
||||||
TB_Bottom.VSplitLeft(40.0f, &Button, &TB_Bottom);
|
TB_Bottom.VSplitLeft(45.0f, &Button, &TB_Bottom);
|
||||||
static int s_BorderBut = 0;
|
static int s_BorderBut = 0;
|
||||||
CLayerTiles *pT = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES);
|
CLayerTiles *pT = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES);
|
||||||
|
|
||||||
|
@ -1183,6 +1175,9 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
||||||
if(pT)
|
if(pT)
|
||||||
DoMapBorder();
|
DoMapBorder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TB_Bottom.VSplitLeft(10.0f, &Button, &TB_Bottom);
|
||||||
|
|
||||||
// do tele button
|
// do tele button
|
||||||
TB_Bottom.VSplitLeft(5.0f, &Button, &TB_Bottom);
|
TB_Bottom.VSplitLeft(5.0f, &Button, &TB_Bottom);
|
||||||
TB_Bottom.VSplitLeft(60.0f, &Button, &TB_Bottom);
|
TB_Bottom.VSplitLeft(60.0f, &Button, &TB_Bottom);
|
||||||
|
@ -1223,28 +1218,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TB_Bottom.VSplitLeft(5.0f, 0, &TB_Bottom);
|
TB_Bottom.VSplitLeft(10.0f, 0, &TB_Bottom);
|
||||||
|
|
||||||
// refocus button
|
|
||||||
TB_Bottom.VSplitLeft(50.0f, &Button, &TB_Bottom);
|
|
||||||
static int s_RefocusButton = 0;
|
|
||||||
if(DoButton_Editor(&s_RefocusButton, "Refocus", m_WorldOffsetX&&m_WorldOffsetY?0:-1, &Button, 0, "[HOME] Restore map focus") || (m_EditBoxActive == 0 && Input()->KeyPress(KEY_HOME)))
|
|
||||||
{
|
|
||||||
m_WorldOffsetX = 0;
|
|
||||||
m_WorldOffsetY = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
TB_Bottom.VSplitLeft(5.0f, 0, &TB_Bottom);
|
|
||||||
|
|
||||||
// grid button
|
|
||||||
TB_Bottom.VSplitLeft(50.0f, &Button, &TB_Bottom);
|
|
||||||
static int s_GridButton = 0;
|
|
||||||
if(DoButton_Editor(&s_GridButton, "Grid", m_GridActive, &Button, 0, "Toggle Grid"))
|
|
||||||
{
|
|
||||||
m_GridActive = !m_GridActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
TB_Bottom.VSplitLeft(30.0f, 0, &TB_Bottom);
|
|
||||||
|
|
||||||
// grid zoom
|
// grid zoom
|
||||||
TB_Bottom.VSplitLeft(30.0f, &Button, &TB_Bottom);
|
TB_Bottom.VSplitLeft(30.0f, &Button, &TB_Bottom);
|
||||||
|
@ -1294,6 +1268,35 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// quad manipulation
|
||||||
|
{
|
||||||
|
// do add button
|
||||||
|
TB_Bottom.VSplitLeft(10.0f, &Button, &TB_Bottom);
|
||||||
|
TB_Bottom.VSplitLeft(60.0f, &Button, &TB_Bottom);
|
||||||
|
static int s_NewButton = 0;
|
||||||
|
|
||||||
|
CLayerQuads *pQLayer = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||||
|
//CLayerTiles *tlayer = (CLayerTiles *)get_selected_layer_type(0, LAYERTYPE_TILES);
|
||||||
|
if(DoButton_Editor(&s_NewButton, "Add Quad", pQLayer?0:-1, &Button, 0, "Adds a new quad"))
|
||||||
|
{
|
||||||
|
if(pQLayer)
|
||||||
|
{
|
||||||
|
float Mapping[4];
|
||||||
|
CLayerGroup *g = GetSelectedGroup();
|
||||||
|
g->Mapping(Mapping);
|
||||||
|
int AddX = f2fx(Mapping[0] + (Mapping[2]-Mapping[0])/2);
|
||||||
|
int AddY = f2fx(Mapping[1] + (Mapping[3]-Mapping[1])/2);
|
||||||
|
|
||||||
|
CQuad *q = pQLayer->NewQuad();
|
||||||
|
for(int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
q->m_aPoints[i].x += AddX;
|
||||||
|
q->m_aPoints[i].y += AddY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Rotate(const CPoint *pCenter, CPoint *pPoint, float Rotation)
|
static void Rotate(const CPoint *pCenter, CPoint *pPoint, float Rotation)
|
||||||
|
|
Loading…
Reference in a new issue