TableTower/ui/card_layer.gd

24 lines
615 B
GDScript3
Raw Normal View History

class_name CardLayer
extends Control
## Holds the table cards and paints their hard drop shadow underneath them.
var _shadow: StyleBoxFlat
func _init() -> void:
mouse_filter = MOUSE_FILTER_IGNORE
# Controls only draw inside their own rect, so cover the whole world.
size = Vector2(BoardView.WORLD_SIZE, BoardView.WORLD_SIZE)
_shadow = Style.box(Color(0, 0, 0, 0.22), 10)
func _process(_delta: float) -> void:
queue_redraw()
func _draw() -> void:
for c in get_children():
var card := c as Control
if card and card.visible:
draw_style_box(_shadow, Rect2(card.position + Vector2(0, 5), card.size))