From 123a7592b50363fab2d867fe4ef1834834987099 Mon Sep 17 00:00:00 2001 From: Russell Matney Date: Sun, 23 Jun 2024 10:49:07 -0400 Subject: [PATCH] feat: button styles and bottom-up todo --- src/BloxGrid.gd | 10 +++------- src/BloxTheme.tres | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/BloxGrid.gd b/src/BloxGrid.gd index affa4e9..f653e71 100644 --- a/src/BloxGrid.gd +++ b/src/BloxGrid.gd @@ -194,7 +194,8 @@ func remove_at_coord(coord: Vector2i) -> BloxCell: ## tetris fall ################################################ -func bottom_up_pieces() -> Array[BloxPiece]: +func bottom_up_pieces(_dir: Vector2i) -> Array[BloxPiece]: + # TODO use `dir` to go 'bottom-up' from any direction var ps: Array[BloxPiece] = [] ps.assign(pieces) ps.sort_custom(func(pa, pb): @@ -202,18 +203,13 @@ func bottom_up_pieces() -> Array[BloxPiece]: return ps func apply_step_tetris(dir=Vector2i.DOWN) -> bool: - # hmm i think we should do this bottom up and apply the fall right away - # also there's probably interest in animating the change var falling_cells = [] var to_fall = [] - for piece in bottom_up_pieces(): + for piece in bottom_up_pieces(dir): if can_piece_move(piece, dir, falling_cells): to_fall.append(piece) falling_cells.append_array(piece.grid_coords()) - # drop them all at once - # (this doesn't seem right, multi-piece stacks won't fall together) - # maybe it's fine/a graphic? for piece in to_fall: move_piece(piece, dir, true) diff --git a/src/BloxTheme.tres b/src/BloxTheme.tres index b9b45cd..40bf826 100644 --- a/src/BloxTheme.tres +++ b/src/BloxTheme.tres @@ -1,7 +1,22 @@ -[gd_resource type="Theme" load_steps=4 format=3 uid="uid://dyh165k6fs4jf"] +[gd_resource type="Theme" load_steps=5 format=3 uid="uid://dyh165k6fs4jf"] [ext_resource type="FontFile" uid="uid://dgemb4ot8u4n" path="res://assets/fonts/Born2bSportyV2.ttf" id="1_00x6k"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_aebha"] +content_margin_left = 16.0 +content_margin_top = 8.0 +content_margin_right = 16.0 +content_margin_bottom = 8.0 +bg_color = Color(0.435294, 0.164706, 0.0117647, 0.701961) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 + [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rwolb"] bg_color = Color(0.0364248, 0.263517, 0.310359, 1) @@ -10,6 +25,7 @@ bg_color = Color(0.0364248, 0.263517, 0.310359, 1) [resource] Button/font_sizes/font_size = 64 Button/fonts/font = ExtResource("1_00x6k") +Button/styles/normal = SubResource("StyleBoxFlat_aebha") PanelContainer/styles/panel = SubResource("StyleBoxFlat_rwolb") PanelContainerNoBackground/base_type = &"PanelContainer" PanelContainerNoBackground/styles/panel = SubResource("StyleBoxEmpty_vipxn")