diff --git a/addons/godot_xterm/native/src/terminal.cpp b/addons/godot_xterm/native/src/terminal.cpp index 034ce80..5705549 100644 --- a/addons/godot_xterm/native/src/terminal.cpp +++ b/addons/godot_xterm/native/src/terminal.cpp @@ -31,6 +31,18 @@ void Terminal::_bind_methods() ClassDB::bind_method(D_METHOD("set_max_scrollback", "max_scrollback"), &Terminal::set_max_scrollback); ClassDB::add_property("Terminal", PropertyInfo(Variant::INT, "max_scrollback"), "set_max_scrollback", "get_max_scrollback"); + // Blink. + + ClassDB::add_property_group("Terminal", "Blink", "blink_"); + ClassDB::bind_method(D_METHOD("get_blink_on_time"), &Terminal::get_blink_on_time); + ClassDB::bind_method(D_METHOD("set_blink_on_time", "time"), &Terminal::set_blink_on_time); + ClassDB::add_property("Terminal", PropertyInfo(Variant::FLOAT, "blink_on_time"), "set_blink_on_time", "get_blink_on_time"); + ClassDB::bind_method(D_METHOD("get_blink_off_time"), &Terminal::get_blink_off_time); + ClassDB::bind_method(D_METHOD("set_blink_off_time", "time"), &Terminal::set_blink_off_time); + ClassDB::add_property("Terminal", PropertyInfo(Variant::FLOAT, "blink_off_time"), "set_blink_off_time", "get_blink_off_time"); + + // Methods. + ClassDB::bind_method(D_METHOD("write", "data"), &Terminal::write); } @@ -38,6 +50,8 @@ Terminal::Terminal() { max_scrollback = 1000; + blink_on_time = 0.6; + blink_off_time = 0.3; if (tsm_screen_new(&screen, NULL, NULL)) { @@ -455,3 +469,25 @@ void Terminal::cleanup_rendering() { rs->free_rid(char_material); rs->free_rid(char_shader); } + +void Terminal::set_blink_on_time(const float time) +{ + blink_on_time = time; + fore_material->set_shader_parameter("blink_on_time", blink_on_time); +} + +float Terminal::get_blink_on_time() const +{ + return blink_on_time; +} + +void Terminal::set_blink_off_time(const float time) +{ + blink_off_time = time; + fore_material->set_shader_parameter("blink_off_time", blink_off_time); +} + +float Terminal::get_blink_off_time() const +{ + return blink_off_time; +} \ No newline at end of file diff --git a/addons/godot_xterm/native/src/terminal.h b/addons/godot_xterm/native/src/terminal.h index 037902c..aac24f9 100644 --- a/addons/godot_xterm/native/src/terminal.h +++ b/addons/godot_xterm/native/src/terminal.h @@ -46,6 +46,12 @@ namespace godot void set_max_scrollback(const int p_max_scrollback); int get_max_scrollback() const; + void set_blink_on_time(const float p_blink_on_time); + float get_blink_on_time() const; + + void set_blink_off_time(const float p_blink_off_time); + float get_blink_off_time() const; + void write(Variant data); protected: @@ -57,6 +63,9 @@ namespace godot unsigned int cols; unsigned int rows; + float blink_on_time; + float blink_off_time; + RenderingServer *rs; tsm_screen *screen;