online multiplayer chess game (note server currently down)
center the board + fix opening label visibility
bendn 2022-09-26
parent 56b1d3d · commit a7b0e37
-rw-r--r--ui/board/Game.gd2
-rw-r--r--ui/board/Game.tscn14
-rw-r--r--ui/menus/sidebarright/OpeningLabel.gd5
-rw-r--r--ui/menus/sidebarright/SidebarRight.tscn5
4 files changed, 19 insertions, 7 deletions
diff --git a/ui/board/Game.gd b/ui/board/Game.gd
index f6d7e42..14ab685 100644
--- a/ui/board/Game.gd
+++ b/ui/board/Game.gd
@@ -30,7 +30,7 @@ func set_status(text: String, length := 5) -> void:
func get_board() -> AspectRatioContainer:
- return $Holder/middle/Board as AspectRatioContainer
+ return $"%Board" as AspectRatioContainer
func _spectate_info(info: Dictionary) -> void:
diff --git a/ui/board/Game.tscn b/ui/board/Game.tscn
index bae208e..f1b59b1 100644
--- a/ui/board/Game.tscn
+++ b/ui/board/Game.tscn
@@ -31,6 +31,7 @@ margin_bottom = 800.0
mouse_filter = 2
theme = ExtResource( 1 )
custom_constants/separation = 0
+alignment = 2
[node name="Chat" parent="Holder" instance=ExtResource( 3 )]
anchor_right = 0.0
@@ -49,11 +50,20 @@ size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 0
-[node name="Board" parent="Holder/middle" instance=ExtResource( 5 )]
+[node name="Container" type="AspectRatioContainer" parent="Holder/middle"]
+margin_right = 700.0
+margin_bottom = 800.0
+size_flags_horizontal = 3
+size_flags_vertical = 3
+alignment_horizontal = 2
+
+[node name="Board" parent="Holder/middle/Container" instance=ExtResource( 5 )]
+unique_name_in_owner = true
anchor_right = 0.0
anchor_bottom = 0.0
+margin_top = 50.0
margin_right = 700.0
-margin_bottom = 800.0
+margin_bottom = 750.0
rect_min_size = Vector2( 700, 700 )
[node name="BackButton" type="CenterContainer" parent="Holder/middle" groups=["backbutton", "showongameover"]]
diff --git a/ui/menus/sidebarright/OpeningLabel.gd b/ui/menus/sidebarright/OpeningLabel.gd
index fb5897f..fab5f11 100644
--- a/ui/menus/sidebarright/OpeningLabel.gd
+++ b/ui/menus/sidebarright/OpeningLabel.gd
@@ -22,15 +22,16 @@ func update_opening(_var := null) -> void:
if fen != Globals.grid.chess.DEFAULT_POSITION && fen != current_req:
if current_req:
http_request.cancel_request()
- text = ""
current_req = fen
var u = url % fen.replace(" ", "_").http_escape()
Log.net(["REQUEST: get opening with url:", u])
http_request.request(u)
+ else:
+ set_text("")
func _request_completed(result, _response_code, _headers, byte_body):
- text = "" # empty text and hide self
+ set_text("") # empty text and hide self
current_req = ""
if result != OK: # technically REQUEST_SUCCESS but i cant find it
return
diff --git a/ui/menus/sidebarright/SidebarRight.tscn b/ui/menus/sidebarright/SidebarRight.tscn
index ab75114..788f850 100644
--- a/ui/menus/sidebarright/SidebarRight.tscn
+++ b/ui/menus/sidebarright/SidebarRight.tscn
@@ -68,12 +68,13 @@ alignment = 1
[node name="OpeningLabel" type="Label" parent="V"]
visible = false
-margin_top = 176.0
+margin_top = 213.0
margin_right = 1402.0
-margin_bottom = 199.0
+margin_bottom = 238.0
rect_min_size = Vector2( 0, 25 )
custom_fonts/font = ExtResource( 8 )
valign = 1
+autowrap = true
script = ExtResource( 10 )
[node name="BlackPanel" parent="V" instance=ExtResource( 22 )]