MCPcopy Create free account
hub / github.com/ddnet/ddnet / OnInput

Method OnInput

src/game/editor/editor_server_settings.cpp:1757–1783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1755}
1756
1757bool CMapSettingsBackend::CContext::OnInput(const IInput::CEvent &Event)
1758{
1759 if(!m_pLineInput)
1760 return false;
1761
1762 if(!m_pLineInput->IsActive())
1763 return false;
1764
1765 if(Event.m_Flags & (IInput::FLAG_PRESS | IInput::FLAG_TEXT) && !m_pBackend->Input()->ModifierIsPressed() && !m_pBackend->Input()->AltIsPressed())
1766 {
1767 // How to make this better?
1768 // This checks when we press any key that is not handled by the dropdown
1769 // When that's the case, it means we confirm the completion if we have a valid completion index
1770 if(Event.m_Key != KEY_TAB && Event.m_Key != KEY_LSHIFT && Event.m_Key != KEY_RSHIFT && Event.m_Key != KEY_UP && Event.m_Key != KEY_DOWN && !(Event.m_Key >= KEY_MOUSE_1 && Event.m_Key <= KEY_MOUSE_WHEEL_RIGHT))
1771 {
1772 if(m_CurrentCompletionIndex != -1)
1773 {
1774 m_CurrentCompletionIndex = -1;
1775 m_DropdownContext.m_Selected = -1;
1776 Update();
1777 UpdateCursor(true);
1778 }
1779 }
1780 }
1781
1782 return false;
1783}
1784
1785const char *CMapSettingsBackend::CContext::InputString() const
1786{

Callers

nothing calls this directly

Calls 4

ModifierIsPressedMethod · 0.80
AltIsPressedMethod · 0.80
IsActiveMethod · 0.45
InputMethod · 0.45

Tested by

no test coverage detected