Misc fixes to space map

This commit is contained in:
Hamcha 2020-09-11 11:29:45 +02:00
parent 91b29162aa
commit 1ee091c395
Signed by: hamcha
GPG key ID: 41467804B19A3315
2 changed files with 38 additions and 18 deletions

View file

@ -35,14 +35,15 @@ custom_constants/separation = 10
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
margin_right = 528.0 margin_right = 528.0
margin_bottom = 18.0 margin_bottom = 24.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"] [node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"]
margin_top = 3.0
margin_right = 104.0 margin_right = 104.0
margin_bottom = 18.0 margin_bottom = 21.0
text = "S01\\AR SYSTEM" text = "S01\\AR SYSTEM"
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
@ -51,7 +52,7 @@ __meta__ = {
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer"]
margin_left = 108.0 margin_left = 108.0
margin_right = 528.0 margin_right = 528.0
margin_bottom = 18.0 margin_bottom = 24.0
size_flags_horizontal = 3 size_flags_horizontal = 3
alignment = 2 alignment = 2
__meta__ = { __meta__ = {
@ -59,9 +60,10 @@ __meta__ = {
} }
[node name="Label2" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/HBoxContainer"] [node name="Label2" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/HBoxContainer"]
margin_left = 330.0 margin_left = 210.0
margin_right = 368.0 margin_top = 3.0
margin_bottom = 18.0 margin_right = 248.0
margin_bottom = 21.0
text = "SPD: " text = "SPD: "
align = 2 align = 2
__meta__ = { __meta__ = {
@ -69,9 +71,10 @@ __meta__ = {
} }
[node name="CurrentSpeed" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/HBoxContainer"] [node name="CurrentSpeed" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/HBoxContainer"]
margin_left = 372.0 margin_left = 252.0
margin_right = 372.0 margin_top = 3.0
margin_bottom = 18.0 margin_right = 252.0
margin_bottom = 21.0
custom_colors/font_color = Color( 0.494118, 0.52549, 0.737255, 1 ) custom_colors/font_color = Color( 0.494118, 0.52549, 0.737255, 1 )
align = 2 align = 2
__meta__ = { __meta__ = {
@ -79,9 +82,10 @@ __meta__ = {
} }
[node name="Label3" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/HBoxContainer"] [node name="Label3" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/HBoxContainer"]
margin_left = 376.0 margin_left = 256.0
margin_right = 416.0 margin_top = 3.0
margin_bottom = 18.0 margin_right = 296.0
margin_bottom = 21.0
text = "ANGL:" text = "ANGL:"
align = 2 align = 2
__meta__ = { __meta__ = {
@ -89,17 +93,27 @@ __meta__ = {
} }
[node name="CurrentAngle" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/HBoxContainer"] [node name="CurrentAngle" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/HBoxContainer"]
margin_left = 420.0 margin_left = 300.0
margin_right = 420.0 margin_top = 3.0
margin_bottom = 18.0 margin_right = 300.0
margin_bottom = 21.0
custom_colors/font_color = Color( 0.494118, 0.52549, 0.737255, 1 ) custom_colors/font_color = Color( 0.494118, 0.52549, 0.737255, 1 )
align = 2 align = 2
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Button" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer/HBoxContainer"]
margin_left = 304.0
margin_right = 420.0
margin_bottom = 24.0
text = "Set destination"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Map" type="Control" parent="MarginContainer/VBoxContainer"] [node name="Map" type="Control" parent="MarginContainer/VBoxContainer"]
margin_top = 28.0 margin_top = 34.0
margin_right = 528.0 margin_right = 528.0
margin_bottom = 446.0 margin_bottom = 446.0
rect_clip_content = true rect_clip_content = true
@ -110,3 +124,5 @@ background = ExtResource( 2 )
font = ExtResource( 3 ) font = ExtResource( 3 )
[connection signal="about_to_show" from="." to="MarginContainer/VBoxContainer/Map" method="_reset_position"] [connection signal="about_to_show" from="." to="MarginContainer/VBoxContainer/Map" method="_reset_position"]
[connection signal="popup_hide" from="." to="MarginContainer/VBoxContainer/Map" method="_on_hide"] [connection signal="popup_hide" from="." to="MarginContainer/VBoxContainer/Map" method="_on_hide"]
[connection signal="mouse_entered" from="MarginContainer/VBoxContainer/Map" to="MarginContainer/VBoxContainer/Map" method="_mouse_status" binds= [ true ]]
[connection signal="mouse_exited" from="MarginContainer/VBoxContainer/Map" to="MarginContainer/VBoxContainer/Map" method="_mouse_status" binds= [ false ]]

View file

@ -8,13 +8,14 @@ const BORDER_LENGTH = 30
const RADAR_EFFECT_DELAY = 1 const RADAR_EFFECT_DELAY = 1
const HALF_BORDER = BORDER_LENGTH/2 const HALF_BORDER = BORDER_LENGTH/2
const MIN_ZOOM = 30 const MIN_ZOOM = 40
const ZOOM_STEP = 10 const ZOOM_STEP = 10
const MAX_ZOOM = 400 const MAX_ZOOM = 400
export(Texture) var background export(Texture) var background
export(Font) var font export(Font) var font
var inside = false
var dragging = false var dragging = false
var origin = Vector2.ZERO var origin = Vector2.ZERO
var last_origin = origin var last_origin = origin
@ -111,7 +112,7 @@ func draw_target(viewport: Rect2, position: Vector2, color: Color):
draw_line(Vector2(clamped.x-HALF_BORDER, viewport.size.y), Vector2(clamped.x+HALF_BORDER, viewport.size.y), color, BORDER_WIDTH) draw_line(Vector2(clamped.x-HALF_BORDER, viewport.size.y), Vector2(clamped.x+HALF_BORDER, viewport.size.y), color, BORDER_WIDTH)
func _input(event): func _input(event):
if not visible: if not visible or not inside:
return return
if event.is_action_pressed("ui_zoomin"): if event.is_action_pressed("ui_zoomin"):
if cell_size < MAX_ZOOM: if cell_size < MAX_ZOOM:
@ -155,3 +156,6 @@ func _reset_position():
func _on_hide(): func _on_hide():
popup.visible = false popup.visible = false
func _mouse_status(entered):
inside = entered