mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-23 02:00:25 +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.
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
#ifndef GODOT_XTERM_UV_UTILS_H
|
|
#define GODOT_XTERM_UV_UTILS_H
|
|
|
|
#include <godot_cpp/classes/ref_counted.hpp>
|
|
#include <uv.h>
|
|
|
|
#define UV_ERR_PRINT(uv_err) \
|
|
ERR_PRINT(String(uv_err_name(uv_err)) + String(": ") + \
|
|
String(uv_strerror(uv_err)));
|
|
|
|
#define RETURN_UV_ERR(uv_err) \
|
|
if (uv_err < 0) { \
|
|
UV_ERR_PRINT(uv_err); \
|
|
} \
|
|
return LibuvUtils::translate_uv_errno(uv_err);
|
|
|
|
#define RETURN_IF_UV_ERR(uv_err) \
|
|
if (uv_err < 0) { \
|
|
RETURN_UV_ERR(uv_err); \
|
|
}
|
|
|
|
namespace godot {
|
|
|
|
class LibuvUtils : public RefCounted {
|
|
GDCLASS(LibuvUtils, RefCounted)
|
|
|
|
public:
|
|
LibuvUtils();
|
|
~LibuvUtils();
|
|
|
|
static Dictionary get_os_environ();
|
|
static String get_os_release();
|
|
static String get_cwd();
|
|
|
|
static Error kill(int pid, int signum);
|
|
|
|
public:
|
|
static Error translate_uv_errno(int uv_err);
|
|
|
|
protected:
|
|
static void _bind_methods();
|
|
};
|
|
|
|
} // namespace godot
|
|
|
|
#endif // GODOT_XTERM_UV_UTILS_H
|