move sort func to key helper
This commit is contained in:
parent
532505c812
commit
e9a6d5ed5c
@ -84,14 +84,6 @@ static func instantiate_with_props(
|
|||||||
return node
|
return node
|
||||||
|
|
||||||
|
|
||||||
static func sort_func(a: GameKey, b: GameKey) -> bool:
|
|
||||||
var a_pos := a.get_default_transform().origin
|
|
||||||
var b_pos := b.get_default_transform().origin
|
|
||||||
if a_pos.y == b_pos.y:
|
|
||||||
return a_pos.x < b_pos.x
|
|
||||||
return a_pos.y < b_pos.y
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -151,7 +151,7 @@ func request_keys(filter_func: Callable, limit: int = 0) -> Array[GameKey]:
|
|||||||
_requested_keys = []
|
_requested_keys = []
|
||||||
_requested_keys_limit = 0
|
_requested_keys_limit = 0
|
||||||
|
|
||||||
requested_keys.sort_custom(GameKey.sort_func)
|
requested_keys.sort_custom(KeyHelper.sort_func)
|
||||||
return requested_keys
|
return requested_keys
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,6 @@ func swap_layout(layout_name: String) -> void:
|
|||||||
func _set_defaults() -> void:
|
func _set_defaults() -> void:
|
||||||
print("\nsetting defaults")
|
print("\nsetting defaults")
|
||||||
_set_layout(layouts.values()[0] as AbstractLayout)
|
_set_layout(layouts.values()[0] as AbstractLayout)
|
||||||
# _set_layout(layouts[LayoutANSI.name_static()])
|
|
||||||
|
|
||||||
|
|
||||||
func _set_layout(layout: AbstractLayout) -> void:
|
func _set_layout(layout: AbstractLayout) -> void:
|
||||||
|
|||||||
@ -51,6 +51,14 @@ const ADJACENCY_MAP: Dictionary[Key, Array] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static func sort_func(a: GameKey, b: GameKey) -> bool:
|
||||||
|
var a_pos := a.get_default_transform().origin
|
||||||
|
var b_pos := b.get_default_transform().origin
|
||||||
|
if a_pos.y == b_pos.y:
|
||||||
|
return a_pos.x < b_pos.x
|
||||||
|
return a_pos.y < b_pos.y
|
||||||
|
|
||||||
|
|
||||||
static func get_rotated_key_pos(
|
static func get_rotated_key_pos(
|
||||||
key_pos: Vector3, pivot: Vector2, angle: float
|
key_pos: Vector3, pivot: Vector2, angle: float
|
||||||
) -> Vector3:
|
) -> Vector3:
|
||||||
|
|||||||
@ -54,7 +54,7 @@ func is_unicode() -> bool:
|
|||||||
return OS.is_keycode_unicode(physical_keycode)
|
return OS.is_keycode_unicode(physical_keycode)
|
||||||
|
|
||||||
|
|
||||||
func is_viable_player_pos_key() -> bool:
|
func is_player_pos_key() -> bool:
|
||||||
return KeyHelper.ADJACENCY_MAP.has(physical_keycode)
|
return KeyHelper.ADJACENCY_MAP.has(physical_keycode)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user