mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix console line bug when resizing
This commit is contained in:
parent
ca07c0a92f
commit
956afed264
|
@ -73,6 +73,16 @@ void CGameConsole::CInstance::ClearBacklog()
|
|||
m_BacklogActPage = 0;
|
||||
}
|
||||
|
||||
void CGameConsole::CInstance::ClearBacklogYOffsets()
|
||||
{
|
||||
auto *pEntry = m_Backlog.First();
|
||||
while(pEntry)
|
||||
{
|
||||
pEntry->m_YOffset = -1.0f;
|
||||
pEntry = m_Backlog.Next(pEntry);
|
||||
}
|
||||
}
|
||||
|
||||
void CGameConsole::CInstance::ClearHistory()
|
||||
{
|
||||
m_History.Init();
|
||||
|
@ -993,6 +1003,17 @@ void CGameConsole::OnConsoleInit()
|
|||
Console()->Chain("console_output_level", ConchainConsoleOutputLevelUpdate, this);
|
||||
}
|
||||
|
||||
void CGameConsole::OnInit()
|
||||
{
|
||||
// add resize event
|
||||
Graphics()->AddWindowResizeListener([this](void *) {
|
||||
m_LocalConsole.ClearBacklogYOffsets();
|
||||
m_RemoteConsole.ClearBacklogYOffsets();
|
||||
m_HasSelection = false;
|
||||
},
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void CGameConsole::OnStateChange(int NewState, int OldState)
|
||||
{
|
||||
if(OldState == IClient::STATE_ONLINE && NewState < IClient::STATE_LOADING)
|
||||
|
|
|
@ -59,6 +59,7 @@ class CGameConsole : public CComponent
|
|||
void Init(CGameConsole *pGameConsole);
|
||||
|
||||
void ClearBacklog();
|
||||
void ClearBacklogYOffsets();
|
||||
void ClearHistory();
|
||||
|
||||
void ExecuteLine(const char *pLine);
|
||||
|
@ -125,6 +126,7 @@ public:
|
|||
|
||||
virtual void OnStateChange(int NewState, int OldState);
|
||||
virtual void OnConsoleInit();
|
||||
virtual void OnInit();
|
||||
virtual void OnReset();
|
||||
virtual void OnRender();
|
||||
virtual void OnMessage(int MsgType, void *pRawMsg);
|
||||
|
|
Loading…
Reference in a new issue