Merge pull request #70378 from Calinou/os-expose-read-from-stdin-3.x

Expose `OS.read_string_from_stdin()` to the scripting API (3.x)
This commit is contained in:
Rémi Verschelde 2023-01-20 12:12:35 +01:00
commit f3da393b44
No known key found for this signature in database
GPG key ID: C3336907360768E1
10 changed files with 26 additions and 21 deletions

View file

@ -136,15 +136,11 @@ void OS_Unix::alert(const String &p_alert, const String &p_title) {
fprintf(stderr, "ALERT: %s: %s\n", p_title.utf8().get_data(), p_alert.utf8().get_data());
}
String OS_Unix::get_stdin_string(bool p_block) {
if (p_block) {
char buff[1024];
String ret = stdin_buf + fgets(buff, 1024, stdin);
stdin_buf = "";
return ret;
}
return "";
String OS_Unix::get_stdin_string() {
char buff[1024];
String ret = stdin_buf + fgets(buff, 1024, stdin);
stdin_buf = "";
return ret;
}
String OS_Unix::get_name() const {

View file

@ -53,7 +53,7 @@ public:
OS_Unix();
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
virtual String get_stdin_string(bool p_block);
virtual String get_stdin_string();
//virtual void set_mouse_show(bool p_show);
//virtual void set_mouse_grab(bool p_grab);