乒乓球游戏:C++ GDExtension 实现
这个提交包含在:
@@ -0,0 +1,8 @@
|
||||
[configuration]
|
||||
entry_symbol = "pingpang_library_init"
|
||||
compatibility_minimum = "4.5"
|
||||
|
||||
[libraries]
|
||||
windows.x86_64 = "res://bin/pingpang.dll"
|
||||
linux.x86_64 = "res://bin/libpingpang.so"
|
||||
macos.universal = "res://bin/libpingpang.dylib"
|
||||
+5
-3
@@ -10,14 +10,16 @@ config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="main"
|
||||
config/name="Pingpang"
|
||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
run/main_scene="res://scenes/main.tscn"
|
||||
|
||||
[physics]
|
||||
|
||||
3d/physics_engine="Jolt Physics"
|
||||
common/enable_2d_physics=true
|
||||
|
||||
[rendering]
|
||||
|
||||
rendering_device/driver.windows="d3d12"
|
||||
renderer/rendering_method="forward_plus"
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
[gd_scene load_steps=4 format=3]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="circle_ball"]
|
||||
radius = 12.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="rect_paddle"]
|
||||
size = Vector2(20.0, 120.0)
|
||||
|
||||
[node name="Game" type="PingPongGame"]
|
||||
|
||||
[node name="Ball" type="PingPongBall" parent="Game"]
|
||||
position = Vector2(576.0, 324.0)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Game/Ball"]
|
||||
shape = SubResource("circle_ball")
|
||||
|
||||
[node name="LeftPaddle" type="PingPongPaddle" parent="Game"]
|
||||
position = Vector2(50.0, 324.0)
|
||||
is_player = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Game/LeftPaddle"]
|
||||
shape = SubResource("rect_paddle")
|
||||
|
||||
[node name="RightPaddle" type="PingPongPaddle" parent="Game"]
|
||||
position = Vector2(1102.0, 324.0)
|
||||
is_player = false
|
||||
ball_path = NodePath("../Ball")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Game/RightPaddle"]
|
||||
shape = SubResource("rect_paddle")
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="Game"]
|
||||
|
||||
[node name="LeftScore" type="Label" parent="Game/UI"]
|
||||
offset_left = 200.0
|
||||
offset_top = 20.0
|
||||
offset_right = 400.0
|
||||
offset_bottom = 70.0
|
||||
text = "0"
|
||||
horizontal_alignment = 1
|
||||
theme_override_font_sizes/font_size = 48
|
||||
theme_override_colors/font_color = Color(1.0, 1.0, 1.0, 1.0)
|
||||
|
||||
[node name="RightScore" type="Label" parent="Game/UI"]
|
||||
offset_left = 752.0
|
||||
offset_top = 20.0
|
||||
offset_right = 952.0
|
||||
offset_bottom = 70.0
|
||||
text = "0"
|
||||
horizontal_alignment = 1
|
||||
theme_override_font_sizes/font_size = 48
|
||||
theme_override_colors/font_color = Color(1.0, 1.0, 1.0, 1.0)
|
||||
|
||||
[node name="CenterLine" type="ColorRect" parent="Game/UI"]
|
||||
offset_left = 574.0
|
||||
offset_top = 0.0
|
||||
offset_right = 578.0
|
||||
offset_bottom = 648.0
|
||||
color = Color(1.0, 1.0, 1.0, 0.1)
|
||||
在新工单中引用
屏蔽一个用户