add extra check for space when setting labels and rename 'is_char' to 'is_unicode'
This commit is contained in:
parent
1f73e04865
commit
0376dd6450
@ -22,7 +22,6 @@ _typing_label = NodePath("TypingLabel")
|
||||
_layout_swap_label = NodePath("LayoutSwapLabel")
|
||||
|
||||
[node name="InputLabel" type="RichTextLabel" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
offset_left = 14.0
|
||||
offset_top = 15.0
|
||||
|
||||
@ -86,7 +86,7 @@ func _on_keyboard_key_press_changed(game_key: GameKey, event: InputEventKey) ->
|
||||
if not event.is_pressed():
|
||||
return
|
||||
|
||||
if game_key.props.is_char():
|
||||
if game_key.props.is_unicode():
|
||||
_set_typing_label(char(event.unicode))
|
||||
elif game_key.props.physical_keycode == KEY_SPACE:
|
||||
_set_typing_label(" ")
|
||||
|
||||
@ -217,7 +217,7 @@ func _set_labels(chars_dict: Dictionary[KeyProps.Char, String] = {}) -> void:
|
||||
|
||||
|
||||
func _set_labels_text(chars_dict: Dictionary[KeyProps.Char, String]) -> void:
|
||||
if not props.is_char():
|
||||
if props.physical_keycode == KEY_SPACE or not props.is_unicode():
|
||||
_center_label.text = OS.get_keycode_string(props.physical_keycode)
|
||||
return
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ func _load_config() -> Error:
|
||||
for key_props in row:
|
||||
var param_key := str(key_props.physical_keycode)
|
||||
if (
|
||||
not key_props.is_char()
|
||||
not key_props.is_unicode()
|
||||
or not _config.has_section_key(SECTION_KEYS, param_key)
|
||||
):
|
||||
continue
|
||||
@ -123,7 +123,7 @@ func _save_config() -> Error:
|
||||
|
||||
for row: Array[KeyProps] in layout_rows:
|
||||
for key_props in row:
|
||||
if not key_props.is_char():
|
||||
if not key_props.is_unicode():
|
||||
continue
|
||||
|
||||
_config.set_value(
|
||||
|
||||
@ -49,7 +49,7 @@ var alt_char: String
|
||||
var alt_shift_char: String
|
||||
|
||||
|
||||
func is_char() -> bool:
|
||||
func is_unicode() -> bool:
|
||||
return OS.is_keycode_unicode(physical_keycode)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user