-
Notifications
You must be signed in to change notification settings - Fork 36
/
console.h
61 lines (45 loc) · 1.09 KB
/
console.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef _CONSOLE_H
#define _CONSOLE_H
#define CONSOLE_MAXCMDLEN 48
#define CONSOLE_MAXRESPONSELEN 48
// how many commands to remember in the backbuffer
#define CONSOLE_MAX_BACK 8
struct CommandEntry
{
const char *name;
void (*handler)(StringList *args, int num);
int minArgs, maxArgs;
};
class DebugConsole
{
public:
DebugConsole();
void SetVisible(bool newstate);
bool IsVisible();
bool HandleKey(int key);
void HandleKeyRelease(int key);
void Draw();
bool Execute(const char *line);
void Print(const char *fmt, ...);
private:
void DrawText(const char *text);
void MatchCommand(const char *cmd, BList *matches);
char *SplitCommand(const char *line_in, StringList *args);
void ExpandCommand();
char fLine[CONSOLE_MAXCMDLEN];
int fLineLen;
int fKeyDown;
int fRepeatTimer;
char fLineToExpand[CONSOLE_MAXCMDLEN];
bool fBrowsingExpansion;
int fExpandIndex;
char fResponse[CONSOLE_MAXRESPONSELEN];
int fResponseTimer;
int fCursorTimer;
bool fVisible;
// up-down last-command buffer
int fBackIndex;
StringList fBackBuffer;
};
extern DebugConsole console;
#endif