initial commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
[gd_scene format=3 uid="uid://bbdbyjievjpsq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://nxvyqddlwaf1" path="res://widgets/compass/scripts/compass_widget_node.gd" id="1_fslm7"]
|
||||
[ext_resource type="Texture2D" uid="uid://cduyjqlfqd4bh" path="res://widgets/compass/resources/compass_indicator.png" id="2_qf1yp"]
|
||||
[ext_resource type="Script" uid="uid://cr4y57bw6jfd1" path="res://MoveableControl.gd" id="3_qf1yp"]
|
||||
|
||||
[node name="Compass" type="Node2D" unique_id=2062816665]
|
||||
rotation = -6.2831855
|
||||
script = ExtResource("1_fslm7")
|
||||
|
||||
[node name="CompassIndicator" type="Sprite2D" parent="." unique_id=630014919]
|
||||
position = Vector2(0, -100)
|
||||
scale = Vector2(0.1, 0.1)
|
||||
texture = ExtResource("2_qf1yp")
|
||||
|
||||
[node name="Label" type="Label" parent="." unique_id=338110309]
|
||||
offset_left = -50.0
|
||||
offset_top = -350.0
|
||||
offset_right = 50.0
|
||||
offset_bottom = -150.0
|
||||
theme_override_font_sizes/font_size = 80
|
||||
text = "N"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
justification_flags = 161
|
||||
|
||||
[node name="MovableControl" type="Control" parent="." unique_id=124696843 node_paths=PackedStringArray("move_target")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -128.99997
|
||||
offset_top = -188.00002
|
||||
offset_right = 125.83328
|
||||
offset_bottom = 194.89629
|
||||
mouse_filter = 1
|
||||
mouse_default_cursor_shape = 13
|
||||
script = ExtResource("3_qf1yp")
|
||||
move_target = NodePath("..")
|
||||
metadata/_custom_type_script = "uid://cr4y57bw6jfd1"
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cduyjqlfqd4bh"
|
||||
path="res://.godot/imported/compass_indicator.png-8d5bbada0ecaff62865bf7bf5d36fd00.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://widgets/compass/resources/compass_indicator.png"
|
||||
dest_files=["res://.godot/imported/compass_indicator.png-8d5bbada0ecaff62865bf7bf5d36fd00.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
@@ -0,0 +1,21 @@
|
||||
extends BaseWidgetNode
|
||||
class_name CompassWidgetNode
|
||||
|
||||
|
||||
@export_range(0., 359., 0.1) var north_deg = 0.
|
||||
var north_rad: float
|
||||
var indicator: Sprite2D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
if north_deg == null:
|
||||
north_deg = 0.
|
||||
north_rad = deg_to_rad(north_deg)
|
||||
Signals.heading_updated.connect(_on_heading_updated)
|
||||
indicator = get_node("CompassIndicator")
|
||||
|
||||
func _on_heading_updated(sensor_ip: String, heading_rad: float):
|
||||
if not check_valid_sensor(sensor_ip, "MAG"):
|
||||
return
|
||||
indicator.rotation = north_rad + heading_rad
|
||||
@@ -0,0 +1 @@
|
||||
uid://nxvyqddlwaf1
|
||||
Reference in New Issue
Block a user