This commit is contained in:
2024-02-27 23:21:44 +01:00
parent ba37eca0c9
commit bfec08ff02
38 changed files with 89 additions and 92 deletions

5
client/static/Audio.gd Normal file
View File

@ -0,0 +1,5 @@
class_name Audio
static func mute(enabled: bool):
var master_sound = AudioServer.get_bus_index("Master")
AudioServer.set_bus_mute(master_sound, enabled)

4
client/static/Log.gd Normal file
View File

@ -0,0 +1,4 @@
class_name Log
static func info(message: String):
print_rich("[color=#808080][%s][/color] %s" % [Global.account.name, message])

21
client/static/Math.gd Normal file
View File

@ -0,0 +1,21 @@
class_name Math
static func damp(from: Variant, to: Variant, weight: float) -> Variant:
return lerp(from, to, 1 - exp(-weight))
static func dampf(from: float, to: float, weight: float) -> float:
return lerpf(from, to, 1 - exp(-weight))
static func damp_angle(from: float, to: float, weight: float) -> float:
return lerp_angle(from, to, 1 - exp(-weight))
static func damp_spherical(from: Vector3, to: Vector3, weight: float) -> Vector3:
return from.slerp(to, 1 - exp(-weight))
static func damp_vector(from: Vector3, to: Vector3, weight: float) -> Vector3:
return from.lerp(to, 1 - exp(-weight))
static func from_to_rotation(from: Vector3, to: Vector3) -> Quaternion:
var axis := from.cross(to).normalized()
var angle := from.angle_to(to)
return Quaternion(axis, angle)

View File

@ -0,0 +1,13 @@
class_name WindowManager
static var window_size: Vector2i
static func toggle_fullscreen(window: Window):
match window.mode:
Window.MODE_FULLSCREEN:
window.mode = Window.MODE_WINDOWED
window.size = window_size
window.move_to_center()
Window.MODE_WINDOWED:
window_size = window.size
window.mode = Window.MODE_FULLSCREEN