add pictograms and change ui

This commit is contained in:
2024-10-07 01:06:23 +10:00
parent 9e98556f8c
commit 76ccd210ec
14 changed files with 213 additions and 115 deletions

View File

@@ -1,16 +1,15 @@
extends Control
class_name FollowingUi
extends CloseableUI
class_name FollowingUI
const EDGE_MARGIN = 10
var target: Node3D
var is_mouse_over: bool = false
@onready var camera: Camera3D = get_viewport().get_camera_3d()
func _ready() -> void:
assert(camera != null, "camera missing!")
visible = false
super._ready()
func _process(_delta: float) -> void:
@@ -27,33 +26,11 @@ func _process(_delta: float) -> void:
position = (pos - pivot_offset).clamp(corner_1, corner_2)
func _input(event: InputEvent) -> void:
if not visible:
return
if event is InputEventMouseButton and not is_mouse_over:
var button_event := event as InputEventMouseButton
if not button_event.pressed:
return
if (
button_event.button_index == MOUSE_BUTTON_RIGHT
or button_event.button_index == MOUSE_BUTTON_LEFT
):
close()
if event is InputEventMouseMotion:
var motion_event := event as InputEventMouseMotion
is_mouse_over = (
Rect2(global_position, size)
.has_point(motion_event.position)
)
func set_target(to: Node3D) -> void:
visible = true
target = to
func close() -> void:
visible = false
super.close()
target = null