forked from cmuratori/refterm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
refterm_example_terminal.h
123 lines (97 loc) · 2.42 KB
/
refterm_example_terminal.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
enum
{
TerminalCell_Bold = 0x1,
TerminalCell_Dim = 0x2,
TerminalCell_Italic = 0x4,
TerminalCell_Underline = 0x8,
TerminalCell_Blinking = 0x10,
TerminalCell_ReverseVideo = 0x20,
TerminalCell_Invisible = 0x40,
TerminalCell_Strikethrough = 0x80,
};
typedef struct
{
renderer_cell *Cells;
uint32_t DimX, DimY;
uint32_t FirstLineY;
} terminal_buffer;
typedef struct
{
int32_t X, Y;
} terminal_point;
typedef struct
{
uint32_t Foreground;
uint32_t Background;
uint32_t Flags;
} glyph_props;
typedef struct
{
terminal_point At;
glyph_props Props;
} cursor_state;
typedef struct
{
// TODO(casey): Get rid of Uniscribe so this garbage doesn't have to happen
SCRIPT_DIGITSUBSTITUTE UniDigiSub;
SCRIPT_CONTROL UniControl;
SCRIPT_STATE UniState;
SCRIPT_CACHE UniCache;
wchar_t Expansion[1024];
SCRIPT_ITEM Items[1024];
SCRIPT_LOGATTR Log[1024];
DWORD SegP[1026];
} example_partitioner;
typedef struct
{
size_t FirstP;
size_t OnePastLastP;
uint32_t ContainsComplexChars;
glyph_props StartingProps;
} example_line;
typedef struct
{
HWND Window;
int Quit;
d3d11_renderer Renderer;
glyph_generator GlyphGen;
void *GlyphTableMem;
glyph_table *GlyphTable;
terminal_buffer ScreenBuffer;
source_buffer ScrollBackBuffer;
example_partitioner Partitioner;
DWORD PipeSize;
HANDLE Legacy_WriteStdIn;
HANDLE Legacy_ReadStdOut;
HANDLE Legacy_ReadStdError;
int EnableFastPipe;
HANDLE FastPipeReady;
HANDLE FastPipe;
OVERLAPPED FastPipeTrigger;
HANDLE ChildProcess;
cursor_state RunningCursor;
wchar_t LastChar;
uint32_t CommandLineCount;
char CommandLine[256];
int NoThrottle;
int DebugHighlighting;
uint32_t MaxLineCount;
uint32_t CurrentLineIndex;
uint32_t LineCount;
example_line *Lines;
int32_t ViewingLineOffset;
wchar_t RequestedFontName[64];
uint32_t RequestedFontHeight;
int LineWrap;
uint32_t DefaultForegroundColor;
uint32_t DefaultBackgroundColor;
uint32_t REFTERM_TEXTURE_WIDTH;
uint32_t REFTERM_TEXTURE_HEIGHT;
uint32_t TransferWidth;
uint32_t TransferHeight;
uint32_t REFTERM_MAX_WIDTH;
uint32_t REFTERM_MAX_HEIGHT;
#define MinDirectCodepoint 32
#define MaxDirectCodepoint 126
gpu_glyph_index ReservedTileTable[MaxDirectCodepoint - MinDirectCodepoint + 1];
} example_terminal;