-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.h
71 lines (56 loc) · 1.58 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
62
63
64
65
66
67
68
69
70
71
#ifndef CONSOLE_H
#define CONSOLE_H
#include "vtypes.h"
#include <vector>
#include <map>
#include <list>
#include <string>
class Console
{
typedef std::vector<std::string> StringVec;
typedef void (Console::*ConsoleFunc)(const StringVec& args);
typedef std::list<std::string> StringList;
typedef std::map<std::string, ConsoleFunc> FunctionMap;
// Temporary, until a proper image infrastructure is put in place.
struct Image
{
int width;
int height;
u8* pixels;
Image()
{
width = height = 0;
pixels = 0;
}
};
Image background;
int yposition; // 0 is completely hidden from view. gfx.YRes()/2 is all the way down
int direction; // -1 = moving up. 0 = not moving. 1 = moving down
int hFont; // font handle
FunctionMap functions; // functions the console knows about
StringList output; // text output
std::string curcommand; // current text buffer
bool enabled;
public:
Console();
~Console();
void Draw();
void SendKey(char c);
void Exec(const std::string& command);
void Open();
void Close();
bool IsOpen();
void Enable();
void Disable();
void Write(const char* msg);
private:
std::string TabComplete(const std::string& cmd);
// Console functions
void Ver(const StringVec& args);
void Clear(const StringVec& args);
void Exit(const StringVec& args);
void Help(const StringVec& args);
void SetBackground(const StringVec& args);
void CPUInfo(const StringVec& args);
};
#endif