Show ship name/role/description alongside its art on the select screen
The ship-select rows only ever rendered a bare texture with no text, which made comparing ships blind. Rework each row into an HBox: a fixed-size image box on the left (auto-fits any ship's aspect ratio) and a name + role header with the full flavor description wrapped underneath on the right. Bump row height/tighten the row gap so all 5 rows plus the description text still fit on the 1280x800 screen. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -109,9 +109,10 @@ const RACES := [
|
|||||||
# Row layout constants (screen is 1280×800)
|
# Row layout constants (screen is 1280×800)
|
||||||
const ROW_X1 := 120.0
|
const ROW_X1 := 120.0
|
||||||
const ROW_X2 := 1160.0
|
const ROW_X2 := 1160.0
|
||||||
const ROW_H := 100.0
|
const ROW_H := 115.0
|
||||||
const ROW_GAP := 8.0
|
const ROW_GAP := 6.0
|
||||||
const ROW_START := 195.0
|
const ROW_START := 175.0
|
||||||
|
const ROW_IMG := 95.0
|
||||||
|
|
||||||
var _root: Control
|
var _root: Control
|
||||||
var _content: Control
|
var _content: Control
|
||||||
@@ -188,9 +189,9 @@ func _show_ship_selection() -> void:
|
|||||||
var c := _swap_content()
|
var c := _swap_content()
|
||||||
|
|
||||||
_label(c, "SELECT YOUR SHIP", 30, Color(0.42, 0.87, 1.0),
|
_label(c, "SELECT YOUR SHIP", 30, Color(0.42, 0.87, 1.0),
|
||||||
0, 90, 1280, 145, HORIZONTAL_ALIGNMENT_CENTER)
|
0, 85, 1280, 130, HORIZONTAL_ALIGNMENT_CENTER)
|
||||||
_label(c, "Playing as — " + _chosen_race.name, 14, _chosen_race.color,
|
_label(c, "Playing as — " + _chosen_race.name, 14, _chosen_race.color,
|
||||||
0, 155, 1280, 185, HORIZONTAL_ALIGNMENT_CENTER)
|
0, 135, 1280, 165, HORIZONTAL_ALIGNMENT_CENTER)
|
||||||
|
|
||||||
var ships: Array = _chosen_race.ships
|
var ships: Array = _chosen_race.ships
|
||||||
for i in ships.size():
|
for i in ships.size():
|
||||||
@@ -269,6 +270,7 @@ func _make_race_btn(race: Dictionary) -> Button:
|
|||||||
func _make_ship_row(ship: Dictionary, accent: Color) -> Button:
|
func _make_ship_row(ship: Dictionary, accent: Color) -> Button:
|
||||||
var btn := Button.new()
|
var btn := Button.new()
|
||||||
btn.text = ""
|
btn.text = ""
|
||||||
|
btn.clip_contents = true
|
||||||
|
|
||||||
var sn := _flat(Color(0.06, 0.09, 0.17, 0.95), 8)
|
var sn := _flat(Color(0.06, 0.09, 0.17, 0.95), 8)
|
||||||
sn.set_border_width_all(1)
|
sn.set_border_width_all(1)
|
||||||
@@ -280,14 +282,62 @@ func _make_ship_row(ship: Dictionary, accent: Color) -> Button:
|
|||||||
btn.add_theme_stylebox_override("hover", sh)
|
btn.add_theme_stylebox_override("hover", sh)
|
||||||
btn.add_theme_stylebox_override("pressed", sh)
|
btn.add_theme_stylebox_override("pressed", sh)
|
||||||
|
|
||||||
|
var hb := HBoxContainer.new()
|
||||||
|
hb.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
|
hb.offset_left = 10; hb.offset_top = 8; hb.offset_right = -16; hb.offset_bottom = -8
|
||||||
|
hb.add_theme_constant_override("separation", 16)
|
||||||
|
hb.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
btn.add_child(hb)
|
||||||
|
|
||||||
|
var img_box := Control.new()
|
||||||
|
img_box.custom_minimum_size = Vector2(ROW_IMG, ROW_IMG)
|
||||||
|
img_box.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
||||||
|
img_box.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
hb.add_child(img_box)
|
||||||
|
|
||||||
var tex := TextureRect.new()
|
var tex := TextureRect.new()
|
||||||
tex.texture = load(ship.path)
|
tex.texture = load(ship.path)
|
||||||
tex.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
tex.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||||
tex.offset_left = 8; tex.offset_top = 6; tex.offset_right = -8; tex.offset_bottom = -6
|
|
||||||
tex.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
tex.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||||
tex.expand_mode = TextureRect.EXPAND_FIT_HEIGHT_PROPORTIONAL
|
|
||||||
tex.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
tex.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
btn.add_child(tex)
|
img_box.add_child(tex)
|
||||||
|
|
||||||
|
var vb := VBoxContainer.new()
|
||||||
|
vb.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||||
|
vb.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||||
|
vb.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||||
|
vb.add_theme_constant_override("separation", 3)
|
||||||
|
vb.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
hb.add_child(vb)
|
||||||
|
|
||||||
|
var header := HBoxContainer.new()
|
||||||
|
header.add_theme_constant_override("separation", 10)
|
||||||
|
header.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
vb.add_child(header)
|
||||||
|
|
||||||
|
var name_lbl := Label.new()
|
||||||
|
name_lbl.text = ship.name
|
||||||
|
name_lbl.add_theme_font_size_override("font_size", 18)
|
||||||
|
name_lbl.add_theme_color_override("font_color", Color(0.92, 0.95, 1.0))
|
||||||
|
name_lbl.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
header.add_child(name_lbl)
|
||||||
|
|
||||||
|
var role_lbl := Label.new()
|
||||||
|
role_lbl.text = ship.role.to_upper()
|
||||||
|
role_lbl.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||||
|
role_lbl.add_theme_font_size_override("font_size", 13)
|
||||||
|
role_lbl.add_theme_color_override("font_color", accent)
|
||||||
|
role_lbl.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
header.add_child(role_lbl)
|
||||||
|
|
||||||
|
var desc_lbl := Label.new()
|
||||||
|
desc_lbl.text = ship.desc
|
||||||
|
desc_lbl.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||||
|
desc_lbl.clip_text = true
|
||||||
|
desc_lbl.add_theme_font_size_override("font_size", 12)
|
||||||
|
desc_lbl.add_theme_color_override("font_color", Color(0.62, 0.70, 0.80))
|
||||||
|
desc_lbl.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
vb.add_child(desc_lbl)
|
||||||
|
|
||||||
return btn
|
return btn
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user