From 5b558f9c3b1ea3c73cd8ef5c1105e155c9d32221 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sun, 5 Jan 2025 00:25:50 +0100 Subject: [PATCH] add theme, player simple attack --- minimal_theme.tres | 1549 ++++++++++++++++++++++++++ objects/brick.tscn | 40 + objects/brick_player.tscn | 13 +- objects/bullet.tscn | 2 +- objects/coin.tscn | 2 +- objects/enemy.tscn | 4 +- project.godot | 8 + scripts/components/brick_throw.gd | 39 + scripts/components/bullet.gd | 15 +- tileset/village/tileset_village.tres | 2 +- 10 files changed, 1662 insertions(+), 12 deletions(-) create mode 100644 minimal_theme.tres create mode 100644 objects/brick.tscn create mode 100644 scripts/components/brick_throw.gd diff --git a/minimal_theme.tres b/minimal_theme.tres new file mode 100644 index 0000000..b0d1a15 --- /dev/null +++ b/minimal_theme.tres @@ -0,0 +1,1549 @@ +[gd_resource type="Theme" load_steps=54 format=3 uid="uid://bcibt73qths3g"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fyay6"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.328528, 0.358011, 0.40715, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n8od0"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.259199, 0.286724, 0.3326, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2m50i"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 4.0 +bg_color = Color(0.21, 0.24, 0.29, 1) +draw_center = false +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.295323, 0.31729, 0.3539, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g8l50"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.250023, 0.28099, 0.3326, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pndtk"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.1974, 0.2256, 0.2726, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_th5jy"] +content_margin_left = 16.0 +content_margin_top = 4.0 +content_margin_right = 0.0 +content_margin_bottom = 4.0 +bg_color = Color(0.1722, 0.1968, 0.2378, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yy0bd"] +content_margin_left = 8.0 +content_margin_top = 4.8 +content_margin_right = 8.0 +content_margin_bottom = 4.8 +bg_color = Color(0.285561, 0.311188, 0.3539, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2vulq"] +content_margin_left = 8.0 +content_margin_top = 4.8 +content_margin_right = 8.0 +content_margin_bottom = 4.8 +bg_color = Color(0.319934, 0.348647, 0.3965, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_mpbwm"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 4.0 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ncj7f"] +content_margin_left = 8.0 +content_margin_top = 6.0 +content_margin_right = 8.0 +content_margin_bottom = 6.0 +bg_color = Color(0.268374, 0.292459, 0.3326, 1) +border_color = Color(0.319934, 0.348647, 0.3965, 1) +border_blend = true +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_v2c1j"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bfne4"] +content_margin_left = 8.0 +content_margin_top = 6.0 +content_margin_right = 8.0 +content_margin_bottom = 6.0 +bg_color = Color(0.319934, 0.348647, 0.3965, 1) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.354308, 0.386105, 0.4391, 1) +border_blend = true +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ffe6y"] +content_margin_left = 8.0 +content_margin_top = 6.0 +content_margin_right = 8.0 +content_margin_bottom = 6.0 +bg_color = Color(0.354308, 0.386105, 0.4391, 1) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.388682, 0.423564, 0.4817, 1) +border_blend = true +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6walj"] +content_margin_left = 8.0 +content_margin_top = 6.0 +content_margin_right = 8.0 +content_margin_bottom = 6.0 +bg_color = Color(0.275798, 0.305086, 0.3539, 1) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.319934, 0.348647, 0.3965, 1) +border_blend = true +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6gc6b"] +content_margin_left = 6.0 +content_margin_top = 2.0 +content_margin_right = 6.0 +content_margin_bottom = 2.0 +bg_color = Color(0.21, 0.24, 0.29, 1) +draw_center = false +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nvlhq"] +content_margin_left = 8.0 +content_margin_top = 4.0 +content_margin_right = 8.0 +content_margin_bottom = 4.0 +bg_color = Color(0.1911, 0.2184, 0.2639, 1) +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_o4lbp"] +content_margin_left = 8.0 +content_margin_top = 4.0 +content_margin_right = 8.0 +content_margin_bottom = 4.0 +bg_color = Color(0.17535, 0.2004, 0.24215, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_uoqhw"] +content_margin_left = 0.0 +content_margin_top = 4.8 +content_margin_right = 0.0 +content_margin_bottom = 4.8 +bg_color = Color(0.259199, 0.286724, 0.3326, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_m70y3"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 4.0 +bg_color = Color(0.319934, 0.348647, 0.3965, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5kknp"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 4.0 +bg_color = Color(0.285561, 0.311188, 0.3539, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6omkk"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.1596, 0.1824, 0.2204, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wgaex"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.1596, 0.1824, 0.2204, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8y8hw"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.21, 0.24, 0.29, 1) +draw_center = false +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(1, 1, 1, 0.07) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xfcx5"] +content_margin_left = 8.0 +content_margin_top = 6.0 +content_margin_right = 8.0 +content_margin_bottom = 6.0 +bg_color = Color(0, 0, 0, 0.3) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vofr8"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 4.0 +bg_color = Color(0.1785, 0.204, 0.2465, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +expand_margin_left = 1.0 +expand_margin_top = 1.0 +expand_margin_right = 1.0 +expand_margin_bottom = 1.0 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_84rx5"] +content_margin_left = 6.0 +content_margin_top = 4.0 +content_margin_right = 6.0 +content_margin_bottom = 4.0 +bg_color = Color(0.1785, 0.204, 0.2465, 1) +draw_center = false +border_color = Color(1, 1, 1, 0) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +expand_margin_left = 1.0 +expand_margin_top = 1.0 +expand_margin_right = 1.0 +expand_margin_bottom = 1.0 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yq7t6"] +content_margin_left = 0.0 +content_margin_top = 0.0 +content_margin_right = 0.0 +content_margin_bottom = 0.0 +bg_color = Color(0.287121, 0.328138, 0.3965, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4n35b"] +content_margin_left = 4.0 +content_margin_top = 2.0 +content_margin_right = 4.0 +content_margin_bottom = 2.0 +bg_color = Color(0.1785, 0.204, 0.2465, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0rr50"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(1, 1, 1, 0.04) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_saief"] +content_margin_left = 8.0 +content_margin_top = 8.0 +content_margin_right = 8.0 +content_margin_bottom = 8.0 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_w4yjj"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.17535, 0.2004, 0.24215, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wdwaf"] +content_margin_left = 8.0 +content_margin_top = 4.0 +content_margin_right = 8.0 +content_margin_bottom = 4.0 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vps6v"] +content_margin_left = 8.0 +content_margin_top = 3.0 +content_margin_right = 8.0 +content_margin_bottom = 3.0 +bg_color = Color(0.1344, 0.1536, 0.1856, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3fkrk"] +content_margin_left = 8.0 +content_margin_top = 3.0 +content_margin_right = 8.0 +content_margin_bottom = 3.0 +bg_color = Color(0.1596, 0.1824, 0.2204, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_unybh"] +content_margin_left = 8.0 +content_margin_top = 3.0 +content_margin_right = 8.0 +content_margin_bottom = 3.0 +bg_color = Color(0, 0, 0, 0.1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxLine" id="StyleBoxLine_ody4d"] +color = Color(0.242599, 0.268362, 0.3113, 1) +grow_begin = -6.0 +grow_end = -6.0 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bscl1"] +content_margin_left = 9.6 +content_margin_top = 9.6 +content_margin_right = 9.6 +content_margin_bottom = 9.6 +bg_color = Color(0.16568, 0.1862, 0.2204, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_52p6q"] +content_margin_left = 9.6 +content_margin_top = 9.6 +content_margin_right = 9.6 +content_margin_bottom = 9.6 +bg_color = Color(0.16568, 0.1862, 0.2204, 1) +shadow_color = Color(0, 0, 0, 0.3) +shadow_size = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5wxaw"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.13952, 0.1568, 0.1856, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +expand_margin_top = 2.0 +expand_margin_bottom = 2.0 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jerwe"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.292397, 0.323448, 0.3752, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +expand_margin_top = 2.0 +expand_margin_bottom = 2.0 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_u1plv"] +content_margin_left = 6.0 +content_margin_top = 6.0 +content_margin_right = 6.0 +content_margin_bottom = 6.0 +bg_color = Color(0.1785, 0.204, 0.2465, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_6288g"] +size = Vector2(0, 0) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yaatb"] +content_margin_left = 14.0 +content_margin_top = 8.0 +content_margin_right = 14.0 +content_margin_bottom = 6.0 +bg_color = Color(0.21, 0.24, 0.29, 1) +border_width_top = 2 +border_color = Color(0.44, 0.73, 0.98, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dv0ye"] +content_margin_left = 14.0 +content_margin_top = 8.0 +content_margin_right = 14.0 +content_margin_bottom = 6.0 +bg_color = Color(0.1785, 0.204, 0.2465, 1) +border_color = Color(0.44, 0.73, 0.98, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8el8h"] +content_margin_left = 14.0 +content_margin_top = 8.0 +content_margin_right = 14.0 +content_margin_bottom = 6.0 +bg_color = Color(0.21, 0.24, 0.29, 1) +border_width_top = 2 +border_color = Color(0.25, 0.384259, 0.5, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_47qw1"] +content_margin_left = 14.0 +content_margin_top = 8.0 +content_margin_right = 14.0 +content_margin_bottom = 6.0 +bg_color = Color(1, 1, 1, 0) +border_color = Color(0.44, 0.73, 0.98, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fbtpk"] +content_margin_left = 6.0 +content_margin_top = 6.0 +content_margin_right = 6.0 +content_margin_bottom = 6.0 +bg_color = Color(0.21, 0.24, 0.29, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_p7ig6"] +content_margin_left = 14.0 +content_margin_top = 8.0 +content_margin_right = 14.0 +content_margin_bottom = 6.0 +bg_color = Color(0.18795, 0.2148, 0.25955, 1) +border_width_top = 2 +border_color = Color(0.25, 0.384259, 0.5, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_c6asc"] +content_margin_left = 0.0 +content_margin_top = 0.0 +content_margin_right = 0.0 +content_margin_bottom = 0.0 +bg_color = Color(0.16568, 0.1862, 0.2204, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ovxqj"] +content_margin_left = 0.0 +content_margin_top = 0.0 +content_margin_right = 0.0 +content_margin_bottom = 0.0 +bg_color = Color(0.285561, 0.311188, 0.3539, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kmb46"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(1, 1, 1, 0.04) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_p53la"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.1344, 0.1536, 0.1856, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 + +[sub_resource type="GDScript" id="GDScript_hhmc0"] +script/source = "@tool +extends Theme + +var base_color : Color +var contrast : float +var scale : float +var dark_theme : bool + +func _init() -> void: + # Editor Settings + + var settings := EditorInterface.get_editor_settings() + + base_color = settings.get_setting('interface/theme/base_color') as Color + contrast = settings.get_setting('interface/theme/contrast') as float + scale = EditorInterface.get_editor_scale() + + var accent_color := settings.get_setting('interface/theme/accent_color') as Color + var base_spacing := settings.get_setting('interface/theme/base_spacing') as int + var extra_spacing := settings.get_setting('interface/theme/additional_spacing') as int + var corner_radius := settings.get_setting('interface/theme/corner_radius') as int + var icon_and_font_color := settings.get_setting('interface/theme/icon_and_font_color') as int + var relationship_line_opacity := settings.get_setting('interface/theme/relationship_line_opacity') as float + var draw_extra_borders := settings.get_setting('interface/theme/draw_extra_borders') as bool + + # Globals + + var base_margin = base_spacing + var increased_margin = base_spacing + extra_spacing * 0.75 + var popup_margin = base_margin * 2.4 + + dark_theme = base_color.get_luminance() < 0.5 + if icon_and_font_color != 0: # ColorMode.AUTO_COLOR + dark_theme = icon_and_font_color == 1 # ColorMode.DARK + + var mono_color = Color.WHITE if dark_theme else Color.BLACK + + var extra_border_color_1 = Color(1, 1, 1, 0.4) if dark_theme else Color(0, 0, 0, 0.4) + var extra_border_color_2 = Color(1, 1, 1, 0.2) if dark_theme else Color(0, 0, 0, 0.2) + + # Ensure minimum contrast with the light theme. The default + # contrast makes it hard to see the UI elements + if not dark_theme and contrast < 0 and contrast > -0.4: + contrast = -0.4 + + # Main stylebox that most styleboxes duplicate + var base_sb := StyleBoxFlat.new() + base_sb.bg_color = base_color + base_sb.set_content_margin_all(base_margin * scale) + base_sb.set_corner_radius_all(corner_radius * scale) + + # Non-transparent buttons will potentially blend worse with background + # than transparent ones, however this is currently only noticeable on the Close + # button of editor settings, and it probably shouldn't even exist + var button_sb := base_sb.duplicate() + button_sb.bg_color = _get_base_color(0.3, 0.8) + if draw_extra_borders: + _set_border(button_sb, extra_border_color_1, floor(scale)) + else: + _set_border(button_sb, _get_base_color(0.5, 0.7), 1, true) + _set_margin(button_sb, base_margin * 2, base_margin * 1.5, base_margin * 2, base_margin * 1.5) + + var button_hover_sb := button_sb.duplicate() + button_hover_sb.bg_color = _get_base_color(0.5, 0.7) + if draw_extra_borders: + _set_border(button_hover_sb, extra_border_color_1, floor(scale)) + else: + _set_border(button_hover_sb, _get_base_color(0.7, 0.7), 1, true) + + var button_pressed_sb := button_sb.duplicate() + button_pressed_sb.bg_color = _get_base_color(0.7, 0.7) + if draw_extra_borders: + _set_border(button_pressed_sb, extra_border_color_1, floor(scale)) + else: + _set_border(button_pressed_sb, _get_base_color(0.9, 0.7), 1, true) + + var button_disabled_sb := button_sb.duplicate() + button_disabled_sb.set_border_width_all(0) + button_disabled_sb.bg_color = _get_base_color(0.2, 0.7) + if draw_extra_borders: + _set_border(button_disabled_sb, extra_border_color_2 * Color(1, 1, 1, 0.5), floor(scale)) + + var flat_button_hover_sb := base_sb.duplicate() + _set_margin(flat_button_hover_sb, base_margin * 1.5, base_margin, base_margin * 1.5, base_margin) + flat_button_hover_sb.bg_color = _get_base_color(0.3, 0.7) + if draw_extra_borders: + _set_border(flat_button_hover_sb, extra_border_color_1, floor(scale)) + + var flat_button_pressed_sb := flat_button_hover_sb.duplicate() + flat_button_pressed_sb.bg_color = _get_base_color(0.5, 0.7) + + var empty_sb := StyleBoxEmpty.new() + var empty_margin_sb := StyleBoxEmpty.new() + empty_margin_sb.set_content_margin_all(base_margin * 2 * scale) + var empty_wide_sb := StyleBoxEmpty.new() + _set_margin(empty_wide_sb, base_margin * 1.5, base_margin, base_margin * 1.5, base_margin) + + # Animation editor + + set_color('focus_color', 'AnimationBezierTrackEdit', Color.TRANSPARENT) + set_color('h_line_color', 'AnimationBezierTrackEdit', mono_color * Color(1, 1, 1, 0.12)) + set_color('track_focus_color', 'AnimationBezierTrackEdit', mono_color * Color(1, 1, 1, 0.1)) + set_color('v_line_color', 'AnimationBezierTrackEdit', Color.TRANSPARENT) + + set_color('font_primary_color', 'AnimationTimelineEdit', mono_color * Color(1, 1, 1, 0.7)) + set_color('font_secondary_color', 'AnimationTimelineEdit', mono_color * Color(1, 1, 1, 0.4)) + set_color('h_line_color', 'AnimationTimelineEdit', Color.TRANSPARENT) + set_color('v_line_primary_color', 'AnimationTimelineEdit', mono_color * Color(1, 1, 1, 0.4)) + set_color('v_line_secondary_color', 'AnimationTimelineEdit', mono_color * Color(1, 1, 1, 0.08)) + + set_constant('text_primary_margin', 'AnimationTimelineEdit', base_margin * 0.75 * scale) + set_constant('text_secondary_margin', 'AnimationTimelineEdit', base_margin * 0.5 * scale) + set_constant('v_line_primary_margin', 'AnimationTimelineEdit', base_margin * scale) + set_constant('v_line_primary_width', 'AnimationTimelineEdit', ceil(2 * scale)) + set_constant('v_line_secondary_margin', 'AnimationTimelineEdit', base_margin * 1.5 * scale) + set_constant('v_line_secondary_width', 'AnimationTimelineEdit', ceil(scale)) + + var sb = base_sb.duplicate() + sb.bg_color = _get_base_color(0.55, 0.7) + if draw_extra_borders: + _set_border(sb, extra_border_color_1, floor(scale)) + set_stylebox('time_available', 'AnimationTimelineEdit', sb) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(0.2, 0.8) + set_stylebox('time_unavailable', 'AnimationTimelineEdit', sb) + + set_color('h_line_color', 'AnimationTrackEdit', Color.TRANSPARENT) + set_constant('h_separation', 'AnimationTrackEdit', base_margin * 1.5 * scale) + + sb = base_sb.duplicate() + sb.draw_center = false + _set_border(sb, _get_base_color(0.3, 0.6), 2) + _set_margin(sb, base_margin * 1.5, base_margin, base_margin * 1.5, base_margin) + set_stylebox('focus', 'AnimationTrackEdit', sb) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(0.2, 0.9) + set_stylebox('hover', 'AnimationTrackEdit', sb) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.2) + set_stylebox('odd', 'AnimationTrackEdit', sb) + + set_color('bg_color', 'AnimationTrackEditGroup', _get_base_color(-0.2)) + set_color('h_line_color', 'AnimationTrackEditGroup', Color.TRANSPARENT) + set_color('v_line_color', 'AnimationTrackEditGroup', Color.TRANSPARENT) + set_constant('h_separation', 'AnimationTrackEditGroup', base_margin * 2 * scale) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.6) + _set_margin(sb, base_margin * 4, base_margin, 0, base_margin) + set_stylebox('header', 'AnimationTrackEditGroup', sb) + + # Bottom panel + + # Use bigger margin for buttons in bottom panel to make them easier to press + sb = empty_sb.duplicate() + _set_margin(sb, base_margin * 2, base_margin * 1.2, base_margin * 2, base_margin * 1.2) + set_stylebox('normal', 'BottomPanelButton', empty_wide_sb) + + sb = flat_button_hover_sb.duplicate() + _set_margin(sb, base_margin * 2, base_margin * 1.2, base_margin * 2, base_margin * 1.2) + set_stylebox('hover', 'BottomPanelButton', sb) + set_stylebox('pressed', 'BottomPanelButton', sb) + + sb = flat_button_pressed_sb.duplicate() + _set_margin(sb, base_margin * 2, base_margin * 1.2, base_margin * 2, base_margin * 1.2) + set_stylebox('hover_pressed', 'BottomPanelButton', sb) + + # Button + + set_color('font_color', 'Button', mono_color * Color(1, 1, 1, 0.7)) + set_color('font_disabled_color', 'Button', mono_color * Color(1, 1, 1, 0.3)) + set_color('font_focus_color', 'Button', mono_color) + set_color('font_hover_color', 'Button', mono_color) + set_color('font_hover_pressed_color', 'Button', mono_color) + set_color('font_pressed_color', 'Button', mono_color) + set_color('icon_disabled_color', 'Button', mono_color * Color(1, 1, 1, 0.3)) + set_color('icon_normal_color', 'Button', mono_color * Color(1, 1, 1, 0.7)) + set_constant('outline_size', 'Button', 0) + set_stylebox('disabled', 'Button', button_disabled_sb) + set_stylebox('disabled_mirrored', 'Button', button_disabled_sb) + set_stylebox('focus', 'Button', empty_sb) + set_stylebox('hover', 'Button', button_hover_sb) + set_stylebox('hover_mirrored', 'Button', button_hover_sb) + set_stylebox('hover_pressed', 'Button', button_pressed_sb) + set_stylebox('hover_pressed_mirrored', 'Button', button_pressed_sb) + set_stylebox('normal', 'Button', button_sb) + set_stylebox('normal_mirrored', 'Button', button_sb) + set_stylebox('pressed', 'Button', button_pressed_sb) + set_stylebox('pressed_mirrored', 'Button', button_pressed_sb) + + # Checkbox + + set_color('font_hover_pressed_color', 'CheckBox', mono_color) + set_color('font_pressed_color', 'CheckBox', mono_color * Color(1, 1, 1, 0.7)) + + sb = base_sb.duplicate() + sb.draw_center = false + _set_margin(sb, base_margin * 1.5, base_margin * 0.5, base_margin * 1.5, base_margin * 0.5) + set_stylebox('normal', 'CheckBox', sb) + set_stylebox('normal_mirrored', 'CheckBox', sb) + + # CheckButton + + set_color('font_focus_color', 'CheckButton', mono_color * Color(1, 1, 1, 0.7)) + set_color('font_hover_pressed_color', 'CheckButton', mono_color) + set_color('font_pressed_color', 'CheckButton', mono_color * Color(1, 1, 1, 0.7)) + + # Editor + + set_color('background', 'Editor', _get_base_color(-0.6)) + set_color('box_selection_fill_color', 'Editor', mono_color * Color(1, 1, 1, 0.12)) + set_color('box_selection_stroke_color', 'Editor', mono_color * Color(1, 1, 1, 0.4)) + # Ruler in 2D view: + set_color('dark_color_2', 'Editor', Color(0, 0, 0, 0.3) if dark_theme else Color(1, 1, 1, 0.3)) + + set_color('forward_plus_color', 'Editor', Color(0.54902, 0.752941, 0.392157)) + set_color('gl_compatibility_color', 'Editor', Color(0.447059, 0.698039, 0.890196)) + set_color('mobile_color', 'Editor', Color(0.862745, 0.482353, 0.584314)) + set_color('property_color_w', 'Editor', mono_color * Color(1, 1, 1, 0.8)) + set_color('property_color_x', 'Editor', Color('#E16277') if dark_theme else Color('#670A18')) + set_color('property_color_y', 'Editor', Color('#C3EF65') if dark_theme else Color('#455E10')) + set_color('property_color_z', 'Editor', Color('#6AABF6') if dark_theme else Color('#143862')) + set_color('warning_color', 'Editor', Color(0.95, 0.855, 0.57) if dark_theme else Color(0.82, 0.56, 0.1)) + + set_color('prop_subsection', 'Editor', Color.TRANSPARENT) + set_constant('top_bar_separation', 'Editor', base_margin * scale) + set_constant('window_border_margin', 'Editor', base_margin * scale) + + # EditorHelpBit + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.3 if dark_theme else -0.7) + _set_margin(sb, base_margin * 2, base_margin, base_margin * 2, base_margin) + sb.set_corner_radius_all(0) + sb.corner_radius_bottom_right = corner_radius * scale + sb.corner_radius_bottom_left = corner_radius * scale + if draw_extra_borders: + _set_border(sb, extra_border_color_2, floor(scale)) + set_stylebox('normal', 'EditorHelpBitContent', sb) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.55 if dark_theme else -0.9) # Same as secondary tree + _set_margin(sb, base_margin * 2, base_margin, base_margin * 2, base_margin) + sb.set_corner_radius_all(0) + sb.corner_radius_top_right = corner_radius * scale + sb.corner_radius_top_left = corner_radius * scale + if draw_extra_borders: + _set_border(sb, extra_border_color_2, floor(scale)) + set_stylebox('normal', 'EditorHelpBitTitle', sb) + + # EditorInspector + + set_constant('v_separation', 'EditorInspector', base_margin * 0.85 * scale) + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(0.2, 0.8) + _set_margin(sb, 0, base_margin * 1.2, 0, base_margin * 1.2) + if draw_extra_borders: + _set_border(sb, extra_border_color_2, floor(scale)) + set_stylebox('bg', 'EditorInspectorCategory', sb) + set_constant('h_separation', 'EditorInspectorSection', base_margin * scale) + + # EditorLogFilterButton + + # Hover and pressed styles are swapped for toggle buttons on purpose + set_stylebox('hover', 'EditorLogFilterButton', flat_button_pressed_sb) + set_stylebox('pressed', 'EditorLogFilterButton', flat_button_hover_sb) + set_stylebox('normal', 'EditorLogFilterButton', empty_sb) + + + # EditorProperty + + set_color('property_color', 'EditorProperty', mono_color * Color(1, 1, 1, 0.6)) + set_color('warning_color', 'EditorProperty', Color(0.95, 0.855, 0.57, 1) if dark_theme else Color(0.82, 0.56, 0.1)) + set_stylebox('bg', 'EditorProperty', empty_sb) + set_stylebox('bg_selected', 'EditorProperty', empty_sb) + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.8) # Same as LineEdit normal + sb.set_content_margin_all(base_margin * scale) + if draw_extra_borders: + _set_border(sb, extra_border_color_2, floor(scale)) + set_stylebox('child_bg', 'EditorProperty', sb) + + # EditorSpinSlider + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.8) + sb.set_content_margin_all(base_margin * scale) + set_stylebox('label_bg', 'EditorSpinSlider', sb) + + # Viewport + + sb = base_sb.duplicate() + sb.draw_center = false + sb.set_corner_radius_all(0) + _set_border(sb, mono_color * Color(1, 1, 1, 0.07), 2, false) + set_stylebox('FocusViewport', 'EditorStyles', sb) + + sb = base_sb.duplicate() + sb.bg_color = Color(0, 0, 0, 0.3) if dark_theme else Color(1, 1, 1, 0.3) + _set_margin(sb, base_margin * 2, base_margin * 1.5, base_margin * 2, base_margin * 1.5) + set_stylebox('Information3dViewport', 'EditorStyles', sb) + + # LaunchPad + + set_color('movie_writer_icon_hover', 'EditorStyles', Color(1, 1, 1, 0.8)) + set_color('movie_writer_icon_hover_pressed', 'EditorStyles', Color(1, 1, 1, 0.8)) + set_color('movie_writer_icon_normal', 'EditorStyles', Color(1, 1, 1, 0.7)) + set_color('movie_writer_icon_pressed', 'EditorStyles', Color(1, 1, 1, 0.941176)) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.5) + _set_margin(sb, base_margin * 1.5, base_margin, base_margin * 1.5, base_margin) + sb.set_expand_margin_all(scale) + sb.set_border_width_all(0) + set_stylebox('LaunchPadMovieMode', 'EditorStyles', sb) + + sb = sb.duplicate() + sb.draw_center = false + sb.border_color = Color.TRANSPARENT + set_stylebox('LaunchPadNormal', 'EditorStyles', sb) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(0.5) + sb.set_content_margin_all(0) + set_stylebox('MovieWriterButtonPressed', 'EditorStyles', sb) + + # EditorValidationPanel + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.5) + _set_margin(sb, base_margin, base_margin * 0.5, base_margin, base_margin * 0.5) + set_stylebox('panel', 'EditorValidationPanel', sb) + + # FlatButton + + set_color('font_color', 'FlatButton', mono_color * Color(1, 1, 1, 0.7)) + set_color('font_disabled_color', 'FlatButton', mono_color * Color(1, 1, 1, 0.3)) + set_color('font_focus_color', 'FlatButton', mono_color) + set_color('font_hover_color', 'FlatButton', mono_color) + set_color('font_hover_pressed_color', 'FlatButton', mono_color) + set_color('font_pressed_color', 'FlatButton', mono_color) + set_color('icon_disabled_color', 'FlatButton', mono_color * Color(1, 1, 1, 0.3)) + set_color('icon_normal_color', 'FlatButton', mono_color * Color(1, 1, 1, 0.7)) + + set_stylebox('disabled', 'FlatButton', empty_wide_sb) + set_stylebox('disabled_mirrored', 'FlatButton', empty_wide_sb) + set_stylebox('normal', 'FlatButton', empty_wide_sb) + set_stylebox('normal_mirrored', 'FlatButton', empty_wide_sb) + set_stylebox('hover', 'FlatButton', flat_button_hover_sb) + set_stylebox('hover_mirrored', 'FlatButton', flat_button_hover_sb) + set_stylebox('hover_pressed', 'FlatButton', flat_button_pressed_sb) + set_stylebox('hover_pressed_mirrored', 'FlatButton', flat_button_pressed_sb) + set_stylebox('pressed', 'FlatButton', flat_button_pressed_sb) + set_stylebox('pressed_mirrored', 'FlatButton', flat_button_pressed_sb) + + + # FlatMenuButton + + set_color('font_color', 'FlatMenuButton', mono_color * Color(1, 1, 1, 0.7)) + set_color('font_disabled_color', 'FlatMenuButton', mono_color * Color(1, 1, 1, 0.3)) + set_color('font_focus_color', 'FlatMenuButton', mono_color) + set_color('font_hover_color', 'FlatMenuButton', mono_color) + set_color('font_hover_pressed_color', 'FlatMenuButton', mono_color) + set_color('font_pressed_color', 'FlatMenuButton', mono_color) + set_color('icon_disabled_color', 'FlatMenuButton', mono_color * Color(1, 1, 1, 0.3)) + set_color('icon_normal_color', 'FlatMenuButton', mono_color * Color(1, 1, 1, 0.7)) + + set_stylebox('disabled', 'FlatMenuButton', empty_wide_sb) + set_stylebox('disabled_mirrored', 'FlatMenuButton', empty_wide_sb) + set_stylebox('focus', 'FlatMenuButton', empty_wide_sb) + set_stylebox('normal', 'FlatMenuButton', empty_wide_sb) + set_stylebox('normal_mirrored', 'FlatMenuButton', empty_wide_sb) + set_stylebox('hover', 'FlatMenuButton', flat_button_hover_sb) + set_stylebox('hover_mirrored', 'FlatMenuButton', flat_button_hover_sb) + set_stylebox('hover_pressed', 'FlatMenuButton', flat_button_pressed_sb) + set_stylebox('hover_pressed_mirrored', 'FlatMenuButton', flat_button_pressed_sb) + set_stylebox('pressed', 'FlatMenuButton', flat_button_pressed_sb) + set_stylebox('pressed_mirrored', 'FlatMenuButton', flat_button_pressed_sb) + + # GraphStateMachine + + set_color('focus_color', 'GraphStateMachine', Color.TRANSPARENT) + + # Box Containers + + set_constant('separation', 'HBoxContainer', 2 * scale) + set_constant('separation', 'VBoxContainer', 2 * scale) + + # Split Containers + + set_constant('autohide', 'HSplitContainer', 1) + set_constant('minimum_grab_thickness', 'HSplitContainer', base_margin * 1.5 * scale) + set_constant('separation', 'HSplitContainer', ceil(2 * scale)) + + set_constant('autohide', 'VSplitContainer', 1) + set_constant('minimum_grab_thickness', 'VSplitContainer', base_margin * 1.5 * scale) + set_constant('separation', 'VSplitContainer', ceil(2 * scale)) + + # InspectorActionButton + + set_constant('h_separation', 'InspectorActionButton', base_margin * 2 * scale) + set_stylebox('disabled', 'InspectorActionButton', button_disabled_sb) + set_stylebox('disabled_mirrored', 'InspectorActionButton', button_disabled_sb) + set_stylebox('normal', 'InspectorActionButton', button_sb) + set_stylebox('normal_mirrored', 'InspectorActionButton', button_sb) + set_stylebox('hover', 'InspectorActionButton', button_hover_sb) + set_stylebox('hover_mirrored', 'InspectorActionButton', button_hover_sb) + set_stylebox('pressed', 'InspectorActionButton', button_pressed_sb) + set_stylebox('pressed_mirrored', 'InspectorActionButton', button_pressed_sb) + + # ItemList + + set_color('guide_color', 'ItemList', Color.TRANSPARENT) + set_constant('v_separation', 'ItemList', base_margin * 1.5 * scale) + + sb = base_sb.duplicate() + sb.bg_color = mono_color * Color(1, 1, 1, 0.04) + set_stylebox('cursor', 'ItemList', sb) + set_stylebox('cursor_unfocused', 'ItemList', sb) + set_stylebox('focus', 'ItemList', empty_sb) + + set_stylebox('hovered', 'ItemList', flat_button_hover_sb) + set_stylebox('selected', 'ItemList', flat_button_hover_sb) + set_stylebox('selected_focus', 'ItemList', flat_button_hover_sb) + set_stylebox('hovered_selected', 'ItemList', flat_button_hover_sb) + set_stylebox('hovered_selected_focus', 'ItemList', flat_button_hover_sb) + + set_stylebox('panel', 'ItemList', empty_margin_sb) + + # Label + + set_color('font_color', 'Label', mono_color * Color(1, 1, 1, 0.7)) + + sb = empty_sb.duplicate() + # Keeping vertical margin low otherwise quick open looks bad + _set_margin(sb, base_margin * 2, base_margin, base_margin * 2, base_margin) + set_stylebox('normal', 'Label', sb) + + # LineEdit and TextEdit + + set_color('font_placeholder_color', 'LineEdit', mono_color * Color(1, 1, 1, 0.4)) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-1.2 if dark_theme else -2) + if draw_extra_borders: + _set_border(sb, extra_border_color_1, floor(scale)) + _set_margin(sb, base_margin * 2, base_margin * 0.75, base_margin * 2, base_margin * 0.75) + set_stylebox('focus', 'LineEdit', sb) + set_stylebox('focus', 'TextEdit', sb) + + sb = sb.duplicate() + sb.bg_color = _get_base_color(-0.8 if dark_theme else -1.6) + set_stylebox('normal', 'LineEdit', sb) + set_stylebox('normal', 'TextEdit', sb) + + # Using transparent background for readonly otherwise it looks bad in the master audio bus + sb = sb.duplicate() + sb.bg_color = Color(0, 0, 0, 0.1) if dark_theme else Color(1, 1, 1, 0.1) + set_stylebox('read_only', 'LineEdit', sb) + set_stylebox('read_only', 'TextEdit', sb) + + # MainMenuBar + + set_stylebox('normal', 'MainMenuBar', empty_wide_sb) + set_stylebox('hover', 'MainMenuBar', flat_button_hover_sb) + set_stylebox('hover_pressed', 'MainMenuBar', flat_button_pressed_sb) + set_stylebox('pressed', 'MainMenuBar', flat_button_pressed_sb) + + # MainScreenButton + + set_stylebox('normal', 'MainScreenButton', empty_wide_sb) + set_stylebox('normal_mirrored', 'MainScreenButton', empty_wide_sb) + set_stylebox('hover', 'MainScreenButton', empty_wide_sb) + set_stylebox('hover_mirrored', 'MainScreenButton', empty_wide_sb) + set_stylebox('hover_pressed', 'MainScreenButton', empty_wide_sb) + set_stylebox('hover_pressed_mirrored', 'MainScreenButton', empty_wide_sb) + set_stylebox('pressed', 'MainScreenButton', empty_wide_sb) + set_stylebox('pressed_mirrored', 'MainScreenButton', empty_wide_sb) + + # MenuButton + + set_stylebox('disabled', 'MenuButton', empty_wide_sb) + set_stylebox('disabled_mirrored', 'MenuButton', empty_wide_sb) + set_stylebox('focus', 'MenuButton', empty_wide_sb) + set_stylebox('normal', 'MenuButton', empty_wide_sb) + set_stylebox('normal_mirrored', 'MenuButton', empty_wide_sb) + set_stylebox('pressed', 'MenuButton', flat_button_pressed_sb) + set_stylebox('pressed_mirrored', 'MenuButton', flat_button_pressed_sb) + set_stylebox('hover', 'MenuButton', flat_button_hover_sb) + set_stylebox('hover_mirrored', 'MenuButton', flat_button_hover_sb) + set_stylebox('hover_pressed', 'MenuButton', flat_button_hover_sb) + set_stylebox('hover_pressed_mirrored', 'MenuButton', flat_button_hover_sb) + + # OptionButton + + set_constant('arrow_margin', 'OptionButton', base_margin * 3.5) + + set_color('font_color', 'OptionButton', mono_color * Color(1, 1, 1, 0.7)) + set_color('font_disabled_color', 'OptionButton', mono_color * Color(1, 1, 1, 0.3)) + set_color('font_focus_color', 'OptionButton', mono_color) + set_color('font_hover_color', 'OptionButton', mono_color) + set_color('font_hover_pressed_color', 'OptionButton', mono_color) + set_color('font_pressed_color', 'OptionButton', mono_color) + set_color('icon_disabled_color', 'OptionButton', mono_color * Color(1, 1, 1, 0.3)) + set_color('icon_normal_color', 'OptionButton', mono_color * Color(1, 1, 1, 0.7)) + + set_stylebox('disabled', 'OptionButton', button_disabled_sb) + set_stylebox('disabled_mirrored', 'OptionButton', button_disabled_sb) + set_stylebox('focus', 'OptionButton', empty_sb) + set_stylebox('normal', 'OptionButton', button_sb) + set_stylebox('normal_mirrored', 'OptionButton', button_sb) + set_stylebox('pressed', 'OptionButton', button_pressed_sb) + set_stylebox('pressed_mirrored', 'OptionButton', button_pressed_sb) + set_stylebox('hover', 'OptionButton', button_hover_sb) + set_stylebox('hover_mirrored', 'OptionButton', button_hover_sb) + set_stylebox('hover_pressed', 'OptionButton', button_pressed_sb) + set_stylebox('hover_pressed_mirrored', 'OptionButton', button_pressed_sb) + + # Popups + + set_constant('item_start_padding', 'PopupMenu', popup_margin * scale) + set_constant('v_separation', 'PopupMenu', base_margin * 1.75 * scale) + + set_stylebox('hover', 'PopupMenu', flat_button_hover_sb) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.8, 0.9) + sb.set_content_margin_all(popup_margin) + sb.set_corner_radius_all(0) + if draw_extra_borders: + _set_border(sb, extra_border_color_2, floor(scale)) + set_stylebox('panel', 'PopupMenu', sb) + + var line_sb := StyleBoxLine.new() + line_sb.color = _get_base_color(0.1, 0.8) + line_sb.grow_begin = base_margin * -1.5 * scale + line_sb.grow_end = base_margin * -1.5 * scale + line_sb.thickness = ceil(scale) + set_stylebox('labeled_separator_left', 'PopupMenu', line_sb) + set_stylebox('labeled_separator_right', 'PopupMenu', line_sb) + set_stylebox('separator', 'PopupMenu', line_sb) + + set_stylebox('panel', 'PanelContainer', empty_wide_sb) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.8, 0.9) + sb.shadow_color = Color(0, 0, 0, 0.3) + sb.shadow_size = base_margin * 0.75 * scale + sb.set_content_margin_all(popup_margin) + sb.set_corner_radius_all(0) + if draw_extra_borders: + _set_border(sb, extra_border_color_2, floor(scale)) + set_stylebox('panel', 'PopupPanel', sb) + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.8, 0.9) + sb.set_content_margin_all(0) + if draw_extra_borders: + _set_border(sb, extra_border_color_2, floor(scale)) + set_stylebox('panel', 'TooltipPanel', sb) + + # ProgressBar + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-1.2, 0.9) + sb.expand_margin_top = base_margin * 0.5 * scale + sb.expand_margin_bottom = base_margin * 0.5 * scale + sb.set_content_margin_all(base_margin * scale) + if draw_extra_borders: + _set_border(sb, extra_border_color_2, floor(scale)) + set_stylebox('background', 'ProgressBar', sb) + + sb = sb.duplicate() + sb.bg_color = _get_base_color(0.4, 0.8) + if draw_extra_borders: + _set_border(sb, extra_border_color_1, floor(scale)) + set_stylebox('fill', 'ProgressBar', sb) + + # RichTextLabel + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.5) + sb.set_content_margin_all(base_margin * 1.5 * scale) + set_stylebox('normal', 'RichTextLabel', sb) + + # ScrollContainer + + set_stylebox('focus', 'ScrollContainer', empty_sb) + + # SplitContainer + + set_constant('minimum_grab_thickness', 'SplitContainer', base_margin * 1.5 * scale) + set_constant('separation', 'SplitContainer', base_margin * 0.75 * scale) + + var empty_texture := PlaceholderTexture2D.new() + empty_texture.size = Vector2(0, 0) + set_icon('h_grabber', 'SplitContainer', empty_texture) + set_icon('v_grabber', 'SplitContainer', empty_texture) + + # TabContainer + + sb = base_sb.duplicate() + _set_margin(sb, base_margin * 3.5, base_margin * 2, base_margin * 3.5, base_margin * 1.5) + sb.set_corner_radius_all(0) + sb.border_width_top = 2 * scale + var col = accent_color + col.v = 0.5 + col.s = 0.5 + sb.border_color = col + set_stylebox('tab_selected', 'TabBar', sb) + set_stylebox('tab_selected', 'TabContainer', sb) + + sb = sb.duplicate() + sb.bg_color = _get_base_color(-0.35) + set_stylebox('tab_selected', 'TabContainerOdd', sb) + + sb = sb.duplicate() + sb.bg_color = base_color + sb.border_color = accent_color + set_stylebox('tab_focus', 'TabBar', sb) + set_stylebox('tab_focus', 'TabContainer', sb) + + sb = sb.duplicate() + sb.bg_color = Color.TRANSPARENT + sb.set_border_width_all(0) + set_stylebox('tab_unselected', 'TabBar', sb) + set_stylebox('tab_unselected', 'TabContainer', sb) + + sb = sb.duplicate() + sb.bg_color = _get_base_color(-0.5) + set_stylebox('tab_hovered', 'TabBar', sb) + set_stylebox('tab_hovered', 'TabContainer', sb) + + sb = base_sb.duplicate() + sb.set_content_margin_all(increased_margin * 1.5 * scale) + sb.set_corner_radius_all(0) + set_stylebox('panel', 'TabContainer', sb) + + # Tree + + set_color('drop_position_color', 'Tree', mono_color * Color(1, 1, 1, 0.4)) + set_color('font_color', 'Tree', mono_color * Color(1, 1, 1, 0.7)) + set_color('guide_color', 'Tree', Color.TRANSPARENT) + set_color('parent_hl_line_color', 'Tree', mono_color * Color(1, 1, 1, relationship_line_opacity)) + set_constant('children_hl_line_width', 'Tree', 0) + set_constant('draw_guides', 'Tree', 0) + set_constant('draw_relationship_lines', 'Tree', 1) + set_constant('inner_item_margin_left', 'Tree', base_margin * scale) + set_constant('inner_item_margin_right', 'Tree', base_margin * scale) + set_constant('parent_hl_line_width', 'Tree', ceil(scale)) + set_constant('relationship_line_width', 'Tree', 0) + set_constant('v_separation', 'Tree', ceil(scale) + ceil(extra_spacing * scale)) + + set_stylebox('panel', 'Tree', empty_margin_sb) + + # Leaving focus empty for trees and scroll containers because there's no way to + # make focus indication look not janky when only a part of a dock is highlighted + set_stylebox('focus', 'Tree', empty_sb) + + # Rounded corners look a little janky in tree titles because there's no way to + # introduce gaps between columns, however not having rounded corners looks even worse + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-1.2 if dark_theme else -1.8) + set_stylebox('title_button_hover', 'Tree', sb) + set_stylebox('title_button_normal', 'Tree', sb) + set_stylebox('title_button_pressed', 'Tree', sb) + + sb = flat_button_hover_sb.duplicate() + sb.set_content_margin_all(0) + set_stylebox('button_hover', 'Tree', sb) + set_stylebox('hover', 'Tree', sb) + set_stylebox('hovered_dimmed', 'Tree', sb) + set_stylebox('custom_button_hover', 'Tree', sb) + set_stylebox('hovered', 'Tree', sb) + set_stylebox('selected', 'Tree', sb) + set_stylebox('selected_focus', 'Tree', sb) + + set_stylebox('button_pressed', 'Tree', flat_button_pressed_sb) + set_stylebox('custom_button_pressed', 'Tree', flat_button_pressed_sb) + + # Cursor is drawn on top of the item so it needs to be transparent + sb = base_sb.duplicate() + sb.bg_color = mono_color * Color(1, 1, 1, 0.04) + set_stylebox('cursor', 'Tree', sb) + set_stylebox('cursor_unfocused', 'Tree', sb) + + # Sidebars + + sb = base_sb.duplicate() + sb.bg_color = _get_base_color(-0.55 if dark_theme else -0.9) + if draw_extra_borders: + _set_border(sb, extra_border_color_2, floor(scale)) + set_stylebox('panel', 'TreeSecondary', sb) + set_stylebox('panel', 'ItemListSecondary', sb) + +# Lighten base color in dark theme, darken in light theme, clamp +func _get_base_color(brightness_offset: float = 0, saturation_multiplier: float = 1) -> Color: + var dark = dark_theme if brightness_offset >= 0 else !dark_theme + var color = Color(base_color) + color.v = clampf(lerpf(color.v, 1 if dark else 0, abs(contrast * brightness_offset)), 0, 1) + color.s *= saturation_multiplier + return color + +# Shorthand content margin setter +func _set_margin(sb: StyleBox, left: float, top: float, right: float = left, botton: float = top) -> void: + sb.content_margin_left = left * scale + sb.content_margin_top = top * scale + sb.content_margin_right = right * scale + sb.content_margin_bottom = botton * scale + +# Shorthand border setter +func _set_border(sb: StyleBox, color: Color, width: float = 1, blend: bool = false) -> void: + sb.border_color = color + sb.border_blend = blend + sb.set_border_width_all(ceil(width * scale)) +" + +[resource] +AnimationBezierTrackEdit/colors/focus_color = Color(1, 1, 1, 0) +AnimationBezierTrackEdit/colors/h_line_color = Color(1, 1, 1, 0.12) +AnimationBezierTrackEdit/colors/track_focus_color = Color(1, 1, 1, 0.1) +AnimationBezierTrackEdit/colors/v_line_color = Color(1, 1, 1, 0) +AnimationTimelineEdit/colors/font_primary_color = Color(1, 1, 1, 0.7) +AnimationTimelineEdit/colors/font_secondary_color = Color(1, 1, 1, 0.4) +AnimationTimelineEdit/colors/h_line_color = Color(1, 1, 1, 0) +AnimationTimelineEdit/colors/v_line_primary_color = Color(1, 1, 1, 0.4) +AnimationTimelineEdit/colors/v_line_secondary_color = Color(1, 1, 1, 0.08) +AnimationTimelineEdit/constants/text_primary_margin = 3 +AnimationTimelineEdit/constants/text_secondary_margin = 2 +AnimationTimelineEdit/constants/v_line_primary_margin = 4 +AnimationTimelineEdit/constants/v_line_primary_width = 2 +AnimationTimelineEdit/constants/v_line_secondary_margin = 6 +AnimationTimelineEdit/constants/v_line_secondary_width = 1 +AnimationTimelineEdit/styles/time_available = SubResource("StyleBoxFlat_fyay6") +AnimationTimelineEdit/styles/time_unavailable = SubResource("StyleBoxFlat_n8od0") +AnimationTrackEdit/colors/h_line_color = Color(1, 1, 1, 0) +AnimationTrackEdit/constants/h_separation = 6 +AnimationTrackEdit/styles/focus = SubResource("StyleBoxFlat_2m50i") +AnimationTrackEdit/styles/hover = SubResource("StyleBoxFlat_g8l50") +AnimationTrackEdit/styles/odd = SubResource("StyleBoxFlat_pndtk") +AnimationTrackEditGroup/colors/bg_color = Color(0.1974, 0.2256, 0.2726, 1) +AnimationTrackEditGroup/colors/h_line_color = Color(1, 1, 1, 0) +AnimationTrackEditGroup/colors/v_line_color = Color(1, 1, 1, 0) +AnimationTrackEditGroup/constants/h_separation = 8 +AnimationTrackEditGroup/styles/header = SubResource("StyleBoxFlat_th5jy") +BottomPanelButton/styles/hover = SubResource("StyleBoxFlat_yy0bd") +BottomPanelButton/styles/hover_pressed = SubResource("StyleBoxFlat_2vulq") +BottomPanelButton/styles/normal = SubResource("StyleBoxEmpty_mpbwm") +BottomPanelButton/styles/pressed = SubResource("StyleBoxFlat_yy0bd") +Button/colors/font_color = Color(1, 1, 1, 0.7) +Button/colors/font_disabled_color = Color(1, 1, 1, 0.3) +Button/colors/font_focus_color = Color(1, 1, 1, 1) +Button/colors/font_hover_color = Color(1, 1, 1, 1) +Button/colors/font_hover_pressed_color = Color(1, 1, 1, 1) +Button/colors/font_pressed_color = Color(1, 1, 1, 1) +Button/colors/icon_disabled_color = Color(1, 1, 1, 0.3) +Button/colors/icon_normal_color = Color(1, 1, 1, 0.7) +Button/constants/outline_size = 0 +Button/styles/disabled = SubResource("StyleBoxFlat_ncj7f") +Button/styles/disabled_mirrored = SubResource("StyleBoxFlat_ncj7f") +Button/styles/focus = SubResource("StyleBoxEmpty_v2c1j") +Button/styles/hover = SubResource("StyleBoxFlat_bfne4") +Button/styles/hover_mirrored = SubResource("StyleBoxFlat_bfne4") +Button/styles/hover_pressed = SubResource("StyleBoxFlat_ffe6y") +Button/styles/hover_pressed_mirrored = SubResource("StyleBoxFlat_ffe6y") +Button/styles/normal = SubResource("StyleBoxFlat_6walj") +Button/styles/normal_mirrored = SubResource("StyleBoxFlat_6walj") +Button/styles/pressed = SubResource("StyleBoxFlat_ffe6y") +Button/styles/pressed_mirrored = SubResource("StyleBoxFlat_ffe6y") +CheckBox/colors/font_hover_pressed_color = Color(1, 1, 1, 1) +CheckBox/colors/font_pressed_color = Color(1, 1, 1, 0.7) +CheckBox/styles/normal = SubResource("StyleBoxFlat_6gc6b") +CheckBox/styles/normal_mirrored = SubResource("StyleBoxFlat_6gc6b") +CheckButton/colors/font_focus_color = Color(1, 1, 1, 0.7) +CheckButton/colors/font_hover_pressed_color = Color(1, 1, 1, 1) +CheckButton/colors/font_pressed_color = Color(1, 1, 1, 0.7) +Editor/colors/background = Color(0.1722, 0.1968, 0.2378, 1) +Editor/colors/box_selection_fill_color = Color(1, 1, 1, 0.12) +Editor/colors/box_selection_stroke_color = Color(1, 1, 1, 0.4) +Editor/colors/dark_color_2 = Color(0, 0, 0, 0.3) +Editor/colors/forward_plus_color = Color(0.54902, 0.752941, 0.392157, 1) +Editor/colors/gl_compatibility_color = Color(0.447059, 0.698039, 0.890196, 1) +Editor/colors/mobile_color = Color(0.862745, 0.482353, 0.584314, 1) +Editor/colors/prop_subsection = Color(1, 1, 1, 0) +Editor/colors/property_color_w = Color(1, 1, 1, 0.8) +Editor/colors/property_color_x = Color(0.882353, 0.384314, 0.466667, 1) +Editor/colors/property_color_y = Color(0.764706, 0.937255, 0.396078, 1) +Editor/colors/property_color_z = Color(0.415686, 0.670588, 0.964706, 1) +Editor/colors/warning_color = Color(0.95, 0.855, 0.57, 1) +Editor/constants/top_bar_separation = 4 +Editor/constants/window_border_margin = 4 +EditorHelpBitContent/styles/normal = SubResource("StyleBoxFlat_nvlhq") +EditorHelpBitTitle/styles/normal = SubResource("StyleBoxFlat_o4lbp") +EditorInspector/constants/v_separation = 3 +EditorInspectorCategory/styles/bg = SubResource("StyleBoxFlat_uoqhw") +EditorInspectorSection/constants/h_separation = 4 +EditorLogFilterButton/styles/hover = SubResource("StyleBoxFlat_m70y3") +EditorLogFilterButton/styles/normal = SubResource("StyleBoxEmpty_v2c1j") +EditorLogFilterButton/styles/pressed = SubResource("StyleBoxFlat_5kknp") +EditorProperty/colors/property_color = Color(1, 1, 1, 0.6) +EditorProperty/colors/warning_color = Color(0.95, 0.855, 0.57, 1) +EditorProperty/styles/bg = SubResource("StyleBoxEmpty_v2c1j") +EditorProperty/styles/bg_selected = SubResource("StyleBoxEmpty_v2c1j") +EditorProperty/styles/child_bg = SubResource("StyleBoxFlat_6omkk") +EditorSpinSlider/styles/label_bg = SubResource("StyleBoxFlat_wgaex") +EditorStyles/colors/movie_writer_icon_hover = Color(1, 1, 1, 0.8) +EditorStyles/colors/movie_writer_icon_hover_pressed = Color(1, 1, 1, 0.8) +EditorStyles/colors/movie_writer_icon_normal = Color(1, 1, 1, 0.7) +EditorStyles/colors/movie_writer_icon_pressed = Color(1, 1, 1, 0.941176) +EditorStyles/styles/FocusViewport = SubResource("StyleBoxFlat_8y8hw") +EditorStyles/styles/Information3dViewport = SubResource("StyleBoxFlat_xfcx5") +EditorStyles/styles/LaunchPadMovieMode = SubResource("StyleBoxFlat_vofr8") +EditorStyles/styles/LaunchPadNormal = SubResource("StyleBoxFlat_84rx5") +EditorStyles/styles/MovieWriterButtonPressed = SubResource("StyleBoxFlat_yq7t6") +EditorValidationPanel/styles/panel = SubResource("StyleBoxFlat_4n35b") +FlatButton/colors/font_color = Color(1, 1, 1, 0.7) +FlatButton/colors/font_disabled_color = Color(1, 1, 1, 0.3) +FlatButton/colors/font_focus_color = Color(1, 1, 1, 1) +FlatButton/colors/font_hover_color = Color(1, 1, 1, 1) +FlatButton/colors/font_hover_pressed_color = Color(1, 1, 1, 1) +FlatButton/colors/font_pressed_color = Color(1, 1, 1, 1) +FlatButton/colors/icon_disabled_color = Color(1, 1, 1, 0.3) +FlatButton/colors/icon_normal_color = Color(1, 1, 1, 0.7) +FlatButton/styles/disabled = SubResource("StyleBoxEmpty_mpbwm") +FlatButton/styles/disabled_mirrored = SubResource("StyleBoxEmpty_mpbwm") +FlatButton/styles/hover = SubResource("StyleBoxFlat_5kknp") +FlatButton/styles/hover_mirrored = SubResource("StyleBoxFlat_5kknp") +FlatButton/styles/hover_pressed = SubResource("StyleBoxFlat_m70y3") +FlatButton/styles/hover_pressed_mirrored = SubResource("StyleBoxFlat_m70y3") +FlatButton/styles/normal = SubResource("StyleBoxEmpty_mpbwm") +FlatButton/styles/normal_mirrored = SubResource("StyleBoxEmpty_mpbwm") +FlatButton/styles/pressed = SubResource("StyleBoxFlat_m70y3") +FlatButton/styles/pressed_mirrored = SubResource("StyleBoxFlat_m70y3") +FlatMenuButton/colors/font_color = Color(1, 1, 1, 0.7) +FlatMenuButton/colors/font_disabled_color = Color(1, 1, 1, 0.3) +FlatMenuButton/colors/font_focus_color = Color(1, 1, 1, 1) +FlatMenuButton/colors/font_hover_color = Color(1, 1, 1, 1) +FlatMenuButton/colors/font_hover_pressed_color = Color(1, 1, 1, 1) +FlatMenuButton/colors/font_pressed_color = Color(1, 1, 1, 1) +FlatMenuButton/colors/icon_disabled_color = Color(1, 1, 1, 0.3) +FlatMenuButton/colors/icon_normal_color = Color(1, 1, 1, 0.7) +FlatMenuButton/styles/disabled = SubResource("StyleBoxEmpty_mpbwm") +FlatMenuButton/styles/disabled_mirrored = SubResource("StyleBoxEmpty_mpbwm") +FlatMenuButton/styles/focus = SubResource("StyleBoxEmpty_mpbwm") +FlatMenuButton/styles/hover = SubResource("StyleBoxFlat_5kknp") +FlatMenuButton/styles/hover_mirrored = SubResource("StyleBoxFlat_5kknp") +FlatMenuButton/styles/hover_pressed = SubResource("StyleBoxFlat_m70y3") +FlatMenuButton/styles/hover_pressed_mirrored = SubResource("StyleBoxFlat_m70y3") +FlatMenuButton/styles/normal = SubResource("StyleBoxEmpty_mpbwm") +FlatMenuButton/styles/normal_mirrored = SubResource("StyleBoxEmpty_mpbwm") +FlatMenuButton/styles/pressed = SubResource("StyleBoxFlat_m70y3") +FlatMenuButton/styles/pressed_mirrored = SubResource("StyleBoxFlat_m70y3") +GraphStateMachine/colors/focus_color = Color(1, 1, 1, 0) +HBoxContainer/constants/separation = 2 +HSplitContainer/constants/autohide = 1 +HSplitContainer/constants/minimum_grab_thickness = 6 +HSplitContainer/constants/separation = 2 +InspectorActionButton/constants/h_separation = 8 +InspectorActionButton/styles/disabled = SubResource("StyleBoxFlat_ncj7f") +InspectorActionButton/styles/disabled_mirrored = SubResource("StyleBoxFlat_ncj7f") +InspectorActionButton/styles/hover = SubResource("StyleBoxFlat_bfne4") +InspectorActionButton/styles/hover_mirrored = SubResource("StyleBoxFlat_bfne4") +InspectorActionButton/styles/normal = SubResource("StyleBoxFlat_6walj") +InspectorActionButton/styles/normal_mirrored = SubResource("StyleBoxFlat_6walj") +InspectorActionButton/styles/pressed = SubResource("StyleBoxFlat_ffe6y") +InspectorActionButton/styles/pressed_mirrored = SubResource("StyleBoxFlat_ffe6y") +ItemList/colors/guide_color = Color(1, 1, 1, 0) +ItemList/constants/v_separation = 6 +ItemList/styles/cursor = SubResource("StyleBoxFlat_0rr50") +ItemList/styles/cursor_unfocused = SubResource("StyleBoxFlat_0rr50") +ItemList/styles/focus = SubResource("StyleBoxEmpty_v2c1j") +ItemList/styles/hovered = SubResource("StyleBoxFlat_5kknp") +ItemList/styles/hovered_selected = SubResource("StyleBoxFlat_5kknp") +ItemList/styles/hovered_selected_focus = SubResource("StyleBoxFlat_5kknp") +ItemList/styles/panel = SubResource("StyleBoxEmpty_saief") +ItemList/styles/selected = SubResource("StyleBoxFlat_5kknp") +ItemList/styles/selected_focus = SubResource("StyleBoxFlat_5kknp") +ItemListSecondary/styles/panel = SubResource("StyleBoxFlat_w4yjj") +Label/colors/font_color = Color(1, 1, 1, 0.7) +Label/styles/normal = SubResource("StyleBoxEmpty_wdwaf") +LineEdit/colors/font_placeholder_color = Color(1, 1, 1, 0.4) +LineEdit/styles/focus = SubResource("StyleBoxFlat_vps6v") +LineEdit/styles/normal = SubResource("StyleBoxFlat_3fkrk") +LineEdit/styles/read_only = SubResource("StyleBoxFlat_unybh") +MainMenuBar/styles/hover = SubResource("StyleBoxFlat_5kknp") +MainMenuBar/styles/hover_pressed = SubResource("StyleBoxFlat_m70y3") +MainMenuBar/styles/normal = SubResource("StyleBoxEmpty_mpbwm") +MainMenuBar/styles/pressed = SubResource("StyleBoxFlat_m70y3") +MainScreenButton/styles/hover = SubResource("StyleBoxEmpty_mpbwm") +MainScreenButton/styles/hover_mirrored = SubResource("StyleBoxEmpty_mpbwm") +MainScreenButton/styles/hover_pressed = SubResource("StyleBoxEmpty_mpbwm") +MainScreenButton/styles/hover_pressed_mirrored = SubResource("StyleBoxEmpty_mpbwm") +MainScreenButton/styles/normal = SubResource("StyleBoxEmpty_mpbwm") +MainScreenButton/styles/normal_mirrored = SubResource("StyleBoxEmpty_mpbwm") +MainScreenButton/styles/pressed = SubResource("StyleBoxEmpty_mpbwm") +MainScreenButton/styles/pressed_mirrored = SubResource("StyleBoxEmpty_mpbwm") +MenuButton/styles/disabled = SubResource("StyleBoxEmpty_mpbwm") +MenuButton/styles/disabled_mirrored = SubResource("StyleBoxEmpty_mpbwm") +MenuButton/styles/focus = SubResource("StyleBoxEmpty_mpbwm") +MenuButton/styles/hover = SubResource("StyleBoxFlat_5kknp") +MenuButton/styles/hover_mirrored = SubResource("StyleBoxFlat_5kknp") +MenuButton/styles/hover_pressed = SubResource("StyleBoxFlat_5kknp") +MenuButton/styles/hover_pressed_mirrored = SubResource("StyleBoxFlat_5kknp") +MenuButton/styles/normal = SubResource("StyleBoxEmpty_mpbwm") +MenuButton/styles/normal_mirrored = SubResource("StyleBoxEmpty_mpbwm") +MenuButton/styles/pressed = SubResource("StyleBoxFlat_m70y3") +MenuButton/styles/pressed_mirrored = SubResource("StyleBoxFlat_m70y3") +OptionButton/colors/font_color = Color(1, 1, 1, 0.7) +OptionButton/colors/font_disabled_color = Color(1, 1, 1, 0.3) +OptionButton/colors/font_focus_color = Color(1, 1, 1, 1) +OptionButton/colors/font_hover_color = Color(1, 1, 1, 1) +OptionButton/colors/font_hover_pressed_color = Color(1, 1, 1, 1) +OptionButton/colors/font_pressed_color = Color(1, 1, 1, 1) +OptionButton/colors/icon_disabled_color = Color(1, 1, 1, 0.3) +OptionButton/colors/icon_normal_color = Color(1, 1, 1, 0.7) +OptionButton/constants/arrow_margin = 14 +OptionButton/styles/disabled = SubResource("StyleBoxFlat_ncj7f") +OptionButton/styles/disabled_mirrored = SubResource("StyleBoxFlat_ncj7f") +OptionButton/styles/focus = SubResource("StyleBoxEmpty_v2c1j") +OptionButton/styles/hover = SubResource("StyleBoxFlat_bfne4") +OptionButton/styles/hover_mirrored = SubResource("StyleBoxFlat_bfne4") +OptionButton/styles/hover_pressed = SubResource("StyleBoxFlat_ffe6y") +OptionButton/styles/hover_pressed_mirrored = SubResource("StyleBoxFlat_ffe6y") +OptionButton/styles/normal = SubResource("StyleBoxFlat_6walj") +OptionButton/styles/normal_mirrored = SubResource("StyleBoxFlat_6walj") +OptionButton/styles/pressed = SubResource("StyleBoxFlat_ffe6y") +OptionButton/styles/pressed_mirrored = SubResource("StyleBoxFlat_ffe6y") +PanelContainer/styles/panel = SubResource("StyleBoxEmpty_mpbwm") +PopupMenu/constants/item_start_padding = 9 +PopupMenu/constants/v_separation = 7 +PopupMenu/styles/hover = SubResource("StyleBoxFlat_5kknp") +PopupMenu/styles/labeled_separator_left = SubResource("StyleBoxLine_ody4d") +PopupMenu/styles/labeled_separator_right = SubResource("StyleBoxLine_ody4d") +PopupMenu/styles/panel = SubResource("StyleBoxFlat_bscl1") +PopupMenu/styles/separator = SubResource("StyleBoxLine_ody4d") +PopupPanel/styles/panel = SubResource("StyleBoxFlat_52p6q") +ProgressBar/styles/background = SubResource("StyleBoxFlat_5wxaw") +ProgressBar/styles/fill = SubResource("StyleBoxFlat_jerwe") +RichTextLabel/styles/normal = SubResource("StyleBoxFlat_u1plv") +ScrollContainer/styles/focus = SubResource("StyleBoxEmpty_v2c1j") +SplitContainer/constants/minimum_grab_thickness = 6 +SplitContainer/constants/separation = 3 +SplitContainer/icons/h_grabber = SubResource("PlaceholderTexture2D_6288g") +SplitContainer/icons/v_grabber = SubResource("PlaceholderTexture2D_6288g") +TabBar/styles/tab_focus = SubResource("StyleBoxFlat_yaatb") +TabBar/styles/tab_hovered = SubResource("StyleBoxFlat_dv0ye") +TabBar/styles/tab_selected = SubResource("StyleBoxFlat_8el8h") +TabBar/styles/tab_unselected = SubResource("StyleBoxFlat_47qw1") +TabContainer/styles/panel = SubResource("StyleBoxFlat_fbtpk") +TabContainer/styles/tab_focus = SubResource("StyleBoxFlat_yaatb") +TabContainer/styles/tab_hovered = SubResource("StyleBoxFlat_dv0ye") +TabContainer/styles/tab_selected = SubResource("StyleBoxFlat_8el8h") +TabContainer/styles/tab_unselected = SubResource("StyleBoxFlat_47qw1") +TabContainerOdd/styles/tab_selected = SubResource("StyleBoxFlat_p7ig6") +TextEdit/styles/focus = SubResource("StyleBoxFlat_vps6v") +TextEdit/styles/normal = SubResource("StyleBoxFlat_3fkrk") +TextEdit/styles/read_only = SubResource("StyleBoxFlat_unybh") +TooltipPanel/styles/panel = SubResource("StyleBoxFlat_c6asc") +Tree/colors/drop_position_color = Color(1, 1, 1, 0.4) +Tree/colors/font_color = Color(1, 1, 1, 0.7) +Tree/colors/guide_color = Color(1, 1, 1, 0) +Tree/colors/parent_hl_line_color = Color(1, 1, 1, 0.1) +Tree/constants/children_hl_line_width = 0 +Tree/constants/draw_guides = 0 +Tree/constants/draw_relationship_lines = 1 +Tree/constants/inner_item_margin_left = 4 +Tree/constants/inner_item_margin_right = 4 +Tree/constants/parent_hl_line_width = 1 +Tree/constants/relationship_line_width = 0 +Tree/constants/v_separation = 1 +Tree/styles/button_hover = SubResource("StyleBoxFlat_ovxqj") +Tree/styles/button_pressed = SubResource("StyleBoxFlat_m70y3") +Tree/styles/cursor = SubResource("StyleBoxFlat_kmb46") +Tree/styles/cursor_unfocused = SubResource("StyleBoxFlat_kmb46") +Tree/styles/custom_button_hover = SubResource("StyleBoxFlat_ovxqj") +Tree/styles/custom_button_pressed = SubResource("StyleBoxFlat_m70y3") +Tree/styles/focus = SubResource("StyleBoxEmpty_v2c1j") +Tree/styles/hover = SubResource("StyleBoxFlat_ovxqj") +Tree/styles/hovered = SubResource("StyleBoxFlat_ovxqj") +Tree/styles/hovered_dimmed = SubResource("StyleBoxFlat_ovxqj") +Tree/styles/panel = SubResource("StyleBoxEmpty_saief") +Tree/styles/selected = SubResource("StyleBoxFlat_ovxqj") +Tree/styles/selected_focus = SubResource("StyleBoxFlat_ovxqj") +Tree/styles/title_button_hover = SubResource("StyleBoxFlat_p53la") +Tree/styles/title_button_normal = SubResource("StyleBoxFlat_p53la") +Tree/styles/title_button_pressed = SubResource("StyleBoxFlat_p53la") +TreeSecondary/styles/panel = SubResource("StyleBoxFlat_w4yjj") +VBoxContainer/constants/separation = 2 +VSplitContainer/constants/autohide = 1 +VSplitContainer/constants/minimum_grab_thickness = 6 +VSplitContainer/constants/separation = 2 +script = SubResource("GDScript_hhmc0") diff --git a/objects/brick.tscn b/objects/brick.tscn new file mode 100644 index 0000000..31799dd --- /dev/null +++ b/objects/brick.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=5 format=3 uid="uid://bymro4t7angv5"] + +[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1c3jb"] +[ext_resource type="Script" path="res://scripts/components/bullet.gd" id="2_i6t5k"] +[ext_resource type="Script" path="res://scripts/components/damage.gd" id="3_8xipx"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ar0xf"] +size = Vector2(16, 10) + +[node name="Brick" type="Area2D"] +collision_layer = 16 +collision_mask = 11 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_ar0xf") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_1c3jb") +hframes = 12 +vframes = 12 +frame = 80 + +[node name="BulletComponent" type="Node" parent="." node_paths=PackedStringArray("root", "area2d", "visibility_notifier", "timer")] +script = ExtResource("2_i6t5k") +root = NodePath("..") +speed = 120.0 +area2d = NodePath("..") +visibility_notifier = NodePath("../VisibleOnScreenNotifier2D") +life_time = 2.0 +timer = NodePath("../Timer") + +[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."] +position = Vector2(0, 2.38419e-07) +scale = Vector2(0.8, 0.5) + +[node name="Timer" type="Timer" parent="."] + +[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d")] +script = ExtResource("3_8xipx") +area2d = NodePath("..") diff --git a/objects/brick_player.tscn b/objects/brick_player.tscn index 9d6cb18..608b6ca 100644 --- a/objects/brick_player.tscn +++ b/objects/brick_player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://bqi5s710xb1ju"] +[gd_scene load_steps=13 format=3 uid="uid://bqi5s710xb1ju"] [ext_resource type="Script" path="res://scripts/player.gd" id="1_8j4h4"] [ext_resource type="Texture2D" uid="uid://b7gp0gqvkv8j4" path="res://sprites/MrBrick_base.png" id="2_bc55y"] @@ -9,6 +9,8 @@ [ext_resource type="Script" path="res://scripts/components/health.gd" id="7_tqjk8"] [ext_resource type="Script" path="res://scripts/components/player_death.gd" id="8_1v23d"] [ext_resource type="Script" path="res://scripts/components/knockback.gd" id="9_rjyu4"] +[ext_resource type="Script" path="res://scripts/components/brick_throw.gd" id="10_u0v3b"] +[ext_resource type="PackedScene" uid="uid://bymro4t7angv5" path="res://objects/brick.tscn" id="11_qutq2"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_hdsg1"] size = Vector2(16, 31) @@ -62,5 +64,14 @@ script = ExtResource("9_rjyu4") character_body = NodePath("..") knockback_force = 1500.0 +[node name="BrickThrowComponent" type="Node" parent="." node_paths=PackedStringArray("player_controller", "timer")] +script = ExtResource("10_u0v3b") +brick_scene = ExtResource("11_qutq2") +fire_rate = 0.3 +player_controller = NodePath("..") +timer = NodePath("../ThrowTimer") + +[node name="ThrowTimer" type="Timer" parent="."] + [connection signal="on_death" from="HealthComponent" to="PlayerDeathComponent" method="_on_health_component_on_death"] [connection signal="on_health_change" from="HealthComponent" to="KnockbackComponent" method="_on_health_component_on_health_change"] diff --git a/objects/bullet.tscn b/objects/bullet.tscn index 7b91897..9ac0b81 100644 --- a/objects/bullet.tscn +++ b/objects/bullet.tscn @@ -9,7 +9,7 @@ radius = 4.0 [node name="Bullet" type="Area2D"] collision_layer = 8 -collision_mask = 5 +collision_mask = 21 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_txsw8") diff --git a/objects/coin.tscn b/objects/coin.tscn index b733272..1c85105 100644 --- a/objects/coin.tscn +++ b/objects/coin.tscn @@ -10,7 +10,7 @@ radius = 9.0 [node name="Coin" type="Area2D"] collision_layer = 2 -collision_mask = 4 +collision_mask = 20 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_3ask2") diff --git a/objects/enemy.tscn b/objects/enemy.tscn index a598d66..a9282f9 100644 --- a/objects/enemy.tscn +++ b/objects/enemy.tscn @@ -13,7 +13,7 @@ size = Vector2(18, 27) size = Vector2(18, 27) [node name="Enemy" type="CharacterBody2D"] -collision_layer = 0 +collision_layer = 8 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(0, 0.5) @@ -45,7 +45,7 @@ root = NodePath("..") [node name="Hitbox" type="Area2D" parent="."] collision_layer = 8 -collision_mask = 4 +collision_mask = 20 [node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] position = Vector2(0, 0.5) diff --git a/project.godot b/project.godot index 35c1b46..c54dc53 100644 --- a/project.godot +++ b/project.godot @@ -32,6 +32,7 @@ GameManager="*res://objects/game_manager.tscn" window/size/viewport_width=640 window/size/viewport_height=360 +window/size/initial_position=Vector2i(420, 0) window/size/window_width_override=1280 window/size/window_height_override=720 window/stretch/mode="viewport" @@ -68,6 +69,12 @@ down={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) ] } +attack={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) +, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(416, 6),"global_position":Vector2(425, 50),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} [layer_names] @@ -75,6 +82,7 @@ down={ 2d_physics/layer_2="Collectible Entities" 2d_physics/layer_3="Player" 2d_physics/layer_4="Enemy" +2d_physics/layer_5="player projectiles" [rendering] diff --git a/scripts/components/brick_throw.gd b/scripts/components/brick_throw.gd new file mode 100644 index 0000000..11311cb --- /dev/null +++ b/scripts/components/brick_throw.gd @@ -0,0 +1,39 @@ +class_name BrickThrowComponent +extends Node + +@export var brick_scene: PackedScene +@export var fire_rate: float = 1.0 +@export var player_controller: PlayerController +@export var timer: Timer + +var can_throw: bool = true + +func _ready() -> void: + setup_timer() + can_throw = true + + +func _input(event: InputEvent) -> void: + if event.is_action_pressed("attack") and can_throw: + throw_brick() + +func setup_timer() -> void: + timer.wait_time = fire_rate + timer.one_shot = false + timer.autostart = false + timer.timeout.connect(on_timer_timeout) + + +func on_timer_timeout() -> void: + can_throw = true + + +func throw_brick() -> void: + var brick_instance: Node2D = brick_scene.instantiate() + var brick: BulletComponent = brick_instance.get_node("BulletComponent") + brick_instance.position = player_controller.position + brick.direction = Vector2.RIGHT if player_controller.velocity.x >= 0.0 else Vector2.LEFT + get_tree().current_scene.add_child(brick_instance) + + can_throw = false + timer.start() diff --git a/scripts/components/bullet.gd b/scripts/components/bullet.gd index 73ed2d8..ea8baa4 100644 --- a/scripts/components/bullet.gd +++ b/scripts/components/bullet.gd @@ -1,7 +1,6 @@ class_name BulletComponent extends Node - @export var root: Node2D @export var direction: Vector2 = Vector2.RIGHT @export var speed: float = 10.0 @@ -10,23 +9,27 @@ extends Node @export var life_time: float = 5.0 @export var timer: Timer + func _ready() -> void: root = get_parent() visibility_notifier.screen_exited.connect(_on_screen_exited) area2d.body_entered.connect(on_area2d_body_entered) - + timer.wait_time = life_time timer.timeout.connect(on_timer_timeout) + func _physics_process(delta: float) -> void: root.position += direction * speed * delta - + + func _on_screen_exited() -> void: root.queue_free() - + + func on_area2d_body_entered(_body: Node2D) -> void: root.queue_free() - - + + func on_timer_timeout() -> void: root.queue_free() \ No newline at end of file diff --git a/tileset/village/tileset_village.tres b/tileset/village/tileset_village.tres index 23ea6a6..7544ff3 100644 --- a/tileset/village/tileset_village.tres +++ b/tileset/village/tileset_village.tres @@ -367,7 +367,7 @@ texture = ExtResource("1") [resource] physics_layer_0/collision_layer = 1 -physics_layer_0/collision_mask = 13 +physics_layer_0/collision_mask = 29 terrain_set_0/mode = 0 terrain_set_0/terrain_0/name = "Village 0" terrain_set_0/terrain_0/color = Color(0.520131, 0.153738, 0.75213, 1)