Implement get_cursor_pos()

This commit is contained in:
Leroy Hopson 2024-02-07 23:14:52 +13:00
parent 8c30bec861
commit 575c3875b6
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
2 changed files with 7 additions and 0 deletions

View file

@ -52,6 +52,7 @@ void Terminal::_bind_methods()
// Methods.
ClassDB::bind_method(D_METHOD("write", "data"), &Terminal::write);
ClassDB::bind_method(D_METHOD("get_cursor_pos"), &Terminal::get_cursor_pos);
}
Terminal::Terminal()
@ -104,6 +105,10 @@ int Terminal::get_rows() const
return rows;
}
Vector2 Terminal::get_cursor_pos() const {
return Vector2(tsm_screen_get_cursor_x(screen), tsm_screen_get_cursor_y(screen));
}
void Terminal::set_max_scrollback(const int p_max_scrollback)
{
max_scrollback = std::max(0, p_max_scrollback);

View file

@ -48,6 +48,8 @@ namespace godot
void set_rows(const int p_rows);
int get_rows() const;
Vector2 get_cursor_pos() const;
void set_max_scrollback(const int p_max_scrollback);
int get_max_scrollback() const;