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

Method Toggle

src/game/client/components/console.cpp:1627–1662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1625}
1626
1627void CGameConsole::Toggle(int Type)
1628{
1629 if(m_ConsoleType != Type && (m_ConsoleState == CONSOLE_OPEN || m_ConsoleState == CONSOLE_OPENING))
1630 {
1631 // don't toggle console, just switch what console to use
1632 }
1633 else
1634 {
1635 if(m_ConsoleState == CONSOLE_CLOSED || m_ConsoleState == CONSOLE_OPEN)
1636 {
1637 m_StateChangeEnd = Client()->GlobalTime() + m_StateChangeDuration;
1638 }
1639 else
1640 {
1641 float Progress = m_StateChangeEnd - Client()->GlobalTime();
1642 float ReversedProgress = m_StateChangeDuration - Progress;
1643
1644 m_StateChangeEnd = Client()->GlobalTime() + ReversedProgress;
1645 }
1646
1647 if(m_ConsoleState == CONSOLE_CLOSED || m_ConsoleState == CONSOLE_CLOSING)
1648 {
1649 Ui()->SetEnabled(false);
1650 m_ConsoleState = CONSOLE_OPENING;
1651 }
1652 else
1653 {
1654 ConsoleForType(Type)->m_Input.Deactivate();
1655 Input()->MouseModeRelative();
1656 Ui()->SetEnabled(true);
1657 GameClient()->OnRelease();
1658 m_ConsoleState = CONSOLE_CLOSING;
1659 }
1660 }
1661 m_ConsoleType = Type;
1662}
1663
1664void CGameConsole::ConToggleLocalConsole(IConsole::IResult *pResult, void *pUserData)
1665{

Callers 3

RenderStartMenuMethod · 0.45
ConToggleLocalConsoleMethod · 0.45

Calls 8

UiFunction · 0.85
InputFunction · 0.85
GlobalTimeMethod · 0.80
SetEnabledMethod · 0.80
DeactivateMethod · 0.80
MouseModeRelativeMethod · 0.80
ClientFunction · 0.50
OnReleaseMethod · 0.45

Tested by

no test coverage detected