diff --git a/Scenes/Board.tscn b/Scenes/Board.tscn index cfe1dce..f5cd324 100644 --- a/Scenes/Board.tscn +++ b/Scenes/Board.tscn @@ -18,11 +18,12 @@ size = Vector2( 16, 9 ) script = ExtResource( 1 ) [node name="Camera" type="Camera" parent="."] -transform = Transform( 1, 0, 0, 0, 0.367808, 0.929902, 0, -0.929902, 0.367808, 0, 5.05934, 3.29185 ) +transform = Transform( 1, 0, 0, 0, 0.224381, 0.974502, 0, -0.974502, 0.224381, 0, 8.4261, 2.52658 ) +fov = 50.0 script = ExtResource( 2 ) [node name="Hand" type="Spatial" parent="Camera"] -transform = Transform( 0.4, 0, 0, 0, 0, -0.4, 0, 0.4, 0, 0, -0.552465, -0.87444 ) +transform = Transform( 0.4, 0, 0, 0, 2.98023e-008, -0.4, 0, 0.4, 2.98023e-008, 0, -0.6, -1.3 ) [node name="MeshInstance" type="MeshInstance" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.001, 0 ) @@ -34,3 +35,13 @@ material/0 = null [node name="Cards" type="Spatial" parent="."] [node name="Deck" parent="Cards" instance=ExtResource( 5 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4.30889, 0, 3.52858 ) +title = "Deck" + +[node name="Graveyard" parent="Cards" instance=ExtResource( 5 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.23371, 0, 3.52858 ) +title = "Graveyard" + +[node name="Banished" parent="Cards" instance=ExtResource( 5 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.23371, 0, 2.40401 ) +title = "Banished" diff --git a/Scenes/Components/Stack.gd b/Scenes/Components/Stack.gd new file mode 100644 index 0000000..fe3c191 --- /dev/null +++ b/Scenes/Components/Stack.gd @@ -0,0 +1,9 @@ +extends Spatial + +export var title: String + +func _ready(): + set_title(title) + +func set_title(title: String): + $LabelViewport/Label.text = title \ No newline at end of file diff --git a/Scenes/Components/Stack.tscn b/Scenes/Components/Stack.tscn index 89906fc..d999e91 100644 --- a/Scenes/Components/Stack.tscn +++ b/Scenes/Components/Stack.tscn @@ -1,3 +1,60 @@ -[gd_scene format=2] +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://Scenes/Components/Stack.gd" type="Script" id=1] + +[sub_resource type="DynamicFontData" id=2] +font_path = "res://UIAssets/Fonts/Catamaran-Bold.ttf" + +[sub_resource type="DynamicFont" id=3] +outline_size = 2 +outline_color = Color( 0, 0, 0, 0.54902 ) +font_data = SubResource( 2 ) + +[sub_resource type="ViewportTexture" id=1] +viewport_path = NodePath("LabelViewport") [node name="Stack" type="Spatial"] +script = ExtResource( 1 ) + +[node name="CSGBox" type="CSGBox" parent="."] +transform = Transform( 0.85598, 0, 0, 0, 1, 0, 0, 0, 0.871019, 0, 0, 0 ) +width = 0.946586 +height = 0.002 +depth = 1.18809 + +[node name="CSGBox2" type="CSGBox" parent="CSGBox"] +operation = 2 +width = 0.891339 +height = 0.102173 +depth = 1.1406 + +[node name="CSGBox3" type="CSGBox" parent="CSGBox"] +operation = 2 +width = 0.191127 +height = 0.102173 +depth = 1.57935 + +[node name="CSGBox4" type="CSGBox" parent="CSGBox"] +transform = Transform( -4.37114e-008, 0, -1, 0, 1, 0, 1, 0, -4.37114e-008, 0, 0, 0 ) +operation = 2 +width = 0.650255 +height = 0.102173 +depth = 1.57935 + +[node name="LabelViewport" type="Viewport" parent="."] +size = Vector2( 100, 100 ) +transparent_bg = true +handle_input_locally = false +usage = 0 + +[node name="Label" type="Label" parent="LabelViewport"] +anchor_right = 1.0 +anchor_bottom = 1.0 +custom_fonts/font = SubResource( 3 ) +align = 1 +valign = 1 + +[node name="LabelSprite" type="Sprite3D" parent="."] +transform = Transform( 0.5853, 0.810817, -3.54419e-008, 0, -4.37114e-008, -1, -0.810817, 0.5853, -2.55843e-008, 1.05839e-009, 0.0298628, 7.64017e-010 ) +texture = SubResource( 1 ) +region_rect = Rect2( 0, 0, 30, 30 ) diff --git a/Scenes/Scripts/Board.gd b/Scenes/Scripts/Board.gd index eb5daf6..d901a79 100644 --- a/Scenes/Scripts/Board.gd +++ b/Scenes/Scripts/Board.gd @@ -52,8 +52,9 @@ func _process(delta: float): camera.transform.origin = lastCameraTransform.origin - Vector3(mousePos.x, 0, mousePos.y) # If holding a card, move it between board/hand if holdingCard != null: - var relPos: float = absMousePos.y / get_viewport().size.y - var selectingHand: bool = relPos > mouseHandThreshold + var relPos: Vector2 = absMousePos / get_viewport().size + var xMargin = 1.0-HAND_SCREEN_PERC + var selectingHand: bool = relPos.y > mouseHandThreshold and (relPos.x > xMargin/2 and relPos.x < (1.0-xMargin/2)) if selectingHand and not holdingCard.inHand: holdingCard.inHand = true call_deferred("reparent", holdingCard, cards, hand) diff --git a/UIAssets/Fonts/Catamaran-Bold.ttf b/UIAssets/Fonts/Catamaran-Bold.ttf new file mode 100644 index 0000000..1fc43db Binary files /dev/null and b/UIAssets/Fonts/Catamaran-Bold.ttf differ