replace non-printable unknown key keycodes with KEY_SPECIAL
This commit is contained in:
parent
86bebe3410
commit
fb872bdcda
@ -67,14 +67,15 @@ static func instantiate_with_props(
|
||||
var node := _scene.instantiate() as GameKey
|
||||
node.keyboard = _keyboard
|
||||
|
||||
var input_event := InputEventKey.new()
|
||||
input_event.physical_keycode = _props.physical_keycode
|
||||
input_event.location = _props.location
|
||||
node.input_event_init = input_event
|
||||
if _props.physical_keycode != KEY_SPECIAL:
|
||||
var input_event := InputEventKey.new()
|
||||
input_event.physical_keycode = _props.physical_keycode
|
||||
input_event.location = _props.location
|
||||
node.input_event_init = input_event
|
||||
|
||||
node.name = node.name + " " + input_event.as_text_physical_keycode()
|
||||
if _props.location != KEY_LOCATION_UNSPECIFIED:
|
||||
node.name += " " + input_event.as_text_location()
|
||||
node.name = node.name + " " + input_event.as_text_physical_keycode()
|
||||
if _props.location != KEY_LOCATION_UNSPECIFIED:
|
||||
node.name += " " + input_event.as_text_location()
|
||||
|
||||
node.load_props(_props, default_position)
|
||||
|
||||
@ -204,7 +205,7 @@ func _set_labels() -> void:
|
||||
|
||||
|
||||
func _set_labels_text() -> void:
|
||||
if props.physical_keycode == KEY_UNKNOWN:
|
||||
if props.physical_keycode == KEY_SPECIAL:
|
||||
return
|
||||
|
||||
if not props.is_char():
|
||||
|
||||
@ -42,7 +42,7 @@ var alt_shift_char: String
|
||||
|
||||
|
||||
func is_char() -> bool:
|
||||
return physical_keycode != KEY_UNKNOWN and OS.is_keycode_unicode(physical_keycode)
|
||||
return OS.is_keycode_unicode(physical_keycode)
|
||||
|
||||
|
||||
func from_dict(dict: Dictionary) -> KeyProps:
|
||||
|
||||
@ -38,11 +38,11 @@ func rows() -> Array[Array]:
|
||||
),
|
||||
[
|
||||
{KeyProps.KEY: KEY_CTRL, KeyProps.W: 1.5, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_UNKNOWN, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_SPECIAL, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_ALT, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_SPACE, KeyProps.W: 6},
|
||||
{
|
||||
KeyProps.KEY: KEY_UNKNOWN,
|
||||
KeyProps.KEY: KEY_SPECIAL,
|
||||
KeyProps.W: 1.25,
|
||||
KeyProps.LOC: KEY_LOCATION_RIGHT
|
||||
},
|
||||
|
||||
@ -53,10 +53,10 @@ func rows() -> Array[Array]:
|
||||
{KeyProps.KEY: KEY_CTRL, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_META, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_ALT, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_UNKNOWN, KeyProps.W: 1.25},
|
||||
{KeyProps.KEY: KEY_SPECIAL, KeyProps.W: 1.25},
|
||||
{KeyProps.KEY: KEY_SPACE, KeyProps.W: 2.5},
|
||||
{KeyProps.KEY: KEY_UNKNOWN, KeyProps.W: 1.25},
|
||||
{KeyProps.KEY: KEY_UNKNOWN, KeyProps.W: 1.25},
|
||||
{KeyProps.KEY: KEY_SPECIAL, KeyProps.W: 1.25},
|
||||
{KeyProps.KEY: KEY_SPECIAL, KeyProps.W: 1.25},
|
||||
{KeyProps.KEY: KEY_ALT, KeyProps.W: 1.25, KeyProps.LOC: KEY_LOCATION_RIGHT},
|
||||
{
|
||||
KeyProps.KEY: KEY_META,
|
||||
|
||||
@ -25,7 +25,7 @@ const LABEL_TO_KEYCODE_MAP: Dictionary[String, Key] = {
|
||||
"PgDn": KEY_PAGEDOWN,
|
||||
"Page Down": KEY_PAGEDOWN,
|
||||
"Num Lock": KEY_NUMLOCK,
|
||||
"Fn": KEY_UNKNOWN,
|
||||
"Fn": KEY_SPECIAL,
|
||||
"↑": KEY_UP,
|
||||
"←": KEY_LEFT,
|
||||
"↓": KEY_DOWN,
|
||||
@ -225,7 +225,6 @@ func _get_keycode_from_legend(legend: Array[String], data_key: Dictionary) -> Ke
|
||||
|
||||
if keycode == KEY_NONE:
|
||||
printerr("%s: could not recognize key label %s" % [_name, str(legend)])
|
||||
return KEY_UNKNOWN
|
||||
|
||||
return keycode
|
||||
|
||||
|
||||
@ -19,13 +19,13 @@ func rows() -> Array[Array]:
|
||||
+ [{KeyProps.KEY: KEY_ENTER}]
|
||||
),
|
||||
[
|
||||
{KeyProps.KEY: KEY_UNKNOWN},
|
||||
{KeyProps.KEY: KEY_SPECIAL},
|
||||
{KeyProps.KEY: KEY_CTRL, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_ALT, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_META, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_UNKNOWN, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_SPECIAL, KeyProps.LOC: KEY_LOCATION_LEFT},
|
||||
{KeyProps.KEY: KEY_SPACE, KeyProps.W: 2},
|
||||
{KeyProps.KEY: KEY_UNKNOWN, KeyProps.LOC: KEY_LOCATION_RIGHT},
|
||||
{KeyProps.KEY: KEY_SPECIAL, KeyProps.LOC: KEY_LOCATION_RIGHT},
|
||||
{KeyProps.KEY: KEY_LEFT},
|
||||
{KeyProps.KEY: KEY_DOWN},
|
||||
{KeyProps.KEY: KEY_UP},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user