#42 ajout d'un inspecteur
This commit is contained in:
1
gui/pointer/assets/cursors/pointer.svg
Normal file
1
gui/pointer/assets/cursors/pointer.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#ffffff" class="icon icon-tabler icons-tabler-filled icon-tabler-pointer"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3.039 4.277l3.904 13.563c.185 .837 .92 1.516 1.831 1.642l.17 .016a2.2 2.2 0 0 0 1.982 -1.006l.045 -.078l1.4 -2.072l4.05 4.05a2.067 2.067 0 0 0 2.924 0l1.047 -1.047c.388 -.388 .606 -.913 .606 -1.461l-.008 -.182a2.067 2.067 0 0 0 -.598 -1.28l-4.047 -4.048l2.103 -1.412c.726 -.385 1.18 -1.278 1.053 -2.189a2.2 2.2 0 0 0 -1.701 -1.845l-13.524 -3.89a1 1 0 0 0 -1.236 1.24z" /></svg>
|
||||
|
After Width: | Height: | Size: 607 B |
37
gui/pointer/assets/cursors/pointer.svg.import
Normal file
37
gui/pointer/assets/cursors/pointer.svg.import
Normal file
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bspffyprdywgc"
|
||||
path="res://.godot/imported/pointer.svg-7e9852b8fc87e59d7ede00033ef3f170.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/pointer/assets/cursors/pointer.svg"
|
||||
dest_files=["res://.godot/imported/pointer.svg-7e9852b8fc87e59d7ede00033ef3f170.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
30
gui/pointer/pointer.tscn
Normal file
30
gui/pointer/pointer.tscn
Normal file
@@ -0,0 +1,30 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://0yr6b2jtuttm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://vhumsfntpqcl" path="res://gui/pointer/scripts/pointer.gd" id="1_1pe2k"]
|
||||
[ext_resource type="Texture2D" uid="uid://bspffyprdywgc" path="res://gui/pointer/assets/cursors/pointer.svg" id="2_q4bvb"]
|
||||
|
||||
[node name="Pointer" type="Node"]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_1pe2k")
|
||||
default_cursor = ExtResource("2_q4bvb")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
layer = 128
|
||||
|
||||
[node name="Inspector" type="Control" parent="CanvasLayer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="InspectorText" type="Label" parent="CanvasLayer/Inspector"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 1
|
||||
offset_left = 26.0
|
||||
offset_right = 66.0
|
||||
offset_bottom = 23.0
|
||||
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
|
||||
|
||||
1
gui/pointer/scripts/pointer.gd.uid
Normal file
1
gui/pointer/scripts/pointer.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://vhumsfntpqcl
|
||||
Reference in New Issue
Block a user