gdbasics/scripts/libs/debug.gd
2021-08-21 17:13:19 +02:00

30 lines
680 B
GDScript

###
### debugging tools
### mostly validity checks
###
extends Object
class_name GDBDebug
################
# public stuff #
################
func _init() -> void:
assert(0, "This class should not be instantiated.")
static func assert_valid_num(v):
assert(!is_nan(v) && !is_inf(v))
static func assert_valid_vec2(v : Vector2):
assert(!is_nan(v.x) && !is_inf(v.x))
assert(!is_nan(v.y) && !is_inf(v.y))
static func assert_valid_vec3(v : Vector3):
assert(!is_nan(v.x) && !is_inf(v.x))
assert(!is_nan(v.y) && !is_inf(v.y))
assert(!is_nan(v.z) && !is_inf(v.z))
static func deprecated(note : String) -> void:
printerr("Usage of deprecated function: " + note)
print_stack()