30 lines
1.2 KiB
GDScript
30 lines
1.2 KiB
GDScript
extends Control
|
|
|
|
const CATALOG := preload("res://scripts/game/ship_catalog.gd")
|
|
const SILHOUETTE_SHADER := preload("res://resources/ui/ship_silhouette.gdshader")
|
|
var _portrait: TextureRect
|
|
|
|
func _ready() -> void:
|
|
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
_portrait = TextureRect.new()
|
|
_portrait.texture = load(CATALOG.texture_path(CATALOG.for_path(GameState.selected_ship_path))) as Texture2D
|
|
_portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
_portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
|
_portrait.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
var material := ShaderMaterial.new()
|
|
material.shader = SILHOUETTE_SHADER
|
|
_portrait.material = material
|
|
add_child(_portrait)
|
|
_portrait.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
_portrait.offset_left = 26
|
|
_portrait.offset_right = -26
|
|
_portrait.offset_top = 12
|
|
_portrait.offset_bottom = -12
|
|
_portrait.modulate = Color(0.78, 0.86, 0.92, 0.56)
|
|
|
|
func _draw() -> void:
|
|
var center := size * Vector2(0.5, 0.52)
|
|
draw_circle(center, 105, Color(0.07, 0.12, 0.17, 0.45))
|
|
draw_arc(center, 106, 0, TAU, 80, Color(0.33, 0.43, 0.48, 0.28), 1, true)
|
|
draw_line(Vector2(center.x, 12), Vector2(center.x, size.y - 12), Color(0.33, 0.43, 0.48, 0.18), 1, true)
|