online multiplayer chess game (note server currently down)
| -rw-r--r-- | Globals.gd | 2 | ||||
| -rw-r--r-- | Grid.gd | 12 | ||||
| -rw-r--r-- | assets/ui/smallbutton.png | 3 | ||||
| -rw-r--r-- | assets/ui/smallbutton.png.import | 35 | ||||
| -rw-r--r-- | assets/ui/smallbuttonhover.png | 3 | ||||
| -rw-r--r-- | assets/ui/smallbuttonhover.png.import | 35 | ||||
| -rw-r--r-- | project.godot | 26 | ||||
| -rw-r--r-- | saveload.gd | 24 | ||||
| -rw-r--r-- | ui/ColorPicker.gd | 61 | ||||
| -rw-r--r-- | ui/ColorPicker.tres | 17 | ||||
| -rw-r--r-- | ui/ColorPicker.tscn | 96 | ||||
| -rw-r--r-- | ui/ColorPickerButton.gd | 32 | ||||
| -rw-r--r-- | ui/ColorPickerButton.tscn | 30 | ||||
| -rw-r--r-- | ui/Preview.gd | 10 | ||||
| -rw-r--r-- | ui/Settings.gd | 44 | ||||
| -rw-r--r-- | ui/Settings.tscn | 105 | ||||
| -rw-r--r-- | ui/main.tres | 22 | ||||
| -rw-r--r-- | ui/smallbutton.tres | 11 | ||||
| -rw-r--r-- | ui/smallbuttonhover.tres | 11 |
19 files changed, 542 insertions, 37 deletions
@@ -10,6 +10,8 @@ var fullmove := 1 var halfmove := 0 var in_check := false var checking_piece: Piece = null +var board_color1: Color +var board_color2: Color var white_king: King var black_king: King var turn := true # true for white, false for black @@ -24,8 +24,6 @@ const default_metadata := { "bcep": [], # black can enpassant } -export(Color) var board_color1 := Color(0.870588, 0.890196, 0.901961) -export(Color) var board_color2 := Color(0.54902, 0.635294, 0.678431) 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) @@ -38,10 +36,8 @@ var background_matrix := [] var history_matrixes := {} var last_clicked: Piece = null -onready var PIECE_SET: String = Globals.piece_set - onready var background := $Background -onready var ASSETS_PATH := "res://assets/pieces/%s/" % PIECE_SET +onready var ASSETS_PATH: String = "res://assets/pieces/%s/" % Globals.piece_set onready var foreground := $Foreground onready var pieces := $Pieces onready var status_label := $"../UI/Holder/Back/VBox/Status" @@ -116,7 +112,9 @@ func init_labels() -> void: func size_label(label, i) -> void: label.rect_size = piece_size - label.get_node("Label").add_color_override("font_color", board_color1 if i % 2 == 0 else board_color2) + label.get_node("Label").add_color_override( + "font_color", Globals.board_color1 if i % 2 == 0 else Globals.board_color2 + ) func threefoldrepetition() -> bool: @@ -209,7 +207,7 @@ func init_board() -> void: # create the board var square := Square.instance() # create a square square.rect_size = piece_size # set the size square.rect_position = Vector2(i, j) * piece_size # set the position - square.color = board_color1 if (i + j) % 2 == 0 else board_color2 # set the color + 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 diff --git a/assets/ui/smallbutton.png b/assets/ui/smallbutton.png new file mode 100644 index 0000000..7bf38fa --- /dev/null +++ b/assets/ui/smallbutton.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:668db2bdbb4db84bb116bed86594025b6ce7d1ed0662b15cb75a88107c5b2921 +size 308 diff --git a/assets/ui/smallbutton.png.import b/assets/ui/smallbutton.png.import new file mode 100644 index 0000000..4f17e68 --- /dev/null +++ b/assets/ui/smallbutton.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/smallbutton.png-140fddc48216cea1540f15882461f39a.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/smallbutton.png" +dest_files=[ "res://.import/smallbutton.png-140fddc48216cea1540f15882461f39a.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=false +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/smallbuttonhover.png b/assets/ui/smallbuttonhover.png new file mode 100644 index 0000000..717fa2f --- /dev/null +++ b/assets/ui/smallbuttonhover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:870cee2b425c68369985c3cd8dddb1dcc3dd3a20d63e5f357df80942c3c90a5c +size 260 diff --git a/assets/ui/smallbuttonhover.png.import b/assets/ui/smallbuttonhover.png.import new file mode 100644 index 0000000..5b3c306 --- /dev/null +++ b/assets/ui/smallbuttonhover.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/smallbuttonhover.png-667dff932bdae35ca0966828644ab441.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/smallbuttonhover.png" +dest_files=[ "res://.import/smallbuttonhover.png-667dff932bdae35ca0966828644ab441.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/project.godot b/project.godot index 72215d7..430715d 100644 --- a/project.godot +++ b/project.godot @@ -14,6 +14,16 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://pieces/Bishop.gd" }, { +"base": "Control", +"class": "ColorPickerBetter", +"language": "GDScript", +"path": "res://ui/ColorPicker.gd" +}, { +"base": "Button", +"class": "ColorPickerButtonBetter", +"language": "GDScript", +"path": "res://ui/ColorPickerButton.gd" +}, { "base": "LineEdit", "class": "FENLabel", "language": "GDScript", @@ -49,6 +59,11 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://pieces/Piece.gd" }, { +"base": "Node", +"class": "Preview", +"language": "GDScript", +"path": "res://ui/Preview.gd" +}, { "base": "Piece", "class": "Queen", "language": "GDScript", @@ -58,9 +73,16 @@ _global_script_classes=[ { "class": "Rook", "language": "GDScript", "path": "res://pieces/Rook.gd" +}, { +"base": "Node", +"class": "SaveLoader", +"language": "GDScript", +"path": "res://saveload.gd" } ] _global_script_class_icons={ "Bishop": "res://assets/pieces/california/wB.png", +"ColorPickerBetter": "", +"ColorPickerButtonBetter": "", "FENLabel": "", "Grid": "", "King": "res://assets/pieces/california/wK.png", @@ -68,8 +90,10 @@ _global_script_class_icons={ "Network": "", "Pawn": "res://assets/pieces/california/wP.png", "Piece": "res://assets/pieces/california/wP.png", +"Preview": "", "Queen": "res://assets/pieces/california/wQ.png", -"Rook": "res://assets/pieces/california/wR.png" +"Rook": "res://assets/pieces/california/wR.png", +"SaveLoader": "" } [application] diff --git a/saveload.gd b/saveload.gd index d5a264d..9e74684 100644 --- a/saveload.gd +++ b/saveload.gd @@ -1,24 +1,18 @@ extends Node +class_name SaveLoader const settings_file := "user://chess.settings" -var files := { - "settings": - { # file types - "file": settings_file, - "data": - { - "vsync": OS.vsync_enabled, - "fullscreen": OS.window_fullscreen, - "borderless": OS.window_borderless, - "piece_set": "california" - } - } +const default_settings_data = { + "vsync": OS.vsync_enabled, + "fullscreen": OS.window_fullscreen, + "borderless": OS.window_borderless, + "piece_set": "california", + "board_color1": Color(0.870588, 0.890196, 0.901961), + "board_color2": Color(0.54902, 0.635294, 0.678431) } - -func _ready() -> void: - load_data("settings") +var files := {"settings": {"file": settings_file, "data": default_settings_data.duplicate(true)}} # file types func save(type) -> void: diff --git a/ui/ColorPicker.gd b/ui/ColorPicker.gd new file mode 100644 index 0000000..d94ae62 --- /dev/null +++ b/ui/ColorPicker.gd @@ -0,0 +1,61 @@ +extends Control +class_name ColorPickerBetter # when you dont like the native color picker so you make your own + +var color: Color + +var _manual_change := false + +signal color_changed(color) +signal done(color) + +onready var hex = $Panel/hex +onready var rgb = $Panel/H/rgb.get_children() +onready var preview = $Panel/H/Preview + + +func _ready(): + update_hex_and_preview(false) + + +func update_r(value: float): + if _manual_change: + return + color.r = value / 255 + update_hex_and_preview() + + +func update_b(value: float): + if _manual_change: + return + color.b = value / 255 + update_hex_and_preview() + + +func update_g(value: float): + if _manual_change: + return + color.g = value / 255 + update_hex_and_preview() + + +func update_hex_and_preview(to_signal := true): # update the hex and preview + _manual_change = true + rgb[0].value = color.r * 255 + rgb[1].value = color.g * 255 + rgb[2].value = color.b * 255 + _manual_change = false + var pos = hex.caret_position + hex.text = "#" + color.to_html(false) + hex.caret_position = pos # make it in the right place + preview.color = color + if to_signal: + emit_signal("color_changed", color) + + +func _on_hex_text_entered(new_text: String): + color = Color(new_text) + update_hex_and_preview() + + +func _on_OKButton_pressed(): + emit_signal("done", color) diff --git a/ui/ColorPicker.tres b/ui/ColorPicker.tres new file mode 100644 index 0000000..a852e11 --- /dev/null +++ b/ui/ColorPicker.tres @@ -0,0 +1,17 @@ +[gd_resource type="Theme" load_steps=5 format=2] + +[ext_resource path="res://assets/ui/Roboto-Medium.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://ui/smallbutton.tres" type="StyleBox" id=2] +[ext_resource path="res://assets/ui/whitespace.png" type="Texture" id=3] + +[sub_resource type="DynamicFont" id=1] +size = 20 +font_data = ExtResource( 1 ) + +[resource] +default_font = SubResource( 1 ) +LineEdit/colors/font_color = Color( 1, 1, 1, 1 ) +LineEdit/colors/font_color_selected = Color( 0.482353, 0.6, 0.870588, 1 ) +LineEdit/styles/focus = ExtResource( 2 ) +LineEdit/styles/normal = ExtResource( 2 ) +SpinBox/icons/updown = ExtResource( 3 ) diff --git a/ui/ColorPicker.tscn b/ui/ColorPicker.tscn new file mode 100644 index 0000000..b9fab21 --- /dev/null +++ b/ui/ColorPicker.tscn @@ -0,0 +1,96 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://ui/ColorPicker.gd" type="Script" id=1] +[ext_resource path="res://ui/ColorPicker.tres" type="Theme" id=2] +[ext_resource path="res://assets/ui/Roboto-Medium.ttf" type="DynamicFontData" id=3] +[ext_resource path="res://ui/smallbuttonhover.tres" type="StyleBox" id=4] +[ext_resource path="res://ui/smallbutton.tres" type="StyleBox" id=5] + +[sub_resource type="DynamicFont" id=1] +size = 20 +font_data = ExtResource( 3 ) + +[node name="ColorPicker" type="Control"] +margin_right = 202.0 +margin_bottom = 238.0 +theme = ExtResource( 2 ) +script = ExtResource( 1 ) + +[node name="Panel" type="Panel" parent="."] +margin_left = -12.0 +margin_top = -12.0 +margin_right = 202.0 +margin_bottom = 240.0 + +[node name="H" type="HBoxContainer" parent="Panel"] +margin_left = 12.0 +margin_top = 12.0 +margin_right = 209.0 +margin_bottom = 180.0 +custom_constants/separation = 8 + +[node name="Preview" type="ColorRect" parent="Panel/H"] +margin_right = 100.0 +margin_bottom = 100.0 +rect_min_size = Vector2( 100, 100 ) +size_flags_horizontal = 0 +size_flags_vertical = 0 + +[node name="rgb" type="VBoxContainer" parent="Panel/H"] +margin_left = 108.0 +margin_right = 197.0 +margin_bottom = 168.0 +custom_constants/separation = 6 + +[node name="r" type="SpinBox" parent="Panel/H/rgb"] +margin_right = 89.0 +margin_bottom = 52.0 +max_value = 255.0 +rounded = true + +[node name="g" type="SpinBox" parent="Panel/H/rgb"] +margin_top = 58.0 +margin_right = 89.0 +margin_bottom = 110.0 +max_value = 255.0 +rounded = true + +[node name="b" type="SpinBox" parent="Panel/H/rgb"] +margin_top = 116.0 +margin_right = 89.0 +margin_bottom = 168.0 +max_value = 255.0 +rounded = true + +[node name="hex" type="LineEdit" parent="Panel"] +margin_left = 6.0 +margin_top = 124.0 +margin_right = 114.0 +margin_bottom = 176.0 +max_length = 7 +placeholder_text = "#FFFFFF" +caret_blink = true + +[node name="OKButton" type="Button" parent="Panel"] +margin_left = 20.0 +margin_top = 186.0 +margin_right = 200.0 +margin_bottom = 238.0 +focus_mode = 0 +custom_colors/font_color_focus = Color( 0, 0, 0, 1 ) +custom_colors/font_color = Color( 1, 1, 1, 1 ) +custom_colors/font_color_hover = Color( 0, 0, 0, 1 ) +custom_colors/font_color_pressed = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 1 ) +custom_styles/hover = ExtResource( 4 ) +custom_styles/pressed = ExtResource( 4 ) +custom_styles/focus = ExtResource( 4 ) +custom_styles/normal = ExtResource( 5 ) +enabled_focus_mode = 0 +text = "OK" + +[connection signal="value_changed" from="Panel/H/rgb/r" to="." method="update_r"] +[connection signal="value_changed" from="Panel/H/rgb/g" to="." method="update_g"] +[connection signal="value_changed" from="Panel/H/rgb/b" to="." method="update_b"] +[connection signal="text_entered" from="Panel/hex" to="." method="_on_hex_text_entered"] +[connection signal="pressed" from="Panel/OKButton" to="." method="_on_OKButton_pressed"] diff --git a/ui/ColorPickerButton.gd b/ui/ColorPickerButton.gd new file mode 100644 index 0000000..5f5ef67 --- /dev/null +++ b/ui/ColorPickerButton.gd @@ -0,0 +1,32 @@ +extends Button +class_name ColorPickerButtonBetter + +onready var colorpicker = $"ColorPicker" + +signal newcolor(color) + +var color: Color setget set_color + + +func set_color(newcolor): + color = newcolor + add_color_override("font_color", color) + colorpicker.color = color + colorpicker.update_hex_and_preview() + + +func _ready(): + colorpicker.set_as_toplevel(true) + colorpicker.rect_global_position = $Position.rect_global_position + $Position.queue_free() + # VisualServer.canvas_item_set_z_index(colorpicker.get_canvas_item(), 5) + + +func _on_pressed(): + colorpicker.show() + + +func _on_ColorPicker_done(newcolor: Color): + set_color(newcolor) + colorpicker.hide() + emit_signal("newcolor", color) diff --git a/ui/ColorPickerButton.tscn b/ui/ColorPickerButton.tscn new file mode 100644 index 0000000..8ecadbd --- /dev/null +++ b/ui/ColorPickerButton.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://ui/main.tres" type="Theme" id=1] +[ext_resource path="res://ui/ColorPickerButton.gd" type="Script" id=2] +[ext_resource path="res://ui/ColorPicker.tscn" type="PackedScene" id=3] + +[node name="ColorPickerButton" type="Button"] +margin_right = 232.0 +margin_bottom = 106.0 +focus_mode = 0 +theme = ExtResource( 1 ) +enabled_focus_mode = 0 +text = "button" +script = ExtResource( 2 ) + +[node name="ColorPicker" parent="." instance=ExtResource( 3 )] +visible = false +margin_left = 92.0 +margin_top = 58.0 +margin_right = 294.0 +margin_bottom = 234.0 + +[node name="Position" type="Control" parent="."] +margin_left = 80.0 +margin_top = 46.0 +margin_right = 120.0 +margin_bottom = 86.0 + +[connection signal="pressed" from="." to="." method="_on_pressed"] +[connection signal="done" from="ColorPicker" to="." method="_on_ColorPicker_done"] diff --git a/ui/Preview.gd b/ui/Preview.gd new file mode 100644 index 0000000..fbee72c --- /dev/null +++ b/ui/Preview.gd @@ -0,0 +1,10 @@ +extends Node +class_name Preview + +onready var squares = get_children() + + +func update_preview(): + for i in range(4): + squares[i].color = Globals.board_color1 if i == 0 or i == 3 else Globals.board_color2 + squares[0].get_node("Piece").texture = load("res://assets/pieces/%s/wP.png" % Globals.piece_set) diff --git a/ui/Settings.gd b/ui/Settings.gd index 579b2b8..f121df8 100644 --- a/ui/Settings.gd +++ b/ui/Settings.gd @@ -5,12 +5,16 @@ onready var piece_set_button := $ColorRect/HBoxContainer/VBoxContainer/PieceSet onready var fullscreenbutton := $ColorRect/HBoxContainer/VBoxContainer2/FullscreenButton onready var vsyncbutton := $ColorRect/HBoxContainer/VBoxContainer2/VsyncButton onready var borderlessbutton := $ColorRect/HBoxContainer/VBoxContainer2/Borderless +onready var preview: Preview = $ColorRect/HBoxContainer/VBoxContainer/Preview + +onready var board_color1: ColorPickerButtonBetter = $ColorRect/HBoxContainer/VBoxContainer3/boardcolor1 +onready var board_color2: ColorPickerButtonBetter = $ColorRect/HBoxContainer/VBoxContainer3/boardcolor2 onready var settings: Dictionary = SaveLoad.files["settings"]["data"] setget set_settings func set_settings(new_settings) -> void: - toggle_button_visuals(new_settings) + update_button_visuals(new_settings) settings = new_settings SaveLoad.files["settings"]["data"] = settings SaveLoad.save("settings") @@ -20,18 +24,35 @@ func toggle(onoff) -> void: visible = onoff -func toggle_button_visuals(set = settings) -> void: +func update_button_visuals(set = settings) -> void: vsyncbutton.pressed = set["vsync"] fullscreenbutton.pressed = set["fullscreen"] borderlessbutton.pressed = !set["borderless"] - piece_set_button.selected = Array(piece_sets).find(settings.piece_set) + preview.update_preview() func _ready() -> void: + SaveLoad.load_data("settings") + board_color1.color = settings.board_color1 + board_color2.color = settings.board_color2 for i in piece_sets: # add the items piece_set_button.add_icon_item(load("res://assets/pieces/" + i + "/wP.png"), i) - toggle_button_visuals() + piece_set_button.selected = Array(piece_sets).find(settings.piece_set) Globals.piece_set = piece_sets[piece_set_button.selected] + Globals.board_color1 = settings.board_color1 + Globals.board_color2 = settings.board_color2 + update_button_visuals() + + +func update_vars() -> void: + Globals.piece_set = piece_sets[piece_set_button.selected] + Globals.board_color1 = board_color1.color + Globals.board_color2 = board_color2.color + OS.vsync_enabled = settings.vsync + OS.window_fullscreen = settings.fullscreen + OS.window_borderless = settings.borderless + SaveLoad.files["settings"]["data"] = settings + SaveLoad.save("settings") func _input(event) -> void: @@ -61,3 +82,18 @@ func _on_FullscreenButton_toggled(button_pressed: bool) -> void: func _on_Borderless_toggled(button_pressed: bool) -> void: self.settings.borderless = !button_pressed OS.window_borderless = !button_pressed + + +func _on_boardcolor1_newcolor(color: Color): + Globals.board_color1 = color + self.settings.board_color1 = color + + +func _on_boardcolor2_newcolor(color: Color): + Globals.board_color2 = color + self.settings.board_color2 = color + + +func _on_resetbutton_pressed(): + self.settings = SaveLoad.default_settings_data.duplicate(true) + update_vars() diff --git a/ui/Settings.tscn b/ui/Settings.tscn index dd74845..1c08478 100644 --- a/ui/Settings.tscn +++ b/ui/Settings.tscn @@ -1,8 +1,11 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://ui/main.tres" type="Theme" id=1] [ext_resource path="res://ui/Settings.gd" type="Script" id=2] [ext_resource path="res://assets/pieces/california/wP.png" type="Texture" id=3] +[ext_resource path="res://ui/Preview.gd" type="Script" id=4] +[ext_resource path="res://ui/ColorPickerButton.tscn" type="PackedScene" id=5] +[ext_resource path="res://ui/ColorPickerButton.gd" type="Script" id=6] [node name="Settings" type="Control" groups=["control"]] anchor_right = 1.0 @@ -21,30 +24,84 @@ anchor_bottom = 1.0 alignment = 1 [node name="VBoxContainer" type="VBoxContainer" parent="ColorRect/HBoxContainer" groups=["control"]] -margin_left = 225.0 -margin_right = 591.0 +margin_left = 54.0 +margin_right = 420.0 margin_bottom = 800.0 alignment = 1 [node name="BackButton" type="Button" parent="ColorRect/HBoxContainer/VBoxContainer" groups=["control"]] -margin_top = 261.0 +margin_top = 121.0 margin_right = 366.0 -margin_bottom = 367.0 +margin_bottom = 227.0 text = "back" [node name="PieceSet" type="OptionButton" parent="ColorRect/HBoxContainer/VBoxContainer" groups=["control"]] -margin_top = 382.0 +margin_top = 242.0 margin_right = 366.0 -margin_bottom = 538.0 +margin_bottom = 398.0 focus_mode = 0 custom_constants/hseparation = 3 enabled_focus_mode = 0 text = "piece set" icon = ExtResource( 3 ) +[node name="PreviewLabel" type="Label" parent="ColorRect/HBoxContainer/VBoxContainer"] +margin_top = 413.0 +margin_right = 366.0 +margin_bottom = 463.0 +text = "Preview" +align = 1 + +[node name="Preview" type="GridContainer" parent="ColorRect/HBoxContainer/VBoxContainer"] +margin_left = 83.0 +margin_top = 478.0 +margin_right = 283.0 +margin_bottom = 678.0 +size_flags_horizontal = 4 +custom_constants/vseparation = 0 +custom_constants/hseparation = 0 +columns = 2 +script = ExtResource( 4 ) +__meta__ = { +"_edit_group_": true +} + +[node name="00" type="ColorRect" parent="ColorRect/HBoxContainer/VBoxContainer/Preview"] +margin_right = 100.0 +margin_bottom = 100.0 +rect_min_size = Vector2( 100, 100 ) + +[node name="Piece" type="TextureRect" parent="ColorRect/HBoxContainer/VBoxContainer/Preview/00"] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 3 ) +expand = true +stretch_mode = 1 + +[node name="10" type="ColorRect" parent="ColorRect/HBoxContainer/VBoxContainer/Preview"] +margin_left = 100.0 +margin_right = 200.0 +margin_bottom = 100.0 +rect_min_size = Vector2( 100, 100 ) +color = Color( 0, 0, 0, 1 ) + +[node name="01" type="ColorRect" parent="ColorRect/HBoxContainer/VBoxContainer/Preview"] +margin_top = 100.0 +margin_right = 100.0 +margin_bottom = 200.0 +rect_min_size = Vector2( 100, 100 ) +color = Color( 0, 0, 0, 1 ) + +[node name="11" type="ColorRect" parent="ColorRect/HBoxContainer/VBoxContainer/Preview"] +margin_left = 100.0 +margin_top = 100.0 +margin_right = 200.0 +margin_bottom = 200.0 +rect_min_size = Vector2( 100, 100 ) + [node name="VBoxContainer2" type="VBoxContainer" parent="ColorRect/HBoxContainer" groups=["control"]] -margin_left = 606.0 -margin_right = 975.0 +margin_left = 435.0 +margin_right = 804.0 margin_bottom = 800.0 alignment = 1 @@ -73,8 +130,38 @@ focus_mode = 0 enabled_focus_mode = 0 text = "borders" +[node name="VBoxContainer3" type="VBoxContainer" parent="ColorRect/HBoxContainer"] +margin_left = 819.0 +margin_right = 1145.0 +margin_bottom = 800.0 +alignment = 1 + +[node name="resetbutton" type="Button" parent="ColorRect/HBoxContainer/VBoxContainer3"] +margin_top = 226.0 +margin_right = 326.0 +margin_bottom = 332.0 +focus_mode = 0 +enabled_focus_mode = 0 +text = "reset all" + +[node name="boardcolor1" parent="ColorRect/HBoxContainer/VBoxContainer3" instance=ExtResource( 5 )] +margin_top = 347.0 +margin_right = 326.0 +margin_bottom = 453.0 +text = "boardcolor1" +script = ExtResource( 6 ) + +[node name="boardcolor2" parent="ColorRect/HBoxContainer/VBoxContainer3" instance=ExtResource( 5 )] +margin_top = 468.0 +margin_right = 326.0 +margin_bottom = 574.0 +text = "boardcolor2" + [connection signal="pressed" from="ColorRect/HBoxContainer/VBoxContainer/BackButton" to="." method="_on_BackButton_pressed"] [connection signal="item_selected" from="ColorRect/HBoxContainer/VBoxContainer/PieceSet" to="." method="_on_PieceSet_item_selected"] [connection signal="toggled" from="ColorRect/HBoxContainer/VBoxContainer2/VsyncButton" to="." method="_on_VsyncButton_toggled"] [connection signal="toggled" from="ColorRect/HBoxContainer/VBoxContainer2/FullscreenButton" to="." method="_on_FullscreenButton_toggled"] [connection signal="toggled" from="ColorRect/HBoxContainer/VBoxContainer2/Borderless" to="." method="_on_Borderless_toggled"] +[connection signal="pressed" from="ColorRect/HBoxContainer/VBoxContainer3/resetbutton" to="." method="_on_resetbutton_pressed"] +[connection signal="newcolor" from="ColorRect/HBoxContainer/VBoxContainer3/boardcolor1" to="." method="_on_boardcolor1_newcolor"] +[connection signal="newcolor" from="ColorRect/HBoxContainer/VBoxContainer3/boardcolor2" to="." method="_on_boardcolor2_newcolor"] diff --git a/ui/main.tres b/ui/main.tres index 241b240..8a0a261 100644 --- a/ui/main.tres +++ b/ui/main.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=12 format=2] +[gd_resource type="Theme" load_steps=15 format=2] [ext_resource path="res://ui/verdana.tres" type="DynamicFont" id=1] [ext_resource path="res://ui/button.tres" type="StyleBox" id=2] @@ -17,6 +17,12 @@ 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] @@ -50,7 +56,20 @@ 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( 3 ) +ColorPicker/icons/overbright_indicator = ExtResource( 3 ) +ColorPicker/icons/preset_bg = ExtResource( 3 ) +ColorPicker/icons/screen_picker = ExtResource( 3 ) +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( 3 ) 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 ) @@ -74,5 +93,6 @@ PopupMenu/icons/radio_checked = ExtResource( 3 ) PopupMenu/icons/radio_unchecked = ExtResource( 3 ) PopupMenu/styles/hover = SubResource( 3 ) PopupMenu/styles/panel = ExtResource( 7 ) +SpinBox/icons/updown = ExtResource( 3 ) VBoxContainer/constants/separation = 15 VScrollBar/styles/scroll = SubResource( 5 ) diff --git a/ui/smallbutton.tres b/ui/smallbutton.tres new file mode 100644 index 0000000..8e87d11 --- /dev/null +++ b/ui/smallbutton.tres @@ -0,0 +1,11 @@ +[gd_resource type="StyleBoxTexture" load_steps=2 format=2] + +[ext_resource path="res://assets/ui/smallbutton.png" type="Texture" id=1] + +[resource] +texture = ExtResource( 1 ) +region_rect = Rect2( 0, 0, 42, 42 ) +margin_left = 14.0 +margin_right = 14.0 +margin_top = 14.0 +margin_bottom = 14.0 diff --git a/ui/smallbuttonhover.tres b/ui/smallbuttonhover.tres new file mode 100644 index 0000000..3189e53 --- /dev/null +++ b/ui/smallbuttonhover.tres @@ -0,0 +1,11 @@ +[gd_resource type="StyleBoxTexture" load_steps=2 format=2] + +[ext_resource path="res://assets/ui/smallbuttonhover.png" type="Texture" id=1] + +[resource] +texture = ExtResource( 1 ) +region_rect = Rect2( 0, 0, 42, 42 ) +margin_left = 14.0 +margin_right = 14.0 +margin_top = 14.0 +margin_bottom = 14.0 |