-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathterminal.cpp
More file actions
52 lines (40 loc) · 963 Bytes
/
terminal.cpp
File metadata and controls
52 lines (40 loc) · 963 Bytes
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
#include "IrChat.h"
void UpdateTerminalLine(HDC hdc, int y)
{
int n = (y<(maxrow/2)) ? 0 : 2;
n = (y*txtheight)+MENUBARHEIGHT+n;
ExtTextOut(hdc,0,n,0,NULL,screen+y*maxcol,maxcol,NULL);
}
void UpdateTerminalScreen(HDC hdc)
{
int r;
for(r=0; r<maxrow; r++)
UpdateTerminalLine(hdc,r);
}
void ClearTerminalScreen(HDC hdc)
{
int r, c;
for(r=0; r<maxrow; r++)
for(c=0; c<maxcol; c++)
screen[r*maxcol+c] = ' ';
if(hdc)
UpdateTerminalScreen(hdc);
}
void ScrollScreenUp(HDC hdc, int row1, int row2)
{
int r;
row2--;
for(r=row1; r<row2; r++)
{
memcpy(&screen[r*maxcol],&screen[(r+1)*maxcol],maxcol*sizeof(TCHAR));
UpdateTerminalLine(hdc,r);
}
for(r=0; r<maxcol; r++)
screen[row2*maxcol+r] = (TCHAR)' ';
UpdateTerminalLine(hdc,row2);
}
void OutCh(HDC hdc, int row, int col, TCHAR ch)
{
screen[row*maxcol+col] = ch;
UpdateTerminalLine(hdc,row);
}