WIP: Add readline util

This commit is contained in:
Leroy Hopson 2021-10-17 21:48:59 +07:00
parent 04e07ec9a7
commit 52b7ac2970
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
6 changed files with 334 additions and 2 deletions

View file

@ -0,0 +1,12 @@
extends "res://addons/godot_xterm/terminal.gd"
const Readline = preload("res://addons/godot_xterm/util/readline.gd")
var rl: Readline
func _ready():
rl = Readline.new(self)
while true:
var line: String = yield(rl.readline("Enter something (anything): "), "completed")
write("\r\nYou entered: %s\r\n" % line)

View file

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://examples/readline/readline.gd" type="Script" id=1]
[node name="Terminal" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( -194.759, 935.803 )
focus_mode = 2
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}