mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-03 20:14:22 +02:00
Multiple updates
- Use viewport as render target for terminal: Terminal now only draws cells which changed since the last _draw() call. A viewport is used with clear mode set to NEVER to cache previous draw calls. The terminal node and viewport are wrapped by a GDScript Terminal node which takes care of resizing the viewport scene, and forcing the terminal to redraw all cells when necessary (i.e. on resize or theme change). Adds update_mode to terminal interface which can be set to one of: - DISABLED: terminal will never be drawn - AUTO: terminal will only draw the cells that changed, but automatically redraw the full screen when necessary (for example, when the size or theme changed). - ALL: terminal will always draw every cell on every update. This is the most reliable but least performant option. - ALL_NEXT_FRAME: Will use update_mode ALL for the next _draw() call, then change update_mode back to AUTO. - Upgraded libtsm: Includes changes from Fredrik Wikstrom (salass00)'s fork of libtsm. - Don't require theme to be set. Terminal will use default fonts/colors if no theme is set.
This commit is contained in:
parent
3dd89ec0a7
commit
d2f073d7ae
13 changed files with 312 additions and 178 deletions
10
test/scenes/basic.gd
Normal file
10
test/scenes/basic.gd
Normal file
|
@ -0,0 +1,10 @@
|
|||
extends Control
|
||||
|
||||
onready var terminal = $Terminal
|
||||
|
||||
|
||||
func _ready():
|
||||
print("terminal size; rows %d; cols %d;" % [terminal.rows, terminal.cols])
|
||||
terminal.write("h")
|
||||
yield(get_tree().create_timer(1), "timeout")
|
||||
terminal.write(" i")
|
29
test/scenes/basic.tscn
Normal file
29
test/scenes/basic.tscn
Normal file
|
@ -0,0 +1,29 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_xterm/nodes/terminal/terminal.gd" type="Script" id=2]
|
||||
[ext_resource path="res://test/scenes/basic.gd" type="Script" id=3]
|
||||
|
||||
[node name="BasicNewTerm" type="Control"]
|
||||
margin_right = 43.0
|
||||
margin_bottom = 43.0
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
color = Color( 0, 1, 0, 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Terminal" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
focus_mode = 1
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
21
test/scenes/basic_fullscreen.tscn
Normal file
21
test/scenes/basic_fullscreen.tscn
Normal file
|
@ -0,0 +1,21 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_xterm/nodes/terminal/terminal.gd" type="Script" id=1]
|
||||
[ext_resource path="res://test/scenes/basic.gd" type="Script" id=2]
|
||||
|
||||
[node name="BasicNewTerm" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Terminal" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
focus_mode = 1
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue