extends Node

static func get_input_direction(event=Input):
	return Vector2(
		float(event.is_action_pressed("move_right")) - float(event.is_action_pressed("move_left")),
		float(event.is_action_pressed("move_down")) - float(event.is_action_pressed("move_up"))
	).normalized()
	

func is_mouse_over_element(element:Control):
	if element == null:
		return false
	var mouse_pos = get_viewport().get_mouse_position()
	var corner_1 = element.rect_global_position
	var corner_2 = corner_1 + element.rect_size
	
	if mouse_pos.x > corner_1.x && mouse_pos.y > corner_1.y && element.visible:
		if mouse_pos.x < corner_2.x && mouse_pos.y < corner_2.y:
			return true

	return false

