mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-23 10:10:24 +01:00
a849423096
Rewrites the Terminal class as a GDExtension to be used directly in Godot without a terminal.gd proxy. Breaks a lot of things in its current state (e.g. signals and other functions have not be implemented yet), but does add support for transparent colors and true color inversion. It also seems to be about 4x faster (FPS-wise) than the old version with some basic stress testing. Old source code has been moved to a different directory to be copied over and/or rewritten piece by piece.
47 lines
769 B
C++
47 lines
769 B
C++
// SPDX-FileCopyrightText: 2021-2022 Leroy Hopson <godot-xterm@leroy.geek.nz>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#ifndef GODOT_XTERM_PIPE_H
|
|
#define GODOT_XTERM_PIPE_H
|
|
|
|
#include <godot_cpp/classes/ref_counted.hpp>
|
|
#include <godot_cpp/variant/packed_byte_array.hpp>
|
|
#include <uv.h>
|
|
|
|
namespace godot {
|
|
|
|
class Pipe : public RefCounted {
|
|
GDCLASS(Pipe, RefCounted)
|
|
|
|
public:
|
|
uv_pipe_t handle;
|
|
|
|
Pipe();
|
|
~Pipe();
|
|
|
|
void _init();
|
|
|
|
Error open(int fd, bool ipc);
|
|
void close();
|
|
int get_status();
|
|
|
|
Error write(PackedByteArray data);
|
|
|
|
void pause();
|
|
void resume();
|
|
|
|
public:
|
|
int status;
|
|
|
|
protected:
|
|
static void _bind_methods();
|
|
|
|
private:
|
|
void _poll_connection();
|
|
|
|
static Error _translate_error(int err);
|
|
};
|
|
|
|
} // namespace godot
|
|
|
|
#endif // GODOT_XTERM_PIPE_H
|