Convert from GDNative to GDExtension

Work in progress.
This commit is contained in:
Leroy Hopson 2022-12-29 22:52:13 +13:00
parent 6b47d35835
commit 44f7e3801c
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
25 changed files with 408 additions and 304 deletions

View file

@ -110,10 +110,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":
@ -127,7 +127,7 @@ func _on_Terminal_key_pressed(data: String, event: InputEventKey) -> void:
draw_menu()
# We can also match against the raw InputEventKey.
if event.scancode == KEY_ENTER:
if event.keycode == KEY_ENTER:
var item = menu_items[selected_index]
match item.name:
@ -160,9 +160,11 @@ func _on_Terminal_key_pressed(data: String, event: InputEventKey) -> void:
$Terminal.grab_focus()
scene.queue_free()
"Exit":
if OS.has_feature("JavaScript"):
JavaScript.eval("window.history.back() || window.close()")
get_tree().quit()
pass
# FIXME
#if OS.has_feature("JavaScript"):
#JavaScript.eval("window.history.back() || window.close()")
#get_tree().quit()
func _on_Asciicast_key_pressed(

View file

@ -8,15 +8,17 @@ layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("2")
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Terminal" type="Control" parent="."]
layout_mode = 3
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
focus_mode = 1
script = ExtResource("1")
copy_on_selection = false