Skip to content

Commit

Permalink
Include all required copyright/license info
Browse files Browse the repository at this point in the history
This information is accessible through the revised credits screen.
  • Loading branch information
doctor-g committed Apr 19, 2024
1 parent 6713947 commit a0b7ec1
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 16 deletions.
2 changes: 1 addition & 1 deletion project/ui/credits/credits_panel.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extends PanelContainer
extends Control

signal dismissed

Expand Down
50 changes: 37 additions & 13 deletions project/ui/credits/credits_panel.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
[gd_scene load_steps=7 format=3 uid="uid://ebrhp55oc1to"]
[gd_scene load_steps=8 format=3 uid="uid://ebrhp55oc1to"]

[ext_resource type="Script" path="res://ui/credits/credits_panel.gd" id="1_6qchm"]
[ext_resource type="StyleBox" uid="uid://cmums7em450n" path="res://ui/overlay_panel_style.tres" id="1_eppal"]
[ext_resource type="PackedScene" uid="uid://b8q1tdpaxtldy" path="res://ui/audible_button.tscn" id="1_ftdhd"]
[ext_resource type="PackedScene" uid="uid://ccc5cu6saadq3" path="res://ui/credits/open_source_license_control.tscn" id="3_4r0ho"]
[ext_resource type="FontFile" uid="uid://dwaxej03kcxd5" path="res://ui/credits/OpenSans.ttf" id="3_llkcx"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wiptq"]
bg_color = Color(0.454524, 0.454524, 0.454524, 1)
border_width_left = 10
border_width_top = 10
border_width_right = 10
border_width_bottom = 10
border_color = Color(0.18359, 0.18359, 0.18359, 1)
corner_radius_top_left = 10
corner_radius_top_right = 10
corner_radius_bottom_right = 10
corner_radius_bottom_left = 10

[sub_resource type="Theme" id="Theme_2hkwo"]
default_font = ExtResource("3_llkcx")
default_font_size = 24
Expand All @@ -21,20 +33,27 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = SubResource("Theme_2hkwo")
theme_override_styles/panel = ExtResource("1_eppal")
theme_override_styles/panel = SubResource("StyleBoxFlat_wiptq")
script = ExtResource("1_6qchm")

[node name="VBoxContainer" type="VBoxContainer" parent="."]
[node name="VBox" type="VBoxContainer" parent="."]
layout_mode = 2
theme_override_constants/separation = 20
alignment = 1
theme = SubResource("Theme_2hkwo")

[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
[node name="TabContainer" type="TabContainer" parent="VBox"]
layout_mode = 2
size_flags_vertical = 3
tab_alignment = 1

[node name="RichTextLabel" type="RichTextLabel" parent="VBoxContainer/ScrollContainer"]
[node name="Game Credits" type="MarginContainer" parent="VBox/TabContainer"]
layout_mode = 2
theme_override_constants/margin_top = 15

[node name="ScrollContainer" type="ScrollContainer" parent="VBox/TabContainer/Game Credits"]
layout_mode = 2
size_flags_vertical = 3

[node name="RichTextLabel" type="RichTextLabel" parent="VBox/TabContainer/Game Credits/ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
Expand Down Expand Up @@ -118,15 +137,20 @@ License: OFL-1.1
[/center]"
fit_content = true

[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
[node name="Engine Legal Info" parent="VBox/TabContainer" instance=ExtResource("3_4r0ho")]
visible = false
layout_mode = 2
size_flags_vertical = 3

[node name="MarginContainer" type="MarginContainer" parent="VBox"]
layout_mode = 2
theme_override_constants/margin_bottom = 12

[node name="Button" parent="VBoxContainer/MarginContainer" instance=ExtResource("1_ftdhd")]
[node name="Button" parent="VBox/MarginContainer" instance=ExtResource("1_ftdhd")]
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_horizontal = 4
text = "OK"

[connection signal="meta_clicked" from="VBoxContainer/ScrollContainer/RichTextLabel" to="." method="_on_rich_text_label_meta_clicked"]
[connection signal="pressed" from="VBoxContainer/MarginContainer/Button" to="." method="_on_button_pressed"]
[connection signal="meta_clicked" from="VBox/TabContainer/Game Credits/ScrollContainer/RichTextLabel" to="." method="_on_rich_text_label_meta_clicked"]
[connection signal="pressed" from="VBox/MarginContainer/Button" to="." method="_on_button_pressed"]
39 changes: 39 additions & 0 deletions project/ui/credits/open_source_license_control.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
extends Control

const _LABEL_TEXT_META_KEY := "label_text"

@onready var _tree : Tree = %Tree

func _ready() -> void:
var root := _tree.create_item()

var components_item := _tree.create_item(root)
components_item.set_text(0, "Components")
for component in Engine.get_copyright_info():
var entry := _tree.create_item(components_item)
entry.set_text(0, component.name)
var text := ""
for part in component.parts:
for copyright in part.copyright:
text += "Copyright %s\n" % copyright
text += "License: " + part.license
entry.set_meta(_LABEL_TEXT_META_KEY, text)

var licenses_item := _tree.create_item(root)
licenses_item.set_text(0, "Licenses")
for license in Engine.get_license_info():
var entry := _tree.create_item(licenses_item)
entry.set_text(0, license)
entry.set_meta(_LABEL_TEXT_META_KEY, Engine.get_license_info()[license])

# Selecting the first item ensures that we don't have a big empty box
# at the start.
components_item.get_next_in_tree().select(0)


func _on_tree_item_selected() -> void:
var selected := _tree.get_selected()
if selected.has_meta(_LABEL_TEXT_META_KEY):
%InfoLabel.text = selected.get_meta(_LABEL_TEXT_META_KEY)
else:
%InfoLabel.text = ""
33 changes: 33 additions & 0 deletions project/ui/credits/open_source_license_control.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[gd_scene load_steps=2 format=3 uid="uid://ccc5cu6saadq3"]

[ext_resource type="Script" path="res://ui/credits/open_source_license_control.gd" id="1_vxglx"]

[node name="OpenSourceLicenseControl" type="SplitContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_vxglx")

[node name="Tree" type="Tree" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
hide_root = true

[node name="ScrollContainer" type="ScrollContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 2.0
vertical_scroll_mode = 2

[node name="InfoLabel" type="Label" parent="ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
size_flags_stretch_ratio = 2.0
vertical_alignment = 1

[connection signal="item_selected" from="Tree" to="." method="_on_tree_item_selected"]
4 changes: 2 additions & 2 deletions project/ui/start_scene.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ color = Color(0, 0, 0, 0.196078)
layout_mode = 1
anchors_preset = -1
anchor_left = 0.05
anchor_top = 0.15
anchor_top = 0.05
anchor_right = 0.95
anchor_bottom = 0.85
anchor_bottom = 0.95

[connection signal="pressed" from="BlueBackground/MarginContainer/WhiteBackground/VBoxContainer/MarginContainer/MainPanel/VBoxContainer/ButtonBox/StartButton" to="." method="_on_start_button_pressed"]
[connection signal="pressed" from="BlueBackground/MarginContainer/WhiteBackground/VBoxContainer/MarginContainer/MainPanel/VBoxContainer/ButtonBox/CreditsButton" to="." method="_on_credits_button_pressed"]
Expand Down

0 comments on commit a0b7ec1

Please sign in to comment.