added a keyboard panel and a toggle button
This commit is contained in:
37
AGUI.Panels/AGUIKeyboard.gd
Normal file
37
AGUI.Panels/AGUIKeyboard.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
extends Node3D
|
||||
|
||||
signal isFinished(text) ## enter button
|
||||
|
||||
var text = ""
|
||||
var isShift = false
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func typeText(char:Variant):
|
||||
if char == "<=":
|
||||
if text.length() != 0:
|
||||
text = text.substr(0, text.length()-1)
|
||||
elif char == "Shift":
|
||||
return
|
||||
elif isShift:
|
||||
text += char.to_upper()
|
||||
else:
|
||||
text += char
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
$Label3D.text = text
|
||||
|
||||
|
||||
func _on_shift_button_pressed(char: Variant) -> void:
|
||||
isShift = true
|
||||
|
||||
|
||||
func _on_shift_button_released() -> void:
|
||||
isShift = false
|
||||
|
||||
|
||||
func _on_return_button_pressed(char: Variant) -> void:
|
||||
isFinished.emit(text)
|
||||
Reference in New Issue
Block a user