Polyphase Game Engine
Loading...
Searching...
No Matches
TerminalPanel.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
5#include "CommandHistory.h"
6#include "TerminalSession.h"
7
8#include <set>
9#include <string>
10
11struct ImGuiInputTextCallbackData;
12
22class TerminalPanel
23{
24public:
25 void DrawContent();
26 void Tick();
27 void Shutdown();
28
29 bool mVisible = false;
30
31private:
32 void DrawToolbar();
33 void DrawTuiKeys();
34 void DrawOutput();
35 void DrawInput();
36 void OnSubmit();
37 void ForwardKeysToProcess();
38
39 static int InputCallback(ImGuiInputTextCallbackData* data);
40
41 TerminalSession mSession;
42 CommandHistory mHistory;
43
44 char mInputBuffer[2048] = {};
45 bool mAutoScroll = true;
46 bool mFocusInputNextFrame = false;
47 bool mFocusOutputNextFrame = false;
48 bool mPrevVisible = false;
49 bool mLaunchedThisOpen = false;
50
51 bool mScrollToBottom = false;
52
53 // Multi-row selection in the output area. mSelectedLineIndices holds
54 // the set of currently-selected (zero-based) row indices. mSelectionAnchor
55 // is the row index of the most recent plain click and acts as the anchor
56 // for shift-click range extension. mSelectionLineCount is the row count
57 // observed on the previous frame and is used to drop indices that fell
58 // off the top of the bounded ring buffer.
59 std::set<int> mSelectedLineIndices;
60 int mSelectionAnchor = -1;
61 int mSelectionLineCount = 0;
62
63 // Build a newline-joined string of the rows in mSelectedLineIndices,
64 // walking the buffer in row order so the result matches on-screen order.
65 // Not const because TerminalSession::GetBuffer() is non-const.
66 std::string BuildSelectedLinesText();
67
68 // Build a newline-joined string of every entry in the buffer.
69 std::string BuildAllLinesText();
70};
71
72TerminalPanel* GetTerminalPanel();
73
74#endif
void Shutdown()
Definition Engine.cpp:916
void Tick()
Definition HttpClient.cpp:202