PopochiuUtils

Extends: Node

Description

Method Descriptions

get_screen_coords_for (static)

func get_screen_coords_for(node: Node, offset: Vector2 = "(0, 0)") -> Vector2

Used by the GUI to get the position of [param node] in the scene transformed to the space of the [CanvasLayer] where it is is rendered.

get_random_array_idx (static)

func get_random_array_idx(array: Array) -> int

Gets a random index from [param array].

sort_by_file_name (static)

func sort_by_file_name(a: String, b: String) -> bool

Compares the name of files [param a] and [param b] to check which one comes first in alphabetical order.

override_font (static)

func override_font(node: Control, font_name: String, font: Font) -> void

Overrides the font [param font_name] in [param node] by [param font].

func print_error(msg: String) -> void

Prints [param msg] with Popochiu's error style.

func print_warning(msg: String) -> void

Prints [param msg] with Popochiu's warning style.

func print_normal(msg: String) -> void

Prints [param msg] with Popochiu's normal style.

is_click_or_touch (static)

func is_click_or_touch(event: InputEvent) -> bool

Checks if [param event] is an [InputEventMouseButton] or [InputEventScreenTouch] event.

is_double_click_or_double_tap (static)

func is_double_click_or_double_tap(event: InputEvent) -> bool

Checks if [param event] is an [InputEventMouseButton] with [member InputEventMouseButton.double_click] as [code]true[/code], or an [InputEventScreenTouch] with [member InputEventScreenTouch.double_tap]. as [code]true[/code].

is_click_or_touch_pressed (static)

func is_click_or_touch_pressed(event: InputEvent) -> bool

Checks if [param event] is an [InputEventMouseButton] or [InputEventScreenTouch] event and if it is pressed.

get_click_or_touch_index (static)

func get_click_or_touch_index(event: InputEvent) -> int

Returns the index of [param event] when it is an [InputEventMouseButton] or [InputEventScreenTouch] event. For a click, [member InputEventMouseButton.button_index] is returned. For a touch, [member InputEventScreenTouch.index] is returned. Returns [code]0[/code] if the event isn't pressed or is not neither a click or a touch.

any_exhaustive (static)

func any_exhaustive(array: Array, callback: Callable) -> bool

For each element in [param array] calls [param callback] passing the element as a parameter. If any of the calls returns [code]true[/code], then this function returns [code]true[/code], otherwise [code]false[/code] is returned.[br][br] This is an alternate version for [method Array.any] that doesn't stops execution even when one of the results is [code]true[/code].