mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-10 04:40:25 +01:00
Add namespace
Adds a globally unique namespace `GDXterm` that can be used to conveniently access scripts.
This commit is contained in:
parent
964af715d6
commit
39702646dc
4 changed files with 20 additions and 7 deletions
5
addons/godot_xterm/namespace.gd
Normal file
5
addons/godot_xterm/namespace.gd
Normal file
|
@ -0,0 +1,5 @@
|
|||
class_name GDXterm
|
||||
|
||||
const Terminal := preload("./nodes/terminal/terminal.gd")
|
||||
const PTYUnix := preload("./nodes/pty/unix/pty_unix.gd")
|
||||
const TPut := preload("./util/tput.gd")
|
|
@ -8,8 +8,6 @@ extends Control
|
|||
# - https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html
|
||||
# - https://www.youtube.com/watch?v=jTSQlIK_92w
|
||||
|
||||
const TPut := preload("res://addons/godot_xterm/util/tput.gd")
|
||||
|
||||
# Title generated using command: toilet -f pagga GODOT XTERM
|
||||
const TITLE = """
|
||||
░█▀▀░█▀█░█▀▄░█▀█░▀█▀░░░█░█░▀█▀░█▀▀░█▀▄░█▄█\r
|
||||
|
@ -38,7 +36,7 @@ var row: int
|
|||
var menu_start_row: int
|
||||
var offset: int
|
||||
|
||||
onready var tput = TPut.new($Terminal)
|
||||
onready var tput = GDXterm.TPut.new($Terminal)
|
||||
|
||||
|
||||
func _ready():
|
||||
|
@ -105,10 +103,10 @@ func draw_menu():
|
|||
|
||||
func _on_Terminal_key_pressed(data: String, event: InputEventKey) -> void:
|
||||
match data:
|
||||
TPut.CURSOR_UP: # Up arrow key
|
||||
tput.CURSOR_UP: # Up arrow key
|
||||
selected_index = int(clamp(selected_index - 1, 0, menu_items.size() - 1))
|
||||
draw_menu()
|
||||
TPut.CURSOR_DOWN: # Down arrow key
|
||||
tput.CURSOR_DOWN: # Down arrow key
|
||||
selected_index = int(clamp(selected_index + 1, 0, menu_items.size() - 1))
|
||||
draw_menu()
|
||||
"1":
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends "res://addons/godot_xterm/nodes/terminal/terminal.gd"
|
||||
extends GDXterm.Terminal
|
||||
|
||||
onready var pty = $PTY
|
||||
|
||||
|
|
|
@ -8,6 +8,16 @@
|
|||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ {
|
||||
"base": "Reference",
|
||||
"class": "GDXterm",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/godot_xterm/namespace.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"GDXterm": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Godot Xterm"
|
||||
|
@ -20,7 +30,7 @@ window/vsync/use_vsync=false
|
|||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PoolStringArray( "res://addons/godot_xterm/plugin.cfg", "res://addons/gut/plugin.cfg" )
|
||||
enabled=PoolStringArray( "res://addons/godot_xterm/plugin.cfg" )
|
||||
|
||||
[rendering]
|
||||
|
||||
|
|
Loading…
Reference in a new issue