#42 ajout d'un inspecteur
This commit is contained in:
26
gui/pointer/scripts/pointer.gd
Normal file
26
gui/pointer/scripts/pointer.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Node
|
||||
|
||||
@export var default_cursor : Texture2D
|
||||
|
||||
var inspected_entity : InspectableEntity = null
|
||||
|
||||
func _ready():
|
||||
Input.set_custom_mouse_cursor(default_cursor)
|
||||
|
||||
func _process(_delta):
|
||||
%Inspector.position = get_viewport().get_mouse_position()
|
||||
|
||||
func inspect_entity(entity : InspectableEntity):
|
||||
if inspected_entity and inspected_entity != entity:
|
||||
inspected_entity.inspected = false
|
||||
%InspectorText.text = entity.inspected_text()
|
||||
%InspectorText.visible = true
|
||||
inspected_entity = entity
|
||||
inspected_entity.inspected = true
|
||||
|
||||
func stop_inspect_entity(entity : InspectableEntity):
|
||||
entity.inspected = false
|
||||
if inspected_entity == entity:
|
||||
%InspectorText.visible = false
|
||||
inspected_entity = null
|
||||
|
||||
Reference in New Issue
Block a user