blob: df39e6cd0d081d19796cf0007c9c671c590af4fa (
plain) (
blame)
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
|
#ifndef TTY_H
#define TTY_H
#include "common.h"
#include "fifobuffer.h"
#include "termios.h"
#define TTY_LINEBUFFER_SIZE 1024
typedef struct Tty Tty;
typedef void (*TtyFlushScreenFunction)(Tty* tty);
typedef struct Tty {
uint16 lineCount;
uint16 columnCount;
uint8* buffer;
uint16 currentLine;
uint16 currentColumn;
uint8 color;
void* privateData;
uint8 lineBuffer[TTY_LINEBUFFER_SIZE];
uint32 lineBufferIndex;
FifoBuffer* keyBuffer;
struct termios term;
TtyFlushScreenFunction flushScreen;
} Tty;
Tty* createTty(uint16 lineCount, uint16 columnCount, TtyFlushScreenFunction flushFunction);
void destroyTty(Tty* tty);
void Tty_Print(Tty* tty, int row, int column, const char* text);
void Tty_Clear(Tty* tty);
void Tty_PutChar(Tty* tty, char c);
void Tty_PutText(Tty* tty, const char* text);
void Tty_MoveCursor(Tty* tty, uint16 line, uint16 column);
void Tty_ScrollUp(Tty* tty);
#endif // TTY_H
|