mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
saving server settings within the map and loading them on init
This commit is contained in:
parent
7bd0f276d4
commit
c025dc2235
|
@ -4743,7 +4743,8 @@ void CEditor::RenderServerSettingsEditor(CUIRect View)
|
|||
// buttons
|
||||
ToolBar.VSplitRight(50.0f, &ToolBar, &Button);
|
||||
static int s_AddButton = 0;
|
||||
if(DoButton_Editor(&s_AddButton, "Add", 0, &Button, 0, "Add a command to command list."))
|
||||
if(DoButton_Editor(&s_AddButton, "Add", 0, &Button, 0, "Add a command to command list.")
|
||||
|| ((Input()->KeyDown(KEY_RETURN) || Input()->KeyDown(KEY_KP_ENTER)) && UI()->LastActiveItem() == &m_CommandBox))
|
||||
{
|
||||
if(m_aSettingsCommand[0] != 0 && str_find(m_aSettingsCommand, " "))
|
||||
{
|
||||
|
@ -4769,7 +4770,8 @@ void CEditor::RenderServerSettingsEditor(CUIRect View)
|
|||
ToolBar.VSplitRight(50.0f, &ToolBar, &Button);
|
||||
Button.VSplitRight(5.0f, &Button, 0);
|
||||
static int s_AddButton = 0;
|
||||
if(DoButton_Editor(&s_AddButton, "Del", 0, &Button, 0, "Delete a command from the command list."))
|
||||
if(DoButton_Editor(&s_AddButton, "Del", 0, &Button, 0, "Delete a command from the command list.")
|
||||
|| Input()->KeyDown(KEY_DELETE))
|
||||
if(s_CommandSelectedIndex > -1 && s_CommandSelectedIndex < m_Map.m_lSettings.size())
|
||||
m_Map.m_lSettings.remove_index(s_CommandSelectedIndex);
|
||||
}
|
||||
|
@ -4794,6 +4796,20 @@ void CEditor::RenderServerSettingsEditor(CUIRect View)
|
|||
ListBox.VSplitRight(3.0f, &ListBox, 0); // extra spacing
|
||||
Scroll.HMargin(5.0f, &Scroll);
|
||||
s_ScrollValue = UiDoScrollbarV(&s_ScrollBar, &Scroll, s_ScrollValue);
|
||||
|
||||
if(UI()->MouseInside(&Scroll) || UI()->MouseInside(&ListBox))
|
||||
{
|
||||
int ScrollNum = (int)((ListHeight-ListBox.h)/17.0f)+1;
|
||||
if(ScrollNum > 0)
|
||||
{
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_UP))
|
||||
s_ScrollValue = clamp(s_ScrollValue - 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
if(Input()->KeyPresses(KEY_MOUSE_WHEEL_DOWN))
|
||||
s_ScrollValue = clamp(s_ScrollValue + 1.0f/ScrollNum, 0.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
ScrollNum = 0;
|
||||
}
|
||||
}
|
||||
|
||||
float ListStartAt = ScrollDifference * s_ScrollValue;
|
||||
|
|
Loading…
Reference in a new issue