Update file format

Automatically updated by VSCode upon saving the files.
This commit is contained in:
Leroy Hopson 2020-09-24 14:27:26 +07:00
parent 8d3eec465f
commit 0dabc56076
2 changed files with 65 additions and 65 deletions

View file

@ -9,39 +9,39 @@
namespace godot namespace godot
{ {
class Pseudoterminal : public Node class Pseudoterminal : public Node
{ {
GODOT_CLASS(Pseudoterminal, Node) GODOT_CLASS(Pseudoterminal, Node)
public: public:
static const int MAX_READ_BUFFER_LENGTH = 1024; static const int MAX_READ_BUFFER_LENGTH = 1024;
static const int MAX_WRITE_BUFFER_LENGTH = 1024; static const int MAX_WRITE_BUFFER_LENGTH = 1024;
private: private:
std::thread pty_thread; std::thread pty_thread;
bool should_process_pty; bool should_process_pty;
char write_buffer[MAX_WRITE_BUFFER_LENGTH]; char write_buffer[MAX_WRITE_BUFFER_LENGTH];
int bytes_to_write; int bytes_to_write;
std::mutex write_buffer_mutex; std::mutex write_buffer_mutex;
char read_buffer[MAX_READ_BUFFER_LENGTH]; char read_buffer[MAX_READ_BUFFER_LENGTH];
int bytes_to_read; int bytes_to_read;
std::mutex read_buffer_mutex; std::mutex read_buffer_mutex;
void process_pty(); void process_pty();
public: public:
static void _register_methods(); static void _register_methods();
Pseudoterminal(); Pseudoterminal();
~Pseudoterminal(); ~Pseudoterminal();
void _init(); void _init();
void _ready(); void _ready();
void put_data(PoolByteArray data); void put_data(PoolByteArray data);
}; };
} // namespace godot } // namespace godot
#endif // PSEUDOTERMINAL_H #endif // PSEUDOTERMINAL_H

View file

@ -11,63 +11,63 @@
namespace godot namespace godot
{ {
class Terminal : public Control class Terminal : public Control
{
GODOT_CLASS(Terminal, Control)
public:
struct cell
{ {
char ch[5]; GODOT_CLASS(Terminal, Control)
struct tsm_screen_attr attr;
} empty_cell = {ch : {0, 0, 0, 0, 0}, attr : {}};
public: public:
typedef std::vector<std::vector<struct cell>> Cells; struct cell
typedef std::vector<struct cell> Row; {
char ch[5];
struct tsm_screen_attr attr;
} empty_cell = {ch : {0, 0, 0, 0, 0}, attr : {}};
Cells cells; public:
typedef std::vector<std::vector<struct cell>> Cells;
typedef std::vector<struct cell> Row;
protected: Cells cells;
tsm_screen *screen;
tsm_vte *vte;
private: protected:
static const uint8_t default_color_palette[TSM_COLOR_NUM][3]; tsm_screen *screen;
tsm_vte *vte;
Vector2 cell_size; private:
std::map<int, Color> palette = {}; static const uint8_t default_color_palette[TSM_COLOR_NUM][3];
void update_size(); Vector2 cell_size;
std::map<int, Color> palette = {};
void update_color_palette(); void update_size();
std::pair<Color, Color> get_cell_colors(int row, int col);
void draw_background(int row, int col, Color bgcol);
void draw_foreground(int row, int col, Color fgcol);
public: void update_color_palette();
static void _register_methods(); std::pair<Color, Color> get_cell_colors(int row, int col);
void draw_background(int row, int col, Color bgcol);
void draw_foreground(int row, int col, Color fgcol);
Terminal(); public:
~Terminal(); static void _register_methods();
void _init(); Terminal();
void _ready(); ~Terminal();
void _notification(int what);
void _input(Variant event);
void _draw();
void write(PoolByteArray bytes); void _init();
void _ready();
void _notification(int what);
void _input(Variant event);
void _draw();
int rows; void write(PoolByteArray bytes);
int cols;
bool sleep; int rows;
int cols;
uint8_t color_palette[TSM_COLOR_NUM][3]; bool sleep;
tsm_age_t framebuffer_age; uint8_t color_palette[TSM_COLOR_NUM][3];
};
tsm_age_t framebuffer_age;
};
} // namespace godot } // namespace godot
#endif // TERMINAL_H #endif // TERMINAL_H