online multiplayer chess game (note server currently down)
chat
in order to accomlish this i made `Board.tscn` a ui module for `Game.tscn` so it fully supports resizing and such also had add the fonts necessary to complete this
bendn 2022-06-04
parent 401a16e · commit 2ffadd2
-rw-r--r--Board.gd (renamed from Grid.gd)86
-rw-r--r--Board.tscn34
-rw-r--r--Debug.gd2
-rw-r--r--Game.gd11
-rw-r--r--Game.tscn431
-rw-r--r--PGN/test_pgns.gd7
-rw-r--r--Piece.tscn68
-rw-r--r--Square.gd25
-rw-r--r--Square.tscn54
-rw-r--r--assets/ui/CascadiaCode.ttf3
-rw-r--r--assets/ui/send.png3
-rw-r--r--assets/ui/send.png.import35
-rw-r--r--assets/ui/svg/send.svg3
-rw-r--r--assets/ui/verdana-bold-italic.ttf3
-rw-r--r--assets/ui/verdana.ttf3
-rw-r--r--networking/Network.gd10
-rw-r--r--networking/PacketHandler.gd6
-rw-r--r--pieces/Pawn.gd4
-rw-r--r--pieces/Piece.gd32
-rw-r--r--project.godot8
-rw-r--r--saveload.gd8
-rw-r--r--ui/ClickableSprite.gd2
-rw-r--r--ui/GameUI.gd7
-rw-r--r--ui/GameUI.tscn208
-rw-r--r--ui/StartMenu.gd6
-rw-r--r--ui/account/Account.gd2
-rw-r--r--ui/account/Account.tscn2
-rw-r--r--ui/boardlabels/BottomLeftLabel.tscn23
-rw-r--r--ui/boardlabels/TopRightLabel.tscn24
-rw-r--r--ui/chat/Chat.gd82
-rw-r--r--ui/chat/Chat.tscn273
-rw-r--r--ui/sandisplay/SanDisplay.gd4
-rw-r--r--ui/theme/main.tres30
-rw-r--r--ui/verdana-bold.tres (renamed from ui/verdana.tres)0
34 files changed, 1057 insertions, 442 deletions
diff --git a/Grid.gd b/Board.gd
index 7205146..0f2fba5 100644
--- a/Grid.gd
+++ b/Board.gd
@@ -1,12 +1,10 @@
-extends Node2D
+extends Control
class_name Grid
const PieceScene := preload("res://Piece.tscn")
const Square := preload("res://Square.tscn")
-const BottomLeftLabel := preload("res://ui/boardlabels/BottomLeftLabel.tscn")
-const TopRightLabel := preload("res://ui/boardlabels/TopRightLabel.tscn")
-const piece_size := Vector2(100, 100)
+const piece_size := Vector2(80, 80)
const default_metadata := {
"wccl": false, # white can castle left
"wccr": false, # white can castle right
@@ -17,13 +15,15 @@ const default_metadata := {
"bcep": [], # black can enpassant
}
+onready var offset = rect_position
+
export(Color) var overlay_color := Color(0.078431, 0.333333, 0.117647, 0.498039)
export(Color) var clockrunning_color := Color(0.219608, 0.278431, 0.133333)
export(Color) var clockrunninglow := Color(0.47451, 0.172549, 0.164706)
export(Color) var clocklow := Color(0.313726, 0.156863, 0.14902)
var matrix := []
-var stop_input := true
+var stop_input := false
var background_matrix := []
var history_matrixes := {}
var last_clicked: Piece = null
@@ -35,7 +35,7 @@ onready var background := $Background
onready var ASSETS_PATH: String = "res://assets/pieces/%s/" % Globals.piece_set
onready var foreground := $Foreground
onready var pieces := $Pieces
-onready var ui := $"../UI"
+export(NodePath) onready var status = get_node(status) as StatusLabel
func _init() -> void:
@@ -54,7 +54,7 @@ func _ready() -> void:
Debug.monitor(self, "last_clicked")
Debug.monitor(self, "matrix", "matrix[8]")
Debug.monitor(self, "highest value in 3fold", "threefoldrepetition()")
- stop_input = false
+ Debug.monitor(self, "stop_input")
func _exit_tree() -> void:
@@ -113,35 +113,55 @@ func flip_labels() -> void:
func flip_board() -> void:
- if global_position == Vector2(800, 800):
+ if flipped:
flipped = false
- global_position = Vector2(0, 0)
- rotation_degrees = 0
+ rect_rotation = 0
flip_pieces()
flip_labels()
else:
flipped = true
- global_position = Vector2(800, 800)
- rotation_degrees = 180
+ rect_rotation = 180
flip_pieces()
flip_labels()
func init_labels() -> void:
for i in range(8):
- labels.letters.append(init_label(BottomLeftLabel, i, Vector2(i, 7), "abcdefgh"[i]))
- labels.numbers.append(init_label(TopRightLabel, i, Vector2(7, i), str(8 - i)))
-
-
-func init_label(labelscene: PackedScene, i: int, position: Vector2, text: String) -> Control:
- var labelholder: Control = labelscene.instance()
- labelholder.rect_size = piece_size
- labelholder.rect_position = position * piece_size
- var label: Label = labelholder.get_node("Label")
+ labels.letters.append(
+ init_label(
+ i,
+ Vector2(i, 7),
+ "abcdefgh"[i],
+ Label.VALIGN_BOTTOM,
+ Label.ALIGN_LEFT,
+ (Vector2.RIGHT + Vector2.UP) * 10
+ )
+ )
+ labels.numbers.append(
+ init_label(
+ i,
+ Vector2(7, i),
+ str(8 - i),
+ Label.VALIGN_TOP,
+ Label.ALIGN_RIGHT,
+ (Vector2.LEFT + Vector2.DOWN) * 10
+ )
+ )
+
+
+func init_label(i: int, position: Vector2, text: String, valign := 0, align := 0, off := Vector2.ZERO) -> Label:
+ var label := Label.new()
+ label.rect_size = piece_size
+ label.align = align
+ label.valign = valign
+ label.rect_position = (position * piece_size) + off
label.text = text
label.add_color_override("font_color", Globals.board_color1 if i % 2 == 0 else Globals.board_color2)
- foreground.add_child(labelholder)
- return labelholder
+ var font: DynamicFont = load("res://ui/verdana-bold.tres")
+ font.size = 15
+ label.add_font_override("font", font)
+ foreground.add_child(label)
+ return label
func threefoldrepetition() -> int:
@@ -160,7 +180,7 @@ func mat2str(mat: Array = matrix) -> String:
func drawed(reason := "") -> void:
- ui.set_status("draw by " + reason, 0)
+ status.set_text("draw by " + reason, 0)
Events.emit_signal("game_over")
SoundFx.play("Draw")
yield(get_tree().create_timer(5), "timeout")
@@ -168,7 +188,7 @@ func drawed(reason := "") -> void:
func win(winner: bool, reason := "") -> void:
- ui.set_status("%s won the game by %s" % ["white" if winner else "black", reason], 0) # black won the game by checkmate
+ status.set_text("%s won the game by %s" % ["white" if winner else "black", reason], 0) # black won the game by checkmate
Events.emit_signal("game_over")
Log.info("%s won the game in %s turns!" % ["white" if winner else "black", Globals.fullmove])
SoundFx.play("Victory")
@@ -214,7 +234,7 @@ func make_piece(position: Vector2, script: String, white: bool = true) -> void:
var piece := PieceScene.instance() # create a piece
piece.script = load("res://pieces/%s.gd" % script) # set the script
piece.real_position = position # set the real position
- piece.global_position = position * piece_size # set the global position
+ piece.rect_global_position = position * piece_size # set the global position
piece.white = white # set its team
pieces.add_child(piece) # add the piece to the grid
matrix[position.y][position.x] = piece
@@ -228,9 +248,8 @@ func init_board() -> void: # create the board
square.rect_size = piece_size # set the size
square.rect_global_position = Vector2(i, j) * piece_size # set the position
square.color = Globals.board_color1 if (i + j) % 2 == 0 else Globals.board_color2 # set the color
- square.real_position = Vector2(i, j) # set the real position
background.add_child(square) # add the square to the background
- square.connect("clicked", self, "square_clicked") # connect the clicked event
+ square.connect("clicked", self, "square_clicked", [Vector2(i, j)]) # connect the clicked event
background_matrix[i].append(square) # add the square to the background matrix
@@ -293,11 +312,11 @@ func check_for_frame(position: Vector2) -> bool: # check for a frame, validatin
func square_clicked(position: Vector2) -> void: # square clicked
- Log.debug(Utils.to_algebraic(position) + " clicked")
if stop_input:
return
if Globals.turn != Globals.team:
return
+ Log.debug(Utils.to_algebraic(position) + " clicked")
var spot: Piece = matrix[position.y][position.x] # get the spot
if !spot or spot.white != Globals.team:
if !is_instance_valid(last_clicked):
@@ -395,17 +414,18 @@ func _on_turn_over() -> void:
func play_pgn(pgn: String, instant := false):
+ stop_input = true
for san in Pgn.parse(pgn).moves:
- play_san(san) # instant is not working right right now
+ play_san(san, false, false) # instant is not working right right now
# so just change the delay :>
if instant:
yield(get_tree(), "idle_frame")
else:
yield(get_tree().create_timer(.3), "timeout")
+ stop_input = false
-func play_san(san: String, instant := false) -> void:
- stop_input = true
+func play_san(san: String, instant := false, set_input := true) -> void:
Log.debug("playing " + san)
var san_to_add := san
var mov = SanParse.parse(san)
@@ -447,4 +467,4 @@ func play_san(san: String, instant := false) -> void:
else: # a very normal move
Piece.at_pos(positions[0]).moveto(positions[1], instant)
Utils.add_move(san_to_add)
- stop_input = false
+ stop_input = false if set_input else stop_input
diff --git a/Board.tscn b/Board.tscn
index 69da5de..ad8ea68 100644
--- a/Board.tscn
+++ b/Board.tscn
@@ -1,20 +1,34 @@
[gd_scene load_steps=3 format=2]
-[ext_resource path="res://Grid.gd" type="Script" id=1]
-[ext_resource path="res://ui/GameUI.tscn" type="PackedScene" id=2]
+[ext_resource path="res://Board.gd" type="Script" id=1]
+[ext_resource path="res://ui/theme/main.tres" type="Theme" id=3]
-[node name="Board" type="Node2D"]
-
-[node name="Grid" type="Node2D" parent="."]
+[node name="Board" type="Control"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
script = ExtResource( 1 )
+__meta__ = {
+"_edit_group_": true
+}
-[node name="Background" type="Node2D" parent="Grid"]
+[node name="Background" type="Control" parent="."]
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
-[node name="Pieces" type="Node2D" parent="Grid"]
+[node name="Pieces" type="Control" parent="."]
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
-[node name="Foreground" type="CanvasLayer" parent="Grid"]
+[node name="Foreground" type="Control" parent="."]
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
+theme = ExtResource( 3 )
-[node name="Darken" type="ColorRect" parent="Grid"]
+[node name="Darken" type="ColorRect" parent="."]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
@@ -22,5 +36,3 @@ rect_min_size = Vector2( 800, 800 )
mouse_filter = 2
mouse_default_cursor_shape = 7
color = Color( 0, 0, 0, 0.784314 )
-
-[node name="UI" parent="." instance=ExtResource( 2 )]
diff --git a/Debug.gd b/Debug.gd
index f110d51..048d3fa 100644
--- a/Debug.gd
+++ b/Debug.gd
@@ -2,7 +2,7 @@ extends Node2D
var refs := [] # = [[ node : object, variable : string, (code : string) ]]
var style: StyleBox = load("res://ui/theme/transblack.tres")
-var font: Font = load("res://ui/verdana.tres")
+var font: Font = load("res://ui/verdana-bold.tres")
var debug := false
var timer := Timer.new()
var expr := Expression.new()
diff --git a/Game.gd b/Game.gd
new file mode 100644
index 0000000..c778382
--- /dev/null
+++ b/Game.gd
@@ -0,0 +1,11 @@
+extends Control
+
+onready var status: StatusLabel = $Holder/SidebarRight/VBox/Status
+
+
+func set_status(text: String, length := 5) -> void:
+ status.set_text(text, length)
+
+
+func get_board() -> Node:
+ return $Holder/middle/Board
diff --git a/Game.tscn b/Game.tscn
new file mode 100644
index 0000000..7a4c96b
--- /dev/null
+++ b/Game.tscn
@@ -0,0 +1,431 @@
+[gd_scene load_steps=51 format=2]
+
+[ext_resource path="res://Game.gd" type="Script" id=1]
+[ext_resource path="res://assets/ui/whitespace.png" type="Texture" id=2]
+[ext_resource path="res://ui/theme/transblack.tres" type="StyleBox" id=3]
+[ext_resource path="res://ui/FENlabel.gd" type="Script" id=4]
+[ext_resource path="res://ui/barbutton/resignbutton.gd" type="Script" id=5]
+[ext_resource path="res://ui/Status.gd" type="Script" id=6]
+[ext_resource path="res://ui/theme/flatblack.tres" type="StyleBox" id=7]
+[ext_resource path="res://ui/barbutton/BarTextureButton.tscn" type="PackedScene" id=8]
+[ext_resource path="res://ui/chat/Chat.tscn" type="PackedScene" id=9]
+[ext_resource path="res://ui/theme/main.tres" type="Theme" id=10]
+[ext_resource path="res://assets/ui/verdana-bold.ttf" type="DynamicFontData" id=11]
+[ext_resource path="res://ui/theme/buttonhover.tres" type="StyleBox" id=12]
+[ext_resource path="res://assets/ui/verdana.ttf" type="DynamicFontData" id=13]
+[ext_resource path="res://ui/theme/button.tres" type="StyleBox" id=14]
+[ext_resource path="res://assets/ui/button.png" type="Texture" id=15]
+[ext_resource path="res://assets/ui/checkedbox.png" type="Texture" id=16]
+[ext_resource path="res://assets/ui/CascadiaCode.ttf" type="DynamicFontData" id=17]
+[ext_resource path="res://assets/ui/verdana-bold-italic.ttf" type="DynamicFontData" id=18]
+[ext_resource path="res://ui/barbutton/drawbutton.gd" type="Script" id=19]
+[ext_resource path="res://ui/Timer.gd" type="Script" id=20]
+[ext_resource path="res://ui/TimerLabels.gd" type="Script" id=21]
+[ext_resource path="res://ui/sandisplay/SanDisplay.tscn" type="PackedScene" id=22]
+[ext_resource path="res://assets/ui/Roboto-Medium.ttf" type="DynamicFontData" id=23]
+[ext_resource path="res://ui/roboto.tres" type="DynamicFont" id=24]
+[ext_resource path="res://assets/ui/draw.png" type="Texture" id=25]
+[ext_resource path="res://assets/ui/flip_board.png" type="Texture" id=26]
+[ext_resource path="res://ui/barbutton/flipbutton.gd" type="Script" id=27]
+[ext_resource path="res://assets/ui/flag.png" type="Texture" id=28]
+[ext_resource path="res://Board.tscn" type="PackedScene" id=29]
+
+[sub_resource type="StyleBoxTexture" id=6]
+texture = ExtResource( 15 )
+region_rect = Rect2( 0, 0, 84, 84 )
+margin_left = 28.0
+margin_right = 28.0
+margin_top = 28.0
+margin_bottom = 28.0
+modulate_color = Color( 0.772549, 0.772549, 0.772549, 0.54902 )
+
+[sub_resource type="StyleBoxEmpty" id=7]
+
+[sub_resource type="StyleBoxEmpty" id=8]
+
+[sub_resource type="StyleBoxEmpty" id=9]
+
+[sub_resource type="StyleBoxEmpty" id=4]
+
+[sub_resource type="StyleBoxFlat" id=3]
+bg_color = Color( 0.0784314, 0.0784314, 0.0784314, 1 )
+border_width_left = 2
+border_width_top = 2
+border_width_right = 2
+border_width_bottom = 2
+border_color = Color( 1, 1, 1, 1 )
+corner_detail = 20
+expand_margin_left = 10.0
+expand_margin_right = 10.0
+
+[sub_resource type="DynamicFont" id=18]
+size = 20
+font_data = ExtResource( 11 )
+
+[sub_resource type="DynamicFont" id=19]
+size = 20
+font_data = ExtResource( 18 )
+
+[sub_resource type="DynamicFont" id=14]
+size = 20
+font_data = ExtResource( 17 )
+
+[sub_resource type="DynamicFont" id=20]
+size = 25
+font_data = ExtResource( 13 )
+
+[sub_resource type="StyleBoxFlat" id=10]
+content_margin_left = 30.0
+content_margin_right = 30.0
+content_margin_top = 30.0
+content_margin_bottom = 30.0
+bg_color = Color( 0, 0, 0, 0.313726 )
+border_blend = true
+corner_radius_top_left = 50
+corner_radius_top_right = 50
+corner_radius_bottom_right = 30
+corner_radius_bottom_left = 30
+corner_detail = 15
+
+[sub_resource type="StyleBoxFlat" id=12]
+content_margin_left = 10.0
+content_margin_right = 10.0
+bg_color = Color( 0, 0, 0, 0.313726 )
+border_width_left = 3
+border_width_top = 3
+border_width_right = 3
+border_width_bottom = 1
+border_color = Color( 0, 0, 0, 0.392157 )
+
+[sub_resource type="StyleBoxFlat" id=11]
+content_margin_left = 10.0
+content_margin_right = 10.0
+bg_color = Color( 0.188235, 0.188235, 0.188235, 1 )
+border_width_left = 3
+border_width_top = 3
+border_width_right = 3
+border_width_bottom = 1
+border_color = Color( 0, 0, 0, 0.392157 )
+
+[sub_resource type="StyleBoxEmpty" id=5]
+
+[sub_resource type="StyleBoxFlat" id=13]
+content_margin_left = 10.0
+content_margin_right = 10.0
+content_margin_bottom = 10.0
+bg_color = Color( 0, 0, 0, 0.588235 )
+border_width_top = 65
+border_color = Color( 0.180392, 0.180392, 0.180392, 1 )
+corner_radius_top_left = 30
+corner_radius_top_right = 30
+corner_radius_bottom_right = 30
+corner_radius_bottom_left = 30
+corner_detail = 15
+expand_margin_top = 65.0
+
+[sub_resource type="DynamicFont" id=15]
+size = 20
+font_data = ExtResource( 11 )
+
+[sub_resource type="Theme" id=16]
+default_font = SubResource( 15 )
+Button/colors/font_color = Color( 1, 1, 1, 1 )
+Button/colors/font_color_disabled = Color( 1, 1, 1, 0.305882 )
+Button/colors/font_color_focus = Color( 1, 1, 1, 1 )
+Button/colors/font_color_hover = Color( 0, 0, 0, 1 )
+Button/colors/font_color_pressed = Color( 1, 1, 1, 1 )
+Button/styles/disabled = SubResource( 6 )
+Button/styles/focus = ExtResource( 14 )
+Button/styles/hover = ExtResource( 12 )
+Button/styles/normal = ExtResource( 14 )
+Button/styles/pressed = ExtResource( 14 )
+CheckBox/icons/checked = ExtResource( 16 )
+CheckBox/icons/checked_disabled = null
+CheckBox/icons/radio_checked = null
+CheckBox/icons/radio_checked_disabled = null
+CheckBox/icons/radio_unchecked = null
+CheckBox/icons/radio_unchecked_disabled = null
+CheckBox/icons/unchecked = ExtResource( 15 )
+CheckBox/icons/unchecked_disabled = null
+ColorPicker/icons/color_sample = ExtResource( 2 )
+ColorPicker/icons/overbright_indicator = ExtResource( 2 )
+ColorPicker/icons/preset_bg = ExtResource( 2 )
+ColorPicker/icons/screen_picker = ExtResource( 2 )
+ColorPickerButton/colors/font_color = Color( 1, 1, 1, 1 )
+ColorPickerButton/colors/font_color_disabled = Color( 1, 1, 1, 0.301961 )
+ColorPickerButton/colors/font_color_focus = Color( 1, 1, 1, 1 )
+ColorPickerButton/colors/font_color_hover = Color( 1, 1, 1, 1 )
+ColorPickerButton/colors/font_color_pressed = Color( 0.913725, 0.913725, 0.913725, 1 )
+ColorPickerButton/icons/bg = ExtResource( 2 )
+HBoxContainer/constants/separation = 15
+HSlider/styles/grabber_area = SubResource( 7 )
+HSlider/styles/grabber_area_highlight = SubResource( 8 )
+HSlider/styles/slider = SubResource( 9 )
+ItemList/colors/font_color = Color( 1, 1, 1, 1 )
+ItemList/colors/font_color_selected = Color( 0.905882, 0.905882, 0.905882, 1 )
+ItemList/styles/bg = SubResource( 4 )
+ItemList/styles/bg_focus = ExtResource( 7 )
+LineEdit/colors/cursor_color = Color( 1, 1, 1, 1 )
+LineEdit/colors/font_color = Color( 1, 1, 1, 1 )
+LineEdit/colors/font_color_uneditable = Color( 1, 1, 1, 0.67451 )
+LineEdit/styles/focus = ExtResource( 14 )
+LineEdit/styles/normal = ExtResource( 14 )
+LineEdit/styles/read_only = ExtResource( 14 )
+OptionButton/colors/font_color = Color( 1, 1, 1, 1 )
+OptionButton/colors/font_color_focus = Color( 1, 1, 1, 1 )
+OptionButton/colors/font_color_hover = Color( 0, 0, 0, 1 )
+OptionButton/colors/font_color_pressed = Color( 1, 1, 1, 1 )
+OptionButton/icons/arrow = ExtResource( 2 )
+PopupMenu/colors/font_color = Color( 1, 1, 1, 1 )
+PopupMenu/colors/font_color_accel = Color( 1, 1, 1, 0.8 )
+PopupMenu/colors/font_color_hover = Color( 1, 1, 1, 1 )
+PopupMenu/colors/font_color_separator = Color( 0.262745, 0.262745, 0.262745, 1 )
+PopupMenu/icons/radio_checked = ExtResource( 2 )
+PopupMenu/icons/radio_unchecked = ExtResource( 2 )
+PopupMenu/styles/hover = SubResource( 3 )
+PopupMenu/styles/panel = ExtResource( 7 )
+PopupPanel/styles/panel = ExtResource( 3 )
+RichTextLabel/colors/default_color = Color( 1, 1, 1, 1 )
+RichTextLabel/fonts/bold_font = SubResource( 18 )
+RichTextLabel/fonts/bold_italics_font = SubResource( 19 )
+RichTextLabel/fonts/italics_font = SubResource( 19 )
+RichTextLabel/fonts/mono_font = SubResource( 14 )
+RichTextLabel/fonts/normal_font = SubResource( 20 )
+SpinBox/icons/updown = ExtResource( 2 )
+TabContainer/colors/font_color_bg = Color( 0.709804, 0.709804, 0.709804, 0.72549 )
+TabContainer/colors/font_color_fg = Color( 1, 1, 1, 1 )
+TabContainer/styles/panel = SubResource( 10 )
+TabContainer/styles/tab_bg = SubResource( 12 )
+TabContainer/styles/tab_fg = SubResource( 11 )
+VBoxContainer/constants/separation = 15
+VScrollBar/styles/scroll = SubResource( 5 )
+WindowDialog/colors/title_color = Color( 1, 1, 1, 1 )
+WindowDialog/constants/close_h_ofs = 0
+WindowDialog/constants/close_v_ofs = 0
+WindowDialog/constants/title_height = 60
+WindowDialog/icons/close = ExtResource( 2 )
+WindowDialog/icons/close_highlight = ExtResource( 2 )
+WindowDialog/styles/panel = SubResource( 13 )
+
+[sub_resource type="DynamicFont" id=1]
+size = 35
+font_data = ExtResource( 23 )
+
+[sub_resource type="StyleBoxFlat" id=21]
+bg_color = Color( 0, 0, 0, 1 )
+
+[sub_resource type="DynamicFont" id=22]
+size = 15
+font_data = ExtResource( 23 )
+
+[sub_resource type="DynamicFont" id=23]
+size = 40
+font_data = ExtResource( 23 )
+
+[node name="Game" type="Control"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
+script = ExtResource( 1 )
+
+[node name="Holder" type="HBoxContainer" parent="."]
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
+theme = ExtResource( 10 )
+custom_constants/separation = 0
+
+[node name="Spacer" type="Control" parent="Holder"]
+margin_right = 300.0
+margin_bottom = 800.0
+rect_min_size = Vector2( 300, 0 )
+mouse_filter = 2
+theme = SubResource( 16 )
+
+[node name="middle" type="VBoxContainer" parent="Holder"]
+margin_left = 300.0
+margin_right = 940.0
+margin_bottom = 800.0
+rect_min_size = Vector2( 640, 640 )
+mouse_filter = 2
+custom_constants/separation = 0
+
+[node name="Board" parent="Holder/middle" instance=ExtResource( 29 )]
+anchor_right = 0.0
+anchor_bottom = 0.0
+margin_right = 640.0
+margin_bottom = 640.0
+rect_min_size = Vector2( 640, 640 )
+status = NodePath("../../SidebarRight/VBox/Status")
+
+[node name="Chat" parent="Holder/middle" instance=ExtResource( 9 )]
+anchor_right = 0.0
+anchor_bottom = 0.0
+margin_top = 640.0
+margin_right = 640.0
+margin_bottom = 800.0
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
+[node name="SidebarRight" type="ColorRect" parent="Holder"]
+margin_left = 940.0
+margin_right = 1422.0
+margin_bottom = 800.0
+rect_min_size = Vector2( 300, 0 )
+size_flags_horizontal = 3
+color = Color( 0.141176, 0.141176, 0.141176, 0.784314 )
+
+[node name="VBox" type="VBoxContainer" parent="Holder/SidebarRight"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+alignment = 1
+__meta__ = {
+"_edit_lock_": true
+}
+
+[node name="BlackTime" type="Label" parent="Holder/SidebarRight/VBox"]
+visible = false
+margin_top = 218.0
+margin_right = 624.0
+margin_bottom = 301.0
+custom_fonts/font = ExtResource( 24 )
+text = "00:00.0"
+align = 1
+valign = 1
+script = ExtResource( 21 )
+__meta__ = {
+"_edit_group_": true,
+"_edit_lock_": true
+}
+
+[node name="ColorRect" type="ColorRect" parent="Holder/SidebarRight/VBox/BlackTime"]
+show_behind_parent = true
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_left = 72.0
+margin_right = -72.0
+color = Color( 0, 0, 0, 1 )
+
+[node name="MovesList" parent="Holder/SidebarRight/VBox" instance=ExtResource( 22 )]
+margin_top = 239.0
+margin_right = 482.0
+margin_bottom = 439.0
+
+[node name="Status" type="Label" parent="Holder/SidebarRight/VBox"]
+margin_top = 454.0
+margin_right = 482.0
+margin_bottom = 496.0
+custom_fonts/font = SubResource( 1 )
+align = 1
+autowrap = true
+script = ExtResource( 6 )
+
+[node name="buttonbarholder" type="Control" parent="Holder/SidebarRight/VBox"]
+margin_top = 511.0
+margin_right = 482.0
+margin_bottom = 561.0
+rect_min_size = Vector2( 50, 50 )
+__meta__ = {
+"_edit_group_": true,
+"_edit_lock_": true
+}
+
+[node name="Panel" type="Panel" parent="Holder/SidebarRight/VBox/buttonbarholder"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+custom_styles/panel = SubResource( 21 )
+
+[node name="buttonbar" type="HBoxContainer" parent="Holder/SidebarRight/VBox/buttonbarholder"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+custom_constants/separation = 0
+alignment = 1
+
+[node name="FlipBoard" parent="Holder/SidebarRight/VBox/buttonbarholder/buttonbar" instance=ExtResource( 8 )]
+margin_left = 166.0
+margin_right = 216.0
+texture_normal = ExtResource( 26 )
+script = ExtResource( 27 )
+
+[node name="DrawButton" parent="Holder/SidebarRight/VBox/buttonbarholder/buttonbar" instance=ExtResource( 8 )]
+margin_left = 216.0
+margin_right = 266.0
+texture_normal = ExtResource( 25 )
+script = ExtResource( 19 )
+status = NodePath("../../../Status")
+
+[node name="ResignButton" parent="Holder/SidebarRight/VBox/buttonbarholder/buttonbar" instance=ExtResource( 8 )]
+margin_left = 266.0
+margin_right = 316.0
+texture_normal = ExtResource( 28 )
+script = ExtResource( 5 )
+status = NodePath("../../../Status")
+
+[node name="WhiteTime" type="Label" parent="Holder/SidebarRight/VBox"]
+visible = false
+margin_top = 498.0
+margin_right = 624.0
+margin_bottom = 581.0
+custom_fonts/font = ExtResource( 24 )
+text = "00:00.0"
+align = 1
+valign = 1
+script = ExtResource( 21 )
+__meta__ = {
+"_edit_group_": true,
+"_edit_lock_": true
+}
+white = true
+
+[node name="ColorRect" type="ColorRect" parent="Holder/SidebarRight/VBox/WhiteTime"]
+show_behind_parent = true
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_left = 72.0
+margin_right = -72.0
+color = Color( 0, 0, 0, 1 )
+
+[node name="Timer" type="Node" parent="Holder/SidebarRight/VBox"]
+script = ExtResource( 20 )
+
+[node name="Spacer" type="Control" parent="Holder/SidebarRight/VBox"]
+visible = false
+margin_top = 530.0
+margin_right = 624.0
+margin_bottom = 550.0
+rect_min_size = Vector2( 0, 20 )
+
+[node name="FENlabel" type="LineEdit" parent="Holder/SidebarRight/VBox"]
+visible = false
+margin_left = 58.0
+margin_top = 503.0
+margin_right = 566.0
+margin_bottom = 577.0
+size_flags_horizontal = 4
+custom_colors/font_color_uneditable = Color( 1, 1, 1, 1 )
+custom_fonts/font = SubResource( 22 )
+text = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
+align = 1
+editable = false
+expand_to_text_length = true
+context_menu_enabled = false
+placeholder_text = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
+caret_blink = true
+caret_blink_speed = 0.5
+script = ExtResource( 4 )
+
+[node name="Label" type="Label" parent="Holder/SidebarRight/VBox/FENlabel"]
+margin_top = -49.0
+margin_right = 508.0
+margin_bottom = 11.0
+custom_fonts/font = SubResource( 23 )
+text = "fen"
+align = 1
+valign = 2
+
+[node name="Darken" type="ColorRect" parent="."]
+visible = false
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_right = -400.0
+color = Color( 0, 0, 0, 0.784314 )
diff --git a/PGN/test_pgns.gd b/PGN/test_pgns.gd
index d46d4ff..3144beb 100644
--- a/PGN/test_pgns.gd
+++ b/PGN/test_pgns.gd
@@ -12,15 +12,16 @@ func _ready():
func _load(i: int):
in_sim = true
- var boar = load("res://Board.tscn").instance()
+ var boar = load("res://Game.tscn").instance()
get_tree().get_root().add_child(boar)
- boar.get_node("Grid").play_pgn(pgns[i])
+ boar = boar.get_board()
+ boar.play_pgn(pgns[i])
get_parent().hide()
func _input(_event):
if Input.is_action_pressed("ui_cancel") and in_sim:
in_sim = false
- get_node("/root/Board").queue_free()
+ get_node("/root/Game").queue_free()
get_parent().show()
Globals.reset_vars()
diff --git a/Piece.tscn b/Piece.tscn
index 1f64fc9..c70b4d4 100644
--- a/Piece.tscn
+++ b/Piece.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=9 format=2]
+[gd_scene load_steps=8 format=2]
[ext_resource path="res://pieces/Piece.gd" type="Script" id=1]
[ext_resource path="res://assets/pieces/california/wP.png" type="Texture" id=2]
@@ -9,7 +9,7 @@ resource_name = "Move"
length = 0.3
step = 0.05
tracks/0/type = "value"
-tracks/0/path = NodePath("Sprite:scale")
+tracks/0/path = NodePath(".:rect_scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
@@ -20,8 +20,8 @@ tracks/0/keys = {
"update": 0,
"values": [ Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1.15, 1.15 ), Vector2( 1, 1 ) ]
}
-tracks/1/type = "value"
-tracks/1/path = NodePath("Sprite:z_index")
+tracks/1/type = "method"
+tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
@@ -29,31 +29,21 @@ tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.3 ),
"transitions": PoolRealArray( 1, 1 ),
-"update": 1,
-"values": [ 1, 0 ]
-}
-
-[sub_resource type="Animation" id=3]
-length = 0.001
-tracks/0/type = "value"
-tracks/0/path = NodePath("Sprite:z_index")
-tracks/0/interp = 1
-tracks/0/loop_wrap = true
-tracks/0/imported = false
-tracks/0/enabled = true
-tracks/0/keys = {
-"times": PoolRealArray( 0 ),
-"transitions": PoolRealArray( 1 ),
-"update": 0,
-"values": [ 0 ]
+"values": [ {
+"args": [ 1 ],
+"method": "set_zindex"
+}, {
+"args": [ 0 ],
+"method": "set_zindex"
+} ]
}
[sub_resource type="Animation" id=2]
-resource_name = "Take"
+resource_name = "Took"
length = 0.3
step = 0.05
tracks/0/type = "value"
-tracks/0/path = NodePath("Sprite:scale")
+tracks/0/path = NodePath(".:rect_scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
@@ -84,7 +74,7 @@ resource_name = "Left"
length = 0.4
step = 0.05
tracks/0/type = "value"
-tracks/0/path = NodePath("Sprite:rotation_degrees")
+tracks/0/path = NodePath(".:rect_rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
@@ -101,7 +91,7 @@ resource_name = "Right"
length = 0.4
step = 0.05
tracks/0/type = "value"
-tracks/0/path = NodePath("Sprite:rotation_degrees")
+tracks/0/path = NodePath(".:rect_rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
@@ -113,30 +103,40 @@ tracks/0/keys = {
"values": [ 0.0, 20.0, 0.0 ]
}
-[node name="Piece" type="Node2D"]
+[node name="Piece" type="Control"]
+margin_right = 100.0
+margin_bottom = 100.0
+rect_pivot_offset = Vector2( 50, 50 )
+mouse_filter = 2
script = ExtResource( 1 )
[node name="ColorRect" type="ColorRect" parent="."]
visible = false
-margin_right = 96.0
-margin_bottom = 96.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
color = Color( 0.2, 0.345098, 0.188235, 0.592157 )
-[node name="Sprite" type="Sprite" parent="."]
-position = Vector2( 50, 50 )
+[node name="Sprite" type="TextureRect" parent="."]
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
texture = ExtResource( 2 )
+expand = true
-[node name="Frame" type="Sprite" parent="."]
+[node name="Frame" type="TextureRect" parent="Sprite"]
visible = false
-position = Vector2( 50, 50 )
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
texture = ExtResource( 3 )
+expand = true
[node name="Tween" type="Tween" parent="."]
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/Move = SubResource( 1 )
-anims/RESET = SubResource( 3 )
-anims/Take = SubResource( 2 )
+anims/Took = SubResource( 2 )
[node name="RotatePlayer" type="AnimationPlayer" parent="."]
anims/Left = SubResource( 6 )
diff --git a/Square.gd b/Square.gd
index 1028a72..89b7071 100644
--- a/Square.gd
+++ b/Square.gd
@@ -1,28 +1,25 @@
extends ColorRect
-var real_position := Vector2()
-var circle_on := false
+signal clicked
-onready var area := $Squarea
-onready var areacollisionshape := $Squarea/CollisionShape2D
-onready var circle := $Circle
+var circle_on := false
-signal clicked
+onready var circle := $CircleHolder/Circle
func _ready() -> void:
- circle.position = Globals.grid.piece_size / 2
+ circle.rect_min_size = Globals.grid.piece_size / 4
circle.material.set_shader_param("color", Globals.grid.overlay_color)
circle.visible = false
- areacollisionshape.global_position += Globals.grid.piece_size / 2
- areacollisionshape.shape.extents = Vector2(rect_size.x / 2, rect_size.y / 2)
-
-
-func _on_Squarea_input_event(_viewport: Node, _event: InputEvent, _shape_idx: int) -> void:
- if Input.is_action_just_pressed("click"):
- emit_signal("clicked", real_position)
+ rect_min_size = Globals.grid.piece_size
+ rect_size = rect_min_size
func set_circle(boolean: bool) -> void:
circle_on = boolean
circle.visible = boolean
+
+
+func _gui_input(event: InputEvent):
+ if event is InputEventMouseButton and Input.is_action_pressed("click"):
+ emit_signal("clicked")
diff --git a/Square.tscn b/Square.tscn
index 0a6d13a..de3771e 100644
--- a/Square.tscn
+++ b/Square.tscn
@@ -1,33 +1,8 @@
-[gd_scene load_steps=6 format=2]
+[gd_scene load_steps=5 format=2]
[ext_resource path="res://Square.gd" type="Script" id=1]
[ext_resource path="res://assets/ui/whitespace.png" type="Texture" id=2]
-[sub_resource type="RectangleShape2D" id=1]
-
-[sub_resource type="Shader" id=2]
-code = "shader_type canvas_item;
-
-uniform float amt : hint_range(0.0, 1.0);
-uniform vec4 color : hint_color;
-
-void fragment()
-{
- if (distance(UV, vec2(0.5,0.5)) > amt/2.0)
- {
- COLOR = vec4(0.0);
- }
- else
- {
- COLOR = vec4(color);
- }
-}"
-
-[sub_resource type="ShaderMaterial" id=3]
-shader = SubResource( 2 )
-shader_param/amt = 1.0
-shader_param/color = Color( 0.431373, 0.584314, 0.388235, 0.639216 )
-
[sub_resource type="Shader" id=2]
code = "shader_type canvas_item;
@@ -56,24 +31,19 @@ anchor_right = 1.0
anchor_bottom = 1.0
margin_right = -1180.0
margin_bottom = -780.0
-mouse_filter = 2
script = ExtResource( 1 )
-[node name="Squarea" type="Area2D" parent="."]
-collision_mask = 0
-monitoring = false
-monitorable = false
-
-[node name="CollisionShape2D" type="CollisionShape2D" parent="Squarea"]
-visible = false
-z_index = 3
-shape = SubResource( 1 )
+[node name="CircleHolder" type="CenterContainer" parent="."]
+anchor_right = 1.0
+anchor_bottom = 1.0
+mouse_filter = 2
-[node name="Circle" type="Sprite" parent="."]
-visible = false
+[node name="Circle" type="TextureRect" parent="CircleHolder"]
material = SubResource( 3 )
-position = Vector2( 8, 8 )
-scale = Vector2( 25, 25 )
+margin_left = 121.0
+margin_top = 10.0
+margin_right = 121.0
+margin_bottom = 10.0
+mouse_filter = 2
texture = ExtResource( 2 )
-
-[connection signal="input_event" from="Squarea" to="." method="_on_Squarea_input_event"]
+expand = true
diff --git a/assets/ui/CascadiaCode.ttf b/assets/ui/CascadiaCode.ttf
new file mode 100644
index 0000000..fc7474a
--- /dev/null
+++ b/assets/ui/CascadiaCode.ttf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7393592c0e0d7f3cdc225c2e03b2aadabab67000bb1a4afe7eca02ff4a782263
+size 648736
diff --git a/assets/ui/send.png b/assets/ui/send.png
new file mode 100644
index 0000000..2ff693e
--- /dev/null
+++ b/assets/ui/send.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:47b73fd963b169dd067d6339613a4d863ac80f11c14afaa016261ae99394a517
+size 5423
diff --git a/assets/ui/send.png.import b/assets/ui/send.png.import
new file mode 100644
index 0000000..d6cb571
--- /dev/null
+++ b/assets/ui/send.png.import
@@ -0,0 +1,35 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/send.png-89ee65caa60422a1523bacb50bebdc8d.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/ui/send.png"
+dest_files=[ "res://.import/send.png-89ee65caa60422a1523bacb50bebdc8d.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+process/normal_map_invert_y=false
+stream=false
+size_limit=0
+detect_3d=false
+svg/scale=1.0
diff --git a/assets/ui/svg/send.svg b/assets/ui/svg/send.svg
new file mode 100644
index 0000000..2d307ae
--- /dev/null
+++ b/assets/ui/svg/send.svg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:67715db1ed261ed7fb47e4c624130c200b69f0fba100bba1356271eafdcec268
+size 1708
diff --git a/assets/ui/verdana-bold-italic.ttf b/assets/ui/verdana-bold-italic.ttf
new file mode 100644
index 0000000..a697a86
--- /dev/null
+++ b/assets/ui/verdana-bold-italic.ttf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2c5aa27b62da26f432406852303acad6fdc9121b73f468c75fae33ade799ea81
+size 226848
diff --git a/assets/ui/verdana.ttf b/assets/ui/verdana.ttf
new file mode 100644
index 0000000..30d4374
--- /dev/null
+++ b/assets/ui/verdana.ttf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:886eedb1df75504d383d10cc40404e56f6361be50e50986d7568ba94ea43cac3
+size 149752
diff --git a/networking/Network.gd b/networking/Network.gd
index 76df375..4e6c329 100644
--- a/networking/Network.gd
+++ b/networking/Network.gd
@@ -37,6 +37,7 @@ signal join_result(result)
signal game_over(problem, isok)
signal connection_established
signal signal_recieved(what)
+signal chat(text)
## for accounts(mostly)
signal signinresult(what)
@@ -113,6 +114,8 @@ func stopgame(reason: String) -> void:
func _data_recieved() -> void:
+ if !OS.is_window_focused():
+ OS.request_attention()
var recieve: Dictionary = ws.get_peer(1).get_var()
var header: String = recieve.header
var text = recieve.data
@@ -121,8 +124,11 @@ func _data_recieved() -> void:
emit_signal("host_result", text)
HEADERS.relay:
var relay: Dictionary = text
- if relay.type in MOVEHEADERS.values():
- emit_signal("move_data", text.move)
+ match relay.type:
+ RELAYHEADERS.chat:
+ emit_signal("chat", relay.body)
+ MOVEHEADERS.move:
+ emit_signal("move_data", text.move)
HEADERS.joinrequest:
emit_signal("join_result", text)
HEADERS.loadpgn:
diff --git a/networking/PacketHandler.gd b/networking/PacketHandler.gd
index 5529643..2d5628a 100644
--- a/networking/PacketHandler.gd
+++ b/networking/PacketHandler.gd
@@ -75,8 +75,8 @@ func handle_result(accepted: String, resultstring: String, team := true) -> bool
func _handle_game_over(error := "game over", isok := true) -> void:
Globals.network.stopgame(error)
Globals.reset_vars()
- if has_node("/root/Board"):
- get_node("/root/Board").queue_free()
+ if has_node("/root/Game"):
+ get_node("/root/Game").queue_free()
lobby.set_status(error, isok)
lobby.toggle(true)
lobby.set_buttons(true)
@@ -85,7 +85,7 @@ func _handle_game_over(error := "game over", isok := true) -> void:
func _start_game() -> void:
set_hosting(false)
- var board: Node2D = load("res://Board.tscn").instance()
+ var board: Control = load("res://Game.tscn").instance()
get_tree().get_root().add_child(board)
lobby.toggle(false)
emit_signal("game_started")
diff --git a/pieces/Pawn.gd b/pieces/Pawn.gd
index 0c44a70..e09d8e1 100644
--- a/pieces/Pawn.gd
+++ b/pieces/Pawn.gd
@@ -19,10 +19,10 @@ func _ready() -> void:
Globals.pawns.append(self)
Events.connect("turn_over", self, "_on_turn_over")
Events.connect("just_before_turn_over", self, "_just_before_turn_over")
- sprite.position = Globals.grid.piece_size / 2
for i in range(0, 4): # add 3 sprites
var newsprite: Node2D = load("res://ui/ClickableSprite.tscn").instance()
- newsprite.position = (sprite.position + Vector2(0, (i * Globals.grid.piece_size.y) * whiteint))
+ newsprite.scale = Globals.grid.piece_size / Vector2(100, 100)
+ newsprite.position = (Globals.grid.piece_size / 2 + Vector2(0, (i * Globals.grid.piece_size.y) * whiteint))
newsprite.get_node("Sprite").texture = load(
"%s%s%s.png" % [Globals.grid.ASSETS_PATH, team.to_lower(), promotables[i]]
)
diff --git a/pieces/Piece.gd b/pieces/Piece.gd
index 55d680d..22a6d84 100644
--- a/pieces/Piece.gd
+++ b/pieces/Piece.gd
@@ -1,4 +1,4 @@
-extends Node2D
+extends Control
class_name Piece, "res://assets/pieces/california/wP.png"
var real_position := Vector2.ZERO
@@ -14,22 +14,26 @@ onready var tween := $Tween
onready var anim := $AnimationPlayer
onready var rotate := $RotatePlayer
onready var colorrect := $ColorRect
-onready var frame := $Frame
+onready var frame := $Sprite/Frame
func _ready() -> void:
team = "w" if white else "b"
- sprite.position = Globals.grid.piece_size / 2
var tmp: Array = Utils.get_node_name(self)
mininame = tmp[0]
shortname = tmp[1]
- frame.position = Globals.grid.piece_size / 2
+ rect_min_size = Globals.grid.piece_size
+ rect_size = rect_min_size
+ rect_pivot_offset = Globals.grid.piece_size / 2
frame.modulate = Globals.grid.overlay_color
colorrect.color = Globals.grid.overlay_color
- colorrect.rect_size = Globals.grid.piece_size
load_texture()
+func set_zindex(zindex: int):
+ VisualServer.canvas_item_set_z_index(get_canvas_item(), zindex)
+
+
func load_texture(path := "%s%s%s.png" % [Globals.grid.ASSETS_PATH, team, shortname.to_upper()]) -> void:
sprite.texture = load(path)
@@ -45,19 +49,11 @@ func clear_clicked() -> void:
Globals.grid.clear_fx()
-func algebraic_take_notation(position: Vector2, startpos: Vector2 = real_position) -> String:
- var starter := shortname if shortname != "p" else Utils.to_algebraic(startpos)[0]
- return starter + "x" + Utils.to_algebraic(position)
-
-
-func algebraic_move_notation(position: Vector2) -> String:
- var starter := shortname if shortname != "p" else ""
- return starter + Utils.to_algebraic(position)
-
-
func move(newpos: Vector2) -> void: # dont use directly; use moveto
- tween.interpolate_property(self, "position", position, newpos * Globals.grid.piece_size, 0.3, Tween.TRANS_BACK)
- var signresult := int(sign(newpos.x * Globals.grid.piece_size.x - global_position.x))
+ tween.interpolate_property(
+ self, "rect_position", rect_position, newpos * Globals.grid.piece_size, 0.3, Tween.TRANS_BACK
+ )
+ var signresult := int(sign((newpos.x * Globals.grid.piece_size.x) - rect_global_position.x))
if signresult == 1:
rotate.play("Right")
elif signresult == -1:
@@ -209,7 +205,7 @@ func took(instant := false) -> void: # called when piece is taken
Globals.grid.matrix[real_position.y][real_position.x] = null
if !instant:
SoundFx.play("Capture")
- anim.play("Take")
+ anim.play("Took")
func set_frame(value := true) -> void:
diff --git a/project.godot b/project.godot
index e0b53df..8fbd1f1 100644
--- a/project.godot
+++ b/project.godot
@@ -54,10 +54,10 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://ui/barbutton/flipbutton.gd"
}, {
-"base": "Node2D",
+"base": "Control",
"class": "Grid",
"language": "GDScript",
-"path": "res://Grid.gd"
+"path": "res://Board.gd"
}, {
"base": "Control",
"class": "HueSlider",
@@ -109,7 +109,7 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://pieces/Pawn.gd"
}, {
-"base": "Node2D",
+"base": "Control",
"class": "Piece",
"language": "GDScript",
"path": "res://pieces/Piece.gd"
@@ -228,7 +228,7 @@ gdscript/warnings/return_value_discarded=false
window/size/width=1422
window/size/height=800
window/stretch/mode="2d"
-window/stretch/aspect="keep"
+window/stretch/aspect="expand"
[editor]
diff --git a/saveload.gd b/saveload.gd
index 455cc70..4634fb4 100644
--- a/saveload.gd
+++ b/saveload.gd
@@ -22,6 +22,12 @@ var files := {
} # file types
+func access_data(type: String) -> Dictionary:
+ if !files.has(type):
+ return {}
+ return files[type].data
+
+
func _ready() -> void:
# Debug.monitor(self, "id data", "files.id.data")
SaveLoad.load_data("settings")
@@ -32,7 +38,7 @@ func to_base64(variant) -> String:
return Marshalls.variant_to_base64(variant)
-func from_base64(base64):
+func from_base64(base64: String):
return Marshalls.base64_to_variant(base64)
diff --git a/ui/ClickableSprite.gd b/ui/ClickableSprite.gd
index 1d16d61..5dcf854 100644
--- a/ui/ClickableSprite.gd
+++ b/ui/ClickableSprite.gd
@@ -20,4 +20,4 @@ func _on_Area2D_mouse_entered() -> void:
func _on_Area2D_mouse_exited() -> void:
- sprite.scale = Vector2(.8, .8)
+ sprite.scale = Vector2(.9, .9)
diff --git a/ui/GameUI.gd b/ui/GameUI.gd
deleted file mode 100644
index dd4a737..0000000
--- a/ui/GameUI.gd
+++ /dev/null
@@ -1,7 +0,0 @@
-extends CanvasLayer
-
-onready var status: StatusLabel = $Holder/Back/VBox/Status
-
-
-func set_status(text: String, length := 5) -> void:
- status.set_text(text, length)
diff --git a/ui/GameUI.tscn b/ui/GameUI.tscn
deleted file mode 100644
index 497a4f1..0000000
--- a/ui/GameUI.tscn
+++ /dev/null
@@ -1,208 +0,0 @@
-[gd_scene load_steps=21 format=2]
-
-[ext_resource path="res://ui/theme/main.tres" type="Theme" id=1]
-[ext_resource path="res://ui/roboto.tres" type="DynamicFont" id=2]
-[ext_resource path="res://assets/ui/Roboto-Medium.ttf" type="DynamicFontData" id=3]
-[ext_resource path="res://ui/TimerLabels.gd" type="Script" id=4]
-[ext_resource path="res://ui/Timer.gd" type="Script" id=5]
-[ext_resource path="res://ui/sandisplay/SanDisplay.tscn" type="PackedScene" id=6]
-[ext_resource path="res://ui/Status.gd" type="Script" id=7]
-[ext_resource path="res://ui/barbutton/drawbutton.gd" type="Script" id=8]
-[ext_resource path="res://assets/ui/draw.png" type="Texture" id=9]
-[ext_resource path="res://ui/GameUI.gd" type="Script" id=10]
-[ext_resource path="res://ui/barbutton/resignbutton.gd" type="Script" id=13]
-[ext_resource path="res://ui/FENlabel.gd" type="Script" id=15]
-[ext_resource path="res://ui/barbutton/BarTextureButton.tscn" type="PackedScene" id=16]
-[ext_resource path="res://assets/ui/flip_board.png" type="Texture" id=17]
-[ext_resource path="res://ui/barbutton/flipbutton.gd" type="Script" id=18]
-[ext_resource path="res://assets/ui/flag.png" type="Texture" id=19]
-
-[sub_resource type="DynamicFont" id=1]
-size = 35
-font_data = ExtResource( 3 )
-
-[sub_resource type="StyleBoxFlat" id=10]
-bg_color = Color( 0, 0, 0, 1 )
-
-[sub_resource type="DynamicFont" id=8]
-size = 15
-font_data = ExtResource( 3 )
-
-[sub_resource type="DynamicFont" id=9]
-size = 40
-font_data = ExtResource( 3 )
-
-[node name="GameUI" type="CanvasLayer"]
-script = ExtResource( 10 )
-
-[node name="Holder" type="Control" parent="."]
-anchor_left = 1.0
-anchor_right = 1.0
-anchor_bottom = 1.0
-margin_left = -622.0
-margin_right = 2.0
-theme = ExtResource( 1 )
-__meta__ = {
-"_edit_lock_": true
-}
-
-[node name="Back" type="ColorRect" parent="Holder"]
-anchor_right = 1.0
-anchor_bottom = 1.0
-color = Color( 0.141176, 0.141176, 0.141176, 0.784314 )
-__meta__ = {
-"_edit_lock_": true
-}
-
-[node name="VBox" type="VBoxContainer" parent="Holder/Back"]
-anchor_right = 1.0
-anchor_bottom = 1.0
-alignment = 1
-__meta__ = {
-"_edit_lock_": true
-}
-
-[node name="BlackTime" type="Label" parent="Holder/Back/VBox"]
-visible = false
-margin_top = 218.0
-margin_right = 624.0
-margin_bottom = 301.0
-custom_fonts/font = ExtResource( 2 )
-text = "00:00.0"
-align = 1
-valign = 1
-script = ExtResource( 4 )
-__meta__ = {
-"_edit_group_": true,
-"_edit_lock_": true
-}
-
-[node name="ColorRect" type="ColorRect" parent="Holder/Back/VBox/BlackTime"]
-show_behind_parent = true
-anchor_right = 1.0
-anchor_bottom = 1.0
-margin_left = 72.0
-margin_right = -72.0
-color = Color( 0, 0, 0, 1 )
-
-[node name="MovesList" parent="Holder/Back/VBox" instance=ExtResource( 6 )]
-margin_top = 239.0
-margin_right = 624.0
-margin_bottom = 439.0
-
-[node name="Status" type="Label" parent="Holder/Back/VBox"]
-margin_top = 454.0
-margin_right = 624.0
-margin_bottom = 496.0
-custom_fonts/font = SubResource( 1 )
-align = 1
-autowrap = true
-script = ExtResource( 7 )
-
-[node name="buttonbarholder" type="Control" parent="Holder/Back/VBox"]
-margin_top = 511.0
-margin_right = 624.0
-margin_bottom = 561.0
-rect_min_size = Vector2( 50, 50 )
-__meta__ = {
-"_edit_group_": true,
-"_edit_lock_": true
-}
-
-[node name="Panel" type="Panel" parent="Holder/Back/VBox/buttonbarholder"]
-anchor_right = 1.0
-anchor_bottom = 1.0
-custom_styles/panel = SubResource( 10 )
-
-[node name="buttonbar" type="HBoxContainer" parent="Holder/Back/VBox/buttonbarholder"]
-anchor_right = 1.0
-anchor_bottom = 1.0
-custom_constants/separation = 0
-alignment = 1
-
-[node name="FlipBoard" parent="Holder/Back/VBox/buttonbarholder/buttonbar" instance=ExtResource( 16 )]
-margin_left = 237.0
-margin_right = 287.0
-texture_normal = ExtResource( 17 )
-script = ExtResource( 18 )
-
-[node name="DrawButton" parent="Holder/Back/VBox/buttonbarholder/buttonbar" instance=ExtResource( 16 )]
-margin_left = 287.0
-margin_right = 337.0
-texture_normal = ExtResource( 9 )
-script = ExtResource( 8 )
-status = NodePath("../../../Status")
-
-[node name="ResignButton" parent="Holder/Back/VBox/buttonbarholder/buttonbar" instance=ExtResource( 16 )]
-margin_left = 337.0
-margin_right = 387.0
-texture_normal = ExtResource( 19 )
-script = ExtResource( 13 )
-status = NodePath("../../../Status")
-
-[node name="WhiteTime" type="Label" parent="Holder/Back/VBox"]
-visible = false
-margin_top = 498.0
-margin_right = 624.0
-margin_bottom = 581.0
-custom_fonts/font = ExtResource( 2 )
-text = "00:00.0"
-align = 1
-valign = 1
-script = ExtResource( 4 )
-__meta__ = {
-"_edit_group_": true,
-"_edit_lock_": true
-}
-white = true
-
-[node name="ColorRect" type="ColorRect" parent="Holder/Back/VBox/WhiteTime"]
-show_behind_parent = true
-anchor_right = 1.0
-anchor_bottom = 1.0
-margin_left = 72.0
-margin_right = -72.0
-color = Color( 0, 0, 0, 1 )
-
-[node name="Timer" type="Node" parent="Holder/Back/VBox"]
-script = ExtResource( 5 )
-
-[node name="Spacer" type="Control" parent="Holder/Back/VBox"]
-visible = false
-margin_top = 530.0
-margin_right = 624.0
-margin_bottom = 550.0
-rect_min_size = Vector2( 0, 20 )
-
-[node name="FENlabel" type="LineEdit" parent="Holder/Back/VBox"]
-visible = false
-margin_left = 58.0
-margin_top = 503.0
-margin_right = 566.0
-margin_bottom = 577.0
-size_flags_horizontal = 4
-custom_colors/font_color_uneditable = Color( 1, 1, 1, 1 )
-custom_fonts/font = SubResource( 8 )
-text = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
-align = 1
-editable = false
-expand_to_text_length = true
-context_menu_enabled = false
-placeholder_text = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
-script = ExtResource( 15 )
-
-[node name="Label" type="Label" parent="Holder/Back/VBox/FENlabel"]
-margin_top = -49.0
-margin_right = 508.0
-margin_bottom = 11.0
-custom_fonts/font = SubResource( 9 )
-text = "fen"
-align = 1
-valign = 2
-
-[node name="Darken" type="ColorRect" parent="."]
-visible = false
-anchor_right = 1.0
-anchor_bottom = 1.0
-margin_right = -400.0
-color = Color( 0, 0, 0, 0.784314 )
diff --git a/ui/StartMenu.gd b/ui/StartMenu.gd
index 78ab03f..7c3a901 100644
--- a/ui/StartMenu.gd
+++ b/ui/StartMenu.gd
@@ -1,7 +1,5 @@
extends Control
-const world = preload("res://Board.tscn")
-
onready var settings := find_node("Settings")
@@ -10,10 +8,6 @@ func _ready() -> void:
find_node("quit").queue_free()
-func _on_local_pressed() -> void:
- get_tree().change_scene_to(world)
-
-
func _on_quit_pressed() -> void:
get_tree().notification(MainLoop.NOTIFICATION_WM_QUIT_REQUEST)
diff --git a/ui/account/Account.gd b/ui/account/Account.gd
index 4843e02..574a15b 100644
--- a/ui/account/Account.gd
+++ b/ui/account/Account.gd
@@ -15,6 +15,7 @@ var autologin = true
onready var tabcontainer = $choose
+
func _ready():
Globals.network.connect("signinresult", self, "_on_signin_result")
Globals.network.connect("signupresult", self, "_on_signup_result")
@@ -30,6 +31,7 @@ func attempt_autologin():
else:
tabcontainer.show()
+
func _on_signin_pressed():
$choose/signin/signinbutton.disabled = true
update_data(tabs.signin.username, tabs.signin.pw)
diff --git a/ui/account/Account.tscn b/ui/account/Account.tscn
index 04dba2c..0e7b302 100644
--- a/ui/account/Account.tscn
+++ b/ui/account/Account.tscn
@@ -3,7 +3,7 @@
[ext_resource path="res://assets/ui/verdana-bold.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://assets/ui/Roboto-Medium.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://ui/theme/main.tres" type="Theme" id=3]
-[ext_resource path="res://ui/verdana.tres" type="DynamicFont" id=4]
+[ext_resource path="res://ui/verdana-bold.tres" type="DynamicFont" id=4]
[ext_resource path="res://ui/account/usernamepass.tscn" type="PackedScene" id=5]
[ext_resource path="res://ui/account/Account.gd" type="Script" id=6]
[ext_resource path="res://ui/Status.gd" type="Script" id=7]
diff --git a/ui/boardlabels/BottomLeftLabel.tscn b/ui/boardlabels/BottomLeftLabel.tscn
deleted file mode 100644
index f8b2c2d..0000000
--- a/ui/boardlabels/BottomLeftLabel.tscn
+++ /dev/null
@@ -1,23 +0,0 @@
-[gd_scene load_steps=3 format=2]
-
-[ext_resource path="res://assets/ui/verdana-bold.ttf" type="DynamicFontData" id=1]
-
-[sub_resource type="DynamicFont" id=1]
-size = 15
-font_data = ExtResource( 1 )
-
-[node name="LabelsBottomLeft" type="Control"]
-margin_right = 40.0
-margin_bottom = 40.0
-mouse_filter = 2
-
-[node name="Label" type="Label" parent="."]
-anchor_top = 1.0
-anchor_bottom = 1.0
-margin_left = 8.0
-margin_top = -32.0
-margin_right = 40.0
-margin_bottom = -8.0
-custom_fonts/font = SubResource( 1 )
-text = "b3"
-valign = 1
diff --git a/ui/boardlabels/TopRightLabel.tscn b/ui/boardlabels/TopRightLabel.tscn
deleted file mode 100644
index 3e78fe7..0000000
--- a/ui/boardlabels/TopRightLabel.tscn
+++ /dev/null
@@ -1,24 +0,0 @@
-[gd_scene load_steps=3 format=2]
-
-[ext_resource path="res://assets/ui/verdana-bold.ttf" type="DynamicFontData" id=1]
-
-[sub_resource type="DynamicFont" id=1]
-size = 15
-font_data = ExtResource( 1 )
-
-[node name="LabelsTopRight" type="Control"]
-margin_right = 40.0
-margin_bottom = 40.0
-mouse_filter = 2
-
-[node name="Label" type="Label" parent="."]
-anchor_left = 1.0
-anchor_right = 1.0
-margin_left = -40.0
-margin_top = 8.0
-margin_right = -8.0
-margin_bottom = 32.0
-custom_fonts/font = SubResource( 1 )
-text = "b3"
-align = 2
-valign = 1
diff --git a/ui/chat/Chat.gd b/ui/chat/Chat.gd
new file mode 100644
index 0000000..65eedfc
--- /dev/null
+++ b/ui/chat/Chat.gd
@@ -0,0 +1,82 @@
+extends Control
+
+onready var labels = find_node("labels")
+onready var text: TextEdit = find_node("text")
+onready var scroller = find_node("scroller")
+onready var scrollbar = scroller.get_v_scrollbar()
+
+const server_says = "[b]server[color=#f0e67e]:[/color][/b] "
+
+var tween = Tween.new()
+var regexes: Array = [
+ [compile("_([^_]+)_"), "[i]$1[/i]"],
+ [compile("\\*\\*([^\\*\\*]+)\\*\\*"), "[b]$1[/b]"],
+ [compile("\\*([^\\*]+)\\*"), "[i]$1[/i]"],
+ [compile("```([^`]+)```"), "[code]$1[/code]"],
+ [compile("`([^`]+)`"), "[code]$1[/code]"],
+ [compile("~~([^~]+)~~"), "[s]$1[/s]"],
+ [compile("#([^#]+)#"), "[rainbow freq=.3 sat=.7]$1[/rainbow]"],
+ [compile("%([^%]+)%"), "[shake rate=20 level=25]$1[/shake]"]
+]
+
+
+func _ready():
+ if Globals.network:
+ Globals.network.connect("chat", self, "add_label_with")
+ add_child(tween)
+ add_label("%s[b]welcome!" % server_says, "server")
+ yield(get_tree().create_timer(.4), "timeout")
+ add_label("%s[b]you can use markdown(sort of)!" % server_says)
+
+
+static func compile(src: String) -> RegEx:
+ var regex := RegEx.new()
+ regex.compile(src)
+ return regex
+
+
+func add_label_with(data):
+ var string = "[b]%s[color=#f0e67e]:[/color][/b] %s" % [data.who, data.text]
+ add_label(string)
+
+
+func add_label(bbcode: String, name = "richtextlabel", size = Vector2(rect_size.x, 35)) -> RichTextLabel:
+ var l = RichTextLabel.new()
+ l.name = name
+ l.rect_min_size = size
+ l.bbcode_enabled = true
+ l.scroll_active = false
+ labels.add_child(l)
+ l.connect("meta_clicked", self, "open_url")
+ l.bbcode_text = bbcode
+ # l.fit_content_height = true
+ tween.interpolate_property(scrollbar, "value", scrollbar.value, scrollbar.max_value, .5, Tween.TRANS_BOUNCE)
+ tween.start()
+ return l
+
+
+func open_url(meta):
+ OS.shell_open(meta)
+
+
+func send(_arg = 0):
+ var t = text.get_text().strip_edges()
+ if !t:
+ return
+ t = translate_md(t)
+ text.text = ""
+ var name_data = SaveLoad.access_data("id").name
+ var name = name_data if name_data else "Anonymous"
+ Globals.network.relay_signal({"text": t, "who": name if name else "Anonymous"}, Network.RELAYHEADERS.chat)
+
+
+# markdown to bbcode
+func translate_md(input: String) -> String:
+ for replacement in regexes:
+ input = replacement[0].sub(input, replacement[1])
+ return input
+
+
+func err(err: String):
+ add_label("[b][color=#ff6347]error:[i] %s" % err)
+ text.editable = false
diff --git a/ui/chat/Chat.tscn b/ui/chat/Chat.tscn
new file mode 100644
index 0000000..6676503
--- /dev/null
+++ b/ui/chat/Chat.tscn
@@ -0,0 +1,273 @@
+[gd_scene load_steps=35 format=2]
+
+[ext_resource path="res://assets/ui/whitespace.png" type="Texture" id=1]
+[ext_resource path="res://ui/chat/Chat.gd" type="Script" id=2]
+[ext_resource path="res://assets/ui/verdana-bold.ttf" type="DynamicFontData" id=3]
+[ext_resource path="res://assets/ui/button.png" type="Texture" id=4]
+[ext_resource path="res://assets/ui/send.png" type="Texture" id=5]
+[ext_resource path="res://ui/barbutton/BarTextureButton.tscn" type="PackedScene" id=6]
+[ext_resource path="res://assets/ui/CascadiaCode.ttf" type="DynamicFontData" id=7]
+[ext_resource path="res://ui/theme/flatblack.tres" type="StyleBox" id=8]
+[ext_resource path="res://assets/ui/verdana.ttf" type="DynamicFontData" id=9]
+[ext_resource path="res://assets/ui/checkedbox.png" type="Texture" id=10]
+[ext_resource path="res://ui/theme/transblack.tres" type="StyleBox" id=11]
+[ext_resource path="res://ui/theme/buttonhover.tres" type="StyleBox" id=12]
+[ext_resource path="res://assets/ui/verdana-bold-italic.ttf" type="DynamicFontData" id=13]
+[ext_resource path="res://ui/theme/button.tres" type="StyleBox" id=14]
+
+[sub_resource type="StyleBoxTexture" id=6]
+texture = ExtResource( 4 )
+region_rect = Rect2( 0, 0, 84, 84 )
+margin_left = 28.0
+margin_right = 28.0
+margin_top = 28.0
+margin_bottom = 28.0
+modulate_color = Color( 0.772549, 0.772549, 0.772549, 0.54902 )
+
+[sub_resource type="StyleBoxEmpty" id=7]
+
+[sub_resource type="StyleBoxEmpty" id=8]
+
+[sub_resource type="StyleBoxEmpty" id=9]
+
+[sub_resource type="StyleBoxEmpty" id=4]
+
+[sub_resource type="StyleBoxFlat" id=3]
+bg_color = Color( 0.0784314, 0.0784314, 0.0784314, 1 )
+border_width_left = 2
+border_width_top = 2
+border_width_right = 2
+border_width_bottom = 2
+border_color = Color( 1, 1, 1, 1 )
+corner_detail = 20
+expand_margin_left = 10.0
+expand_margin_right = 10.0
+
+[sub_resource type="DynamicFont" id=18]
+size = 20
+font_data = ExtResource( 3 )
+
+[sub_resource type="DynamicFont" id=19]
+size = 20
+font_data = ExtResource( 13 )
+
+[sub_resource type="DynamicFont" id=14]
+size = 20
+font_data = ExtResource( 7 )
+
+[sub_resource type="DynamicFont" id=20]
+size = 25
+font_data = ExtResource( 9 )
+
+[sub_resource type="StyleBoxFlat" id=10]
+content_margin_left = 30.0
+content_margin_right = 30.0
+content_margin_top = 30.0
+content_margin_bottom = 30.0
+bg_color = Color( 0, 0, 0, 0.313726 )
+border_blend = true
+corner_radius_top_left = 50
+corner_radius_top_right = 50
+corner_radius_bottom_right = 30
+corner_radius_bottom_left = 30
+corner_detail = 15
+
+[sub_resource type="StyleBoxFlat" id=12]
+content_margin_left = 10.0
+content_margin_right = 10.0
+bg_color = Color( 0, 0, 0, 0.313726 )
+border_width_left = 3
+border_width_top = 3
+border_width_right = 3
+border_width_bottom = 1
+border_color = Color( 0, 0, 0, 0.392157 )
+
+[sub_resource type="StyleBoxFlat" id=11]
+content_margin_left = 10.0
+content_margin_right = 10.0
+bg_color = Color( 0.188235, 0.188235, 0.188235, 1 )
+border_width_left = 3
+border_width_top = 3
+border_width_right = 3
+border_width_bottom = 1
+border_color = Color( 0, 0, 0, 0.392157 )
+
+[sub_resource type="StyleBoxEmpty" id=5]
+
+[sub_resource type="StyleBoxFlat" id=13]
+content_margin_left = 10.0
+content_margin_right = 10.0
+content_margin_bottom = 10.0
+bg_color = Color( 0, 0, 0, 0.588235 )
+border_width_top = 65
+border_color = Color( 0.180392, 0.180392, 0.180392, 1 )
+corner_radius_top_left = 30
+corner_radius_top_right = 30
+corner_radius_bottom_right = 30
+corner_radius_bottom_left = 30
+corner_detail = 15
+expand_margin_top = 65.0
+
+[sub_resource type="DynamicFont" id=15]
+size = 20
+font_data = ExtResource( 3 )
+
+[sub_resource type="Theme" id=16]
+default_font = SubResource( 15 )
+Button/colors/font_color = Color( 1, 1, 1, 1 )
+Button/colors/font_color_disabled = Color( 1, 1, 1, 0.305882 )
+Button/colors/font_color_focus = Color( 1, 1, 1, 1 )
+Button/colors/font_color_hover = Color( 0, 0, 0, 1 )
+Button/colors/font_color_pressed = Color( 1, 1, 1, 1 )
+Button/styles/disabled = SubResource( 6 )
+Button/styles/focus = ExtResource( 14 )
+Button/styles/hover = ExtResource( 12 )
+Button/styles/normal = ExtResource( 14 )
+Button/styles/pressed = ExtResource( 14 )
+CheckBox/icons/checked = ExtResource( 10 )
+CheckBox/icons/checked_disabled = null
+CheckBox/icons/radio_checked = null
+CheckBox/icons/radio_checked_disabled = null
+CheckBox/icons/radio_unchecked = null
+CheckBox/icons/radio_unchecked_disabled = null
+CheckBox/icons/unchecked = ExtResource( 4 )
+CheckBox/icons/unchecked_disabled = null
+ColorPicker/icons/color_sample = ExtResource( 1 )
+ColorPicker/icons/overbright_indicator = ExtResource( 1 )
+ColorPicker/icons/preset_bg = ExtResource( 1 )
+ColorPicker/icons/screen_picker = ExtResource( 1 )
+ColorPickerButton/colors/font_color = Color( 1, 1, 1, 1 )
+ColorPickerButton/colors/font_color_disabled = Color( 1, 1, 1, 0.301961 )
+ColorPickerButton/colors/font_color_focus = Color( 1, 1, 1, 1 )
+ColorPickerButton/colors/font_color_hover = Color( 1, 1, 1, 1 )
+ColorPickerButton/colors/font_color_pressed = Color( 0.913725, 0.913725, 0.913725, 1 )
+ColorPickerButton/icons/bg = ExtResource( 1 )
+HBoxContainer/constants/separation = 15
+HSlider/styles/grabber_area = SubResource( 7 )
+HSlider/styles/grabber_area_highlight = SubResource( 8 )
+HSlider/styles/slider = SubResource( 9 )
+ItemList/colors/font_color = Color( 1, 1, 1, 1 )
+ItemList/colors/font_color_selected = Color( 0.905882, 0.905882, 0.905882, 1 )
+ItemList/styles/bg = SubResource( 4 )
+ItemList/styles/bg_focus = ExtResource( 8 )
+LineEdit/colors/cursor_color = Color( 1, 1, 1, 1 )
+LineEdit/colors/font_color = Color( 1, 1, 1, 1 )
+LineEdit/colors/font_color_uneditable = Color( 1, 1, 1, 0.67451 )
+LineEdit/styles/focus = ExtResource( 14 )
+LineEdit/styles/normal = ExtResource( 14 )
+LineEdit/styles/read_only = ExtResource( 14 )
+OptionButton/colors/font_color = Color( 1, 1, 1, 1 )
+OptionButton/colors/font_color_focus = Color( 1, 1, 1, 1 )
+OptionButton/colors/font_color_hover = Color( 0, 0, 0, 1 )
+OptionButton/colors/font_color_pressed = Color( 1, 1, 1, 1 )
+OptionButton/icons/arrow = ExtResource( 1 )
+PopupMenu/colors/font_color = Color( 1, 1, 1, 1 )
+PopupMenu/colors/font_color_accel = Color( 1, 1, 1, 0.8 )
+PopupMenu/colors/font_color_hover = Color( 1, 1, 1, 1 )
+PopupMenu/colors/font_color_separator = Color( 0.262745, 0.262745, 0.262745, 1 )
+PopupMenu/icons/radio_checked = ExtResource( 1 )
+PopupMenu/icons/radio_unchecked = ExtResource( 1 )
+PopupMenu/styles/hover = SubResource( 3 )
+PopupMenu/styles/panel = ExtResource( 8 )
+PopupPanel/styles/panel = ExtResource( 11 )
+RichTextLabel/colors/default_color = Color( 1, 1, 1, 1 )
+RichTextLabel/fonts/bold_font = SubResource( 18 )
+RichTextLabel/fonts/bold_italics_font = SubResource( 19 )
+RichTextLabel/fonts/italics_font = SubResource( 19 )
+RichTextLabel/fonts/mono_font = SubResource( 14 )
+RichTextLabel/fonts/normal_font = SubResource( 20 )
+SpinBox/icons/updown = ExtResource( 1 )
+TabContainer/colors/font_color_bg = Color( 0.709804, 0.709804, 0.709804, 0.72549 )
+TabContainer/colors/font_color_fg = Color( 1, 1, 1, 1 )
+TabContainer/styles/panel = SubResource( 10 )
+TabContainer/styles/tab_bg = SubResource( 12 )
+TabContainer/styles/tab_fg = SubResource( 11 )
+VBoxContainer/constants/separation = 15
+VScrollBar/styles/scroll = SubResource( 5 )
+WindowDialog/colors/title_color = Color( 1, 1, 1, 1 )
+WindowDialog/constants/close_h_ofs = 0
+WindowDialog/constants/close_v_ofs = 0
+WindowDialog/constants/title_height = 60
+WindowDialog/icons/close = ExtResource( 1 )
+WindowDialog/icons/close_highlight = ExtResource( 1 )
+WindowDialog/styles/panel = SubResource( 13 )
+
+[sub_resource type="StyleBoxFlat" id=17]
+content_margin_left = 10.0
+content_margin_right = 10.0
+content_margin_top = 10.0
+content_margin_bottom = 10.0
+bg_color = Color( 0, 0, 0, 0.313726 )
+
+[sub_resource type="StyleBoxFlat" id=1]
+content_margin_left = 10.0
+content_margin_right = 10.0
+bg_color = Color( 0.192157, 0.192157, 0.192157, 1 )
+
+[sub_resource type="StyleBoxFlat" id=2]
+content_margin_left = 10.0
+content_margin_right = 10.0
+bg_color = Color( 0.0980392, 0.0980392, 0.0980392, 1 )
+
+[node name="Chat" type="Control"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+rect_min_size = Vector2( 300, 0 )
+theme = SubResource( 16 )
+script = ExtResource( 2 )
+
+[node name="v" type="VBoxContainer" parent="."]
+anchor_right = 1.0
+anchor_bottom = 1.0
+custom_constants/separation = 0
+
+[node name="Panel" type="Panel" parent="v"]
+margin_right = 1422.0
+margin_bottom = 740.0
+size_flags_vertical = 3
+custom_styles/panel = SubResource( 17 )
+
+[node name="scroller" type="ScrollContainer" parent="v/Panel"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_left = 16.0
+scroll_horizontal_enabled = false
+
+[node name="labels" type="VBoxContainer" parent="v/Panel/scroller"]
+margin_right = 1406.0
+size_flags_horizontal = 3
+size_flags_vertical = 2
+
+[node name="h" type="HBoxContainer" parent="v"]
+margin_top = 740.0
+margin_right = 1422.0
+margin_bottom = 800.0
+custom_constants/separation = 0
+
+[node name="text" type="TextEdit" parent="v/h"]
+margin_right = 1362.0
+margin_bottom = 60.0
+rect_min_size = Vector2( 0, 60 )
+size_flags_horizontal = 3
+custom_styles/focus = SubResource( 1 )
+custom_styles/normal = SubResource( 2 )
+text = "hello ! write text here !"
+show_line_numbers = true
+context_menu_enabled = false
+smooth_scrolling = true
+wrap_enabled = true
+minimap_draw = true
+minimap_width = 50
+caret_blink = true
+
+[node name="send" parent="v/h" instance=ExtResource( 6 )]
+margin_left = 1362.0
+margin_right = 1422.0
+margin_bottom = 60.0
+rect_min_size = Vector2( 60, 60 )
+focus_mode = 2
+enabled_focus_mode = 2
+texture_normal = ExtResource( 5 )
+normal_color = Color( 0, 0, 0, 0.784314 )
+
+[connection signal="pressed" from="v/h/send" to="." method="send"]
diff --git a/ui/sandisplay/SanDisplay.gd b/ui/sandisplay/SanDisplay.gd
index 3ecaafe..b334290 100644
--- a/ui/sandisplay/SanDisplay.gd
+++ b/ui/sandisplay/SanDisplay.gd
@@ -15,7 +15,7 @@ func _ready() -> void:
func create_number_label(num: int) -> void:
var clr := ColorRect.new()
clr.color = Color(1, 1, 1, 0.13)
- clr.rect_min_size = Vector2(70, 30)
+ clr.rect_min_size = Vector2(100, 30)
var label := Label.new()
label.text = " %s." % str(num)
label.align = Label.ALIGN_LEFT
@@ -29,7 +29,7 @@ func create_san_label(text: String, alignment := Label.ALIGN_RIGHT) -> void:
label.text = text
label.valign = Label.VALIGN_CENTER
label.align = alignment
- label.rect_min_size = Vector2(rect_size.x / 2.4, 0)
+ label.rect_min_size = Vector2(rect_size.x / 3, 0)
sans.add_child(label)
diff --git a/ui/theme/main.tres b/ui/theme/main.tres
index 2061107..2032249 100644
--- a/ui/theme/main.tres
+++ b/ui/theme/main.tres
@@ -1,6 +1,6 @@
-[gd_resource type="Theme" load_steps=20 format=2]
+[gd_resource type="Theme" load_steps=28 format=2]
-[ext_resource path="res://ui/verdana.tres" type="DynamicFont" id=1]
+[ext_resource path="res://ui/verdana-bold.tres" type="DynamicFont" id=1]
[ext_resource path="res://ui/theme/button.tres" type="StyleBox" id=2]
[ext_resource path="res://assets/ui/whitespace.png" type="Texture" id=3]
[ext_resource path="res://assets/ui/button.png" type="Texture" id=4]
@@ -8,6 +8,10 @@
[ext_resource path="res://assets/ui/checkedbox.png" type="Texture" id=6]
[ext_resource path="res://ui/theme/flatblack.tres" type="StyleBox" id=7]
[ext_resource path="res://ui/theme/transblack.tres" type="StyleBox" id=8]
+[ext_resource path="res://assets/ui/verdana.ttf" type="DynamicFontData" id=9]
+[ext_resource path="res://assets/ui/CascadiaCode.ttf" type="DynamicFontData" id=10]
+[ext_resource path="res://assets/ui/verdana-bold-italic.ttf" type="DynamicFontData" id=11]
+[ext_resource path="res://assets/ui/verdana-bold.ttf" type="DynamicFontData" id=12]
[sub_resource type="StyleBoxTexture" id=6]
texture = ExtResource( 4 )
@@ -37,6 +41,22 @@ corner_detail = 20
expand_margin_left = 10.0
expand_margin_right = 10.0
+[sub_resource type="DynamicFont" id=21]
+size = 20
+font_data = ExtResource( 12 )
+
+[sub_resource type="DynamicFont" id=19]
+size = 20
+font_data = ExtResource( 11 )
+
+[sub_resource type="DynamicFont" id=14]
+size = 20
+font_data = ExtResource( 10 )
+
+[sub_resource type="DynamicFont" id=20]
+size = 20
+font_data = ExtResource( 9 )
+
[sub_resource type="StyleBoxFlat" id=10]
content_margin_left = 30.0
content_margin_right = 30.0
@@ -144,6 +164,12 @@ PopupMenu/icons/radio_unchecked = ExtResource( 3 )
PopupMenu/styles/hover = SubResource( 3 )
PopupMenu/styles/panel = ExtResource( 7 )
PopupPanel/styles/panel = ExtResource( 8 )
+RichTextLabel/colors/default_color = Color( 1, 1, 1, 1 )
+RichTextLabel/fonts/bold_font = SubResource( 21 )
+RichTextLabel/fonts/bold_italics_font = SubResource( 19 )
+RichTextLabel/fonts/italics_font = SubResource( 19 )
+RichTextLabel/fonts/mono_font = SubResource( 14 )
+RichTextLabel/fonts/normal_font = SubResource( 20 )
SpinBox/icons/updown = ExtResource( 3 )
TabContainer/colors/font_color_bg = Color( 0.709804, 0.709804, 0.709804, 0.72549 )
TabContainer/colors/font_color_fg = Color( 1, 1, 1, 1 )
diff --git a/ui/verdana.tres b/ui/verdana-bold.tres
index 44ebde1..44ebde1 100644
--- a/ui/verdana.tres
+++ b/ui/verdana-bold.tres