online multiplayer chess game (note server currently down)
-rw-r--r--Grid.gd23
-rw-r--r--assets/ui/button.png.import2
-rw-r--r--assets/ui/buttonhover.png.import2
-rw-r--r--assets/ui/checkedbox.png.import2
-rw-r--r--assets/ui/close.png3
-rw-r--r--assets/ui/close.png.import (renamed from assets/ui/smallbuttonhover.png.import)6
-rw-r--r--assets/ui/smallbutton.png3
-rw-r--r--assets/ui/smallbutton.png.import35
-rw-r--r--assets/ui/smallbuttonhover.png3
-rw-r--r--assets/ui/svg/close.svg3
-rw-r--r--project.godot6
-rw-r--r--ui/GameUI.tscn4
-rw-r--r--ui/barbutton/BarTextureButton.gd6
-rw-r--r--ui/barbutton/BarTextureButton.tscn6
-rw-r--r--ui/colorpicker/ColorPicker.gd4
-rw-r--r--ui/colorpicker/ColorPicker.tres17
-rw-r--r--ui/colorpicker/ColorPicker.tscn94
-rw-r--r--ui/colorpicker/ColorPickerButton.tscn16
-rw-r--r--ui/colorpicker/ColorSelect.gd25
-rw-r--r--ui/colorpicker/HexInput.gd18
-rw-r--r--ui/colorpicker/HueSlider.gd17
-rw-r--r--ui/theme/smallbutton.tres11
-rw-r--r--ui/theme/smallbuttonhover.tres11
23 files changed, 85 insertions, 232 deletions
diff --git a/Grid.gd b/Grid.gd
index 82d7319..1cbfabd 100644
--- a/Grid.gd
+++ b/Grid.gd
@@ -91,24 +91,25 @@ func reload_sprites() -> void:
matrix[i][j].load_texture()
-func rotate_pieces(degree: float) -> void:
+func flip_pieces() -> void:
for i in range(8):
for j in range(8):
var spot = matrix[i][j]
if spot:
- spot.sprite.rotation_degrees = degree
+ spot.sprite.flip_v = flipped
+ spot.sprite.flip_h = flipped
# spot.tween.interpolate_property(
# spot.sprite, "rotation_degrees", spot.sprite.rotation_degrees, degree, .5
# )
# spot.tween.start()
-func flip_labels(to_flip: bool) -> void:
+func flip_labels() -> void:
for i in range(8):
var numlabel = labels.numbers[i].get_node("Label")
var letlabel = labels.letters[i].get_node("Label")
var number: int
- if to_flip:
+ if flipped:
number = i + 1
else:
number = 8 - i
@@ -118,15 +119,17 @@ func flip_labels(to_flip: bool) -> void:
func flip_board():
if global_position == Vector2(800, 800):
+ flipped = false
global_position = Vector2(0, 0)
rotation_degrees = 0
- rotate_pieces(0)
- flip_labels(false)
+ flip_pieces()
+ flip_labels()
else:
+ flipped = true
global_position = Vector2(800, 800)
rotation_degrees = 180
- rotate_pieces(180)
- flip_labels(true)
+ flip_pieces()
+ flip_labels()
func init_labels() -> void:
@@ -170,7 +173,7 @@ func mat2str(mat = matrix) -> String:
func drawed() -> void:
- return # TODO: make gameovers work again
+ return # TODO: make gameovers work again
Events.emit_signal("game_over")
SoundFx.play("Draw")
yield(get_tree().create_timer(5), "timeout")
@@ -179,7 +182,7 @@ func drawed() -> void:
func win(winner) -> void:
- return # TODO: make gameovers work again
+ return # TODO: make gameovers work again
Events.emit_signal("game_over")
print(winner, " won the game in ", Globals.turns(), " turns!")
SoundFx.play("Victory")
diff --git a/assets/ui/button.png.import b/assets/ui/button.png.import
index 9a796ce..be6b5df 100644
--- a/assets/ui/button.png.import
+++ b/assets/ui/button.png.import
@@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
-flags/filter=true
+flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
diff --git a/assets/ui/buttonhover.png.import b/assets/ui/buttonhover.png.import
index 41aab96..d7e54d5 100644
--- a/assets/ui/buttonhover.png.import
+++ b/assets/ui/buttonhover.png.import
@@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
-flags/filter=true
+flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
diff --git a/assets/ui/checkedbox.png.import b/assets/ui/checkedbox.png.import
index e3ab98b..87c007a 100644
--- a/assets/ui/checkedbox.png.import
+++ b/assets/ui/checkedbox.png.import
@@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
-flags/filter=true
+flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
diff --git a/assets/ui/close.png b/assets/ui/close.png
new file mode 100644
index 0000000..225ad17
--- /dev/null
+++ b/assets/ui/close.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e81d7cc66b21f36b18db7bc29f0646a188e3791f69fc297bb38ac8144ed57da1
+size 772
diff --git a/assets/ui/smallbuttonhover.png.import b/assets/ui/close.png.import
index 5b3c306..cc924ee 100644
--- a/assets/ui/smallbuttonhover.png.import
+++ b/assets/ui/close.png.import
@@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
-path="res://.import/smallbuttonhover.png-667dff932bdae35ca0966828644ab441.stex"
+path="res://.import/close.png-76ad351b77a5cd8dfb1d712106bc5926.stex"
metadata={
"vram_texture": false
}
[deps]
-source_file="res://assets/ui/smallbuttonhover.png"
-dest_files=[ "res://.import/smallbuttonhover.png-667dff932bdae35ca0966828644ab441.stex" ]
+source_file="res://assets/ui/close.png"
+dest_files=[ "res://.import/close.png-76ad351b77a5cd8dfb1d712106bc5926.stex" ]
[params]
diff --git a/assets/ui/smallbutton.png b/assets/ui/smallbutton.png
deleted file mode 100644
index 7bf38fa..0000000
--- a/assets/ui/smallbutton.png
+++ /dev/null
@@ -1,3 +0,0 @@
-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
deleted file mode 100644
index 4f17e68..0000000
--- a/assets/ui/smallbutton.png.import
+++ /dev/null
@@ -1,35 +0,0 @@
-[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
deleted file mode 100644
index 717fa2f..0000000
--- a/assets/ui/smallbuttonhover.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:870cee2b425c68369985c3cd8dddb1dcc3dd3a20d63e5f357df80942c3c90a5c
-size 260
diff --git a/assets/ui/svg/close.svg b/assets/ui/svg/close.svg
new file mode 100644
index 0000000..3a3ae7a
--- /dev/null
+++ b/assets/ui/svg/close.svg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:37345ed189fdb6b6fc1997538a6f9637b1c1d36c488925d029018b3662a5c6e6
+size 1306
diff --git a/project.godot b/project.godot
index 4ce5038..4d6d36e 100644
--- a/project.godot
+++ b/project.godot
@@ -44,11 +44,6 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://Grid.gd"
}, {
-"base": "LineEdit",
-"class": "HexInput",
-"language": "GDScript",
-"path": "res://ui/colorpicker/HexInput.gd"
-}, {
"base": "Control",
"class": "HueSlider",
"language": "GDScript",
@@ -112,7 +107,6 @@ _global_script_class_icons={
"ColorSelect": "",
"FENLabel": "",
"Grid": "",
-"HexInput": "",
"HueSlider": "",
"King": "res://assets/pieces/california/wK.png",
"Knight": "res://assets/pieces/california/wN.png",
diff --git a/ui/GameUI.tscn b/ui/GameUI.tscn
index 74caf62..ecdcfbe 100644
--- a/ui/GameUI.tscn
+++ b/ui/GameUI.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=15 format=2]
+[gd_scene load_steps=16 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]
@@ -9,6 +9,7 @@
[ext_resource path="res://ui/Status.gd" type="Script" id=7]
[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/flipbutton.gd" type="Script" id=18]
[sub_resource type="DynamicFont" id=1]
@@ -114,6 +115,7 @@ margin_right = 225.0
margin_bottom = 50.0
rect_min_size = Vector2( 50, 50 )
script = ExtResource( 18 )
+texture = ExtResource( 17 )
[node name="WhiteTime" type="Label" parent="Holder/Back/VBox"]
margin_top = 453.0
diff --git a/ui/barbutton/BarTextureButton.gd b/ui/barbutton/BarTextureButton.gd
index 4b21324..fa776a5 100644
--- a/ui/barbutton/BarTextureButton.gd
+++ b/ui/barbutton/BarTextureButton.gd
@@ -7,9 +7,9 @@ var focused = false
export(Texture) var texture
-export(Color) var normal_color
-export(Color) var highlight_color
-export(Color) var pressed_color
+export(Color) var normal_color := Color.black
+export(Color) var highlight_color := Color(0.243137, 0.129412, 0.129412)
+export(Color) var pressed_color := Color(0.227451, 0.270588, 0.301961)
onready var texture_button = $Texture
onready var background = $Background
diff --git a/ui/barbutton/BarTextureButton.tscn b/ui/barbutton/BarTextureButton.tscn
index 9656641..a18b6d9 100644
--- a/ui/barbutton/BarTextureButton.tscn
+++ b/ui/barbutton/BarTextureButton.tscn
@@ -1,15 +1,11 @@
-[gd_scene load_steps=3 format=2]
+[gd_scene load_steps=2 format=2]
-[ext_resource path="res://assets/ui/whitespace.png" type="Texture" id=1]
[ext_resource path="res://ui/barbutton/BarTextureButton.gd" type="Script" id=2]
[node name="BarTextureButton" type="Control"]
margin_right = 64.0
margin_bottom = 64.0
script = ExtResource( 2 )
-texture = ExtResource( 1 )
-highlight_color = Color( 0.243137, 0.129412, 0.129412, 1 )
-pressed_color = Color( 0.227451, 0.270588, 0.301961, 1 )
[node name="Background" type="ColorRect" parent="."]
anchor_right = 1.0
diff --git a/ui/colorpicker/ColorPicker.gd b/ui/colorpicker/ColorPicker.gd
index 0eb4834..0aeed3e 100644
--- a/ui/colorpicker/ColorPicker.gd
+++ b/ui/colorpicker/ColorPicker.gd
@@ -8,7 +8,6 @@ signal done(color)
onready var oldcolorview = $Panel/V/H2/OldColorView
onready var newcolorpreview = $Panel/V/H2/NewColorPreview
-onready var hex = $Panel/V/hex
onready var colorselect = $Panel/V/H/ColorSelect
onready var hueslider = $Panel/V/H/HueSlider
@@ -26,7 +25,6 @@ func _ready():
func update_color():
newcolorpreview.color = color
- hex.color = color
colorselect.color = color
hueslider.hue = color.h
@@ -37,7 +35,7 @@ func set_color(newcolor):
emit_signal("color_changed", newcolor)
-func _on_OKButton_pressed():
+func done():
emit_signal("done", color)
diff --git a/ui/colorpicker/ColorPicker.tres b/ui/colorpicker/ColorPicker.tres
deleted file mode 100644
index d5f8c8a..0000000
--- a/ui/colorpicker/ColorPicker.tres
+++ /dev/null
@@ -1,17 +0,0 @@
-[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/theme/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/ColorPicker.tscn b/ui/colorpicker/ColorPicker.tscn
index d588716..99658d5 100644
--- a/ui/colorpicker/ColorPicker.tscn
+++ b/ui/colorpicker/ColorPicker.tscn
@@ -1,38 +1,37 @@
-[gd_scene load_steps=13 format=2]
+[gd_scene load_steps=9 format=2]
[ext_resource path="res://ui/colorpicker/ColorPicker.gd" type="Script" id=1]
-[ext_resource path="res://ui/colorpicker/ColorPicker.tres" type="Theme" id=2]
-[ext_resource path="res://assets/ui/Roboto-Medium.ttf" type="DynamicFontData" id=3]
-[ext_resource path="res://ui/theme/smallbutton.tres" type="StyleBox" id=4]
-[ext_resource path="res://ui/theme/smallbuttonhover.tres" type="StyleBox" id=5]
[ext_resource path="res://ui/colorpicker/HueSlider.gd" type="Script" id=6]
[ext_resource path="res://ui/colorpicker/ColorSelect.gd" type="Script" id=7]
-[ext_resource path="res://ui/colorpicker/HexInput.gd" type="Script" id=8]
[ext_resource path="res://ui/colorpicker/OldColorView.gd" type="Script" id=9]
[ext_resource path="res://ui/colorpicker/huepicker.material" type="Material" id=10]
[ext_resource path="res://ui/colorpicker/ColorSelect.material" type="Material" id=11]
-
-[sub_resource type="DynamicFont" id=1]
-size = 20
-font_data = ExtResource( 3 )
+[ext_resource path="res://ui/barbutton/BarTextureButton.tscn" type="PackedScene" id=12]
+[ext_resource path="res://assets/ui/close.png" type="Texture" id=13]
[node name="ColorPicker" type="Control"]
-margin_right = 128.0
-margin_bottom = 238.0
-theme = ExtResource( 2 )
+margin_right = 145.0
+margin_bottom = 145.0
script = ExtResource( 1 )
+__meta__ = {
+"_edit_group_": true,
+"_edit_lock_": true
+}
[node name="Panel" type="Panel" parent="."]
-margin_left = -12.0
-margin_top = -12.0
-margin_right = 136.0
-margin_bottom = 248.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+__meta__ = {
+"_edit_lock_": true
+}
[node name="V" type="VBoxContainer" parent="Panel"]
-margin_left = 12.0
-margin_top = 12.0
-margin_right = 137.0
-margin_bottom = 137.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_left = 10.0
+margin_top = 10.0
+margin_right = -10.0
+margin_bottom = -8.0
custom_constants/separation = 5
[node name="H" type="HBoxContainer" parent="Panel/V"]
@@ -77,10 +76,20 @@ margin_right = 125.0
margin_bottom = 125.0
custom_constants/separation = 0
+[node name="Close" parent="Panel/V/H2" instance=ExtResource( 12 )]
+margin_right = 20.0
+margin_bottom = 20.0
+rect_min_size = Vector2( 20, 0 )
+texture = ExtResource( 13 )
+normal_color = Color( 0.145098, 0.145098, 0.164706, 1 )
+highlight_color = Color( 0.1944, 0.3048, 0.36, 1 )
+pressed_color = Color( 0.3216, 0.414, 0.48, 1 )
+
[node name="Spacer" type="Control" parent="Panel/V/H2"]
+margin_left = 20.0
margin_right = 25.0
margin_bottom = 20.0
-rect_min_size = Vector2( 25, 0 )
+rect_min_size = Vector2( 5, 0 )
[node name="OldColorView" type="ColorRect" parent="Panel/V/H2"]
margin_left = 25.0
@@ -95,47 +104,10 @@ margin_right = 125.0
margin_bottom = 20.0
rect_min_size = Vector2( 50, 20 )
-[node name="hex" type="LineEdit" parent="Panel/V"]
-margin_top = 130.0
-margin_right = 125.0
-margin_bottom = 182.0
-max_length = 7
-context_menu_enabled = false
-placeholder_text = "#FFFFFF"
-caret_blink = true
-script = ExtResource( 8 )
-
-[node name="OKButton" type="Button" parent="Panel/V"]
-margin_top = 187.0
-margin_right = 125.0
-margin_bottom = 239.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( 5 )
-custom_styles/pressed = ExtResource( 5 )
-custom_styles/focus = ExtResource( 5 )
-custom_styles/normal = ExtResource( 4 )
-enabled_focus_mode = 0
-text = "OK"
-
-[node name="LineDrawer" type="Control" parent="Panel/V"]
-margin_top = 244.0
-margin_right = 125.0
-margin_bottom = 244.0
-
[connection signal="gui_input" from="Panel/V/H/HueSlider" to="Panel/V/H/HueSlider" method="_gui_input"]
[connection signal="hue_changed" from="Panel/V/H/HueSlider" to="Panel/V/H/ColorSelect" method="apply_hue"]
-[connection signal="mouse_entered" from="Panel/V/H/HueSlider" to="Panel/V/H/HueSlider" method="set_focused" binds= [ true ]]
-[connection signal="mouse_exited" from="Panel/V/H/HueSlider" to="Panel/V/H/HueSlider" method="set_focused" binds= [ false ]]
[connection signal="color_changed" from="Panel/V/H/ColorSelect" to="." method="_color_changed"]
-[connection signal="mouse_entered" from="Panel/V/H/ColorSelect" to="Panel/V/H/ColorSelect" method="set_focused" binds= [ true ]]
-[connection signal="mouse_exited" from="Panel/V/H/ColorSelect" to="Panel/V/H/ColorSelect" method="set_focused" binds= [ false ]]
+[connection signal="gui_input" from="Panel/V/H/ColorSelect" to="Panel/V/H/ColorSelect" method="_gui_input"]
+[connection signal="pressed" from="Panel/V/H2/Close" to="." method="done"]
[connection signal="color_changed" from="Panel/V/H2/OldColorView" to="." method="_color_changed"]
[connection signal="gui_input" from="Panel/V/H2/OldColorView" to="Panel/V/H2/OldColorView" method="_gui_input"]
-[connection signal="color_changed" from="Panel/V/hex" to="." method="_color_changed"]
-[connection signal="text_entered" from="Panel/V/hex" to="Panel/V/hex" method="_text_entered"]
-[connection signal="pressed" from="Panel/V/OKButton" to="." method="_on_OKButton_pressed"]
diff --git a/ui/colorpicker/ColorPickerButton.tscn b/ui/colorpicker/ColorPickerButton.tscn
index 170d04d..2608dc9 100644
--- a/ui/colorpicker/ColorPickerButton.tscn
+++ b/ui/colorpicker/ColorPickerButton.tscn
@@ -15,16 +15,16 @@ script = ExtResource( 2 )
[node name="ColorPicker" parent="." instance=ExtResource( 3 )]
visible = false
-margin_left = 88.0
-margin_top = 56.0
-margin_right = 290.0
-margin_bottom = 294.0
+margin_left = 32.0
+margin_top = 32.0
+margin_right = 177.0
+margin_bottom = 177.0
[node name="Position" type="Control" parent="."]
-margin_left = 80.0
-margin_top = 46.0
-margin_right = 120.0
-margin_bottom = 86.0
+margin_left = 32.0
+margin_top = 32.0
+margin_right = 72.0
+margin_bottom = 72.0
[connection signal="pressed" from="." to="ColorPicker" method="open"]
[connection signal="done" from="ColorPicker" to="." method="_on_ColorPicker_done"]
diff --git a/ui/colorpicker/ColorSelect.gd b/ui/colorpicker/ColorSelect.gd
index 211e9f9..5ee779b 100644
--- a/ui/colorpicker/ColorSelect.gd
+++ b/ui/colorpicker/ColorSelect.gd
@@ -3,8 +3,6 @@ class_name ColorSelect
var color: Color setget set_color
-var _focused := false setget set_focused
-
onready var shader_holder := $ShaderHolder
signal color_changed(color)
@@ -22,33 +20,24 @@ func apply_hue(newhue):
func _gui_input(event):
- if _focused and Input.is_action_pressed("click") and event is InputEventMouse:
+ if Input.is_action_pressed("click") and event is InputEventMouse:
var position = event.position
- var saturation = position.x / rect_size.x
- var value = 1 - (position.y / rect_size.y)
- if saturation > 1 or saturation < 0 or value > 1 or value < 0:
- _focused = false
- return
+ var saturation = clamp(position.x / rect_size.x, 0, 1)
+ var value = clamp(1 - (position.y / rect_size.y), 0, 1)
set_color(Color.from_hsv(color.h, saturation, value))
update()
emit_signal("color_changed", color)
func _draw():
+ var draw_color = color.inverted()
+
var vlinex = color.s * rect_size.x
var vliney = rect_size.y
- draw_line(Vector2(vlinex - 1, 0), Vector2(vlinex - 1, vliney), Color.black)
- draw_line(Vector2(vlinex, 0), Vector2(vlinex, vliney), Color.white)
- draw_line(Vector2(vlinex + 1, 0), Vector2(vlinex + 1, vliney), Color.black)
+ draw_line(Vector2(vlinex, 0), Vector2(vlinex, vliney), draw_color)
var hlinex = rect_size.x
var hliney = rect_size.y - color.v * rect_size.y
- draw_line(Vector2(0, hliney - 1), Vector2(hlinex, hliney - 1), Color.black)
- draw_line(Vector2(0, hliney), Vector2(hlinex, hliney), Color.white)
- draw_line(Vector2(0, hliney + 1), Vector2(hlinex, hliney + 1), Color.black)
-
-
-func set_focused(focused):
- _focused = focused
+ draw_line(Vector2(0, hliney), Vector2(hlinex, hliney), draw_color)
diff --git a/ui/colorpicker/HexInput.gd b/ui/colorpicker/HexInput.gd
deleted file mode 100644
index 975d342..0000000
--- a/ui/colorpicker/HexInput.gd
+++ /dev/null
@@ -1,18 +0,0 @@
-extends LineEdit
-class_name HexInput
-
-var color: Color setget set_color
-
-signal color_changed(color)
-
-
-func set_color(newcolor):
- color = newcolor
- var pos = caret_position
- text = "#" + color.to_html(false)
- caret_position = pos # make it in the right place
-
-
-func _text_entered(new_text: String):
- set_color(Color(new_text))
- emit_signal("color_changed", color)
diff --git a/ui/colorpicker/HueSlider.gd b/ui/colorpicker/HueSlider.gd
index c67584b..30bce64 100644
--- a/ui/colorpicker/HueSlider.gd
+++ b/ui/colorpicker/HueSlider.gd
@@ -1,28 +1,23 @@
extends Control
class_name HueSlider
-onready var line_drawer = $"../../LineDrawer"
-
signal hue_changed(hue)
var hue: float setget set_hue
-var _focused setget set_focused
func _gui_input(event):
if Input.is_action_pressed("click") and event is InputEventMouse:
var position = event.position
- var tmphue = position.y / rect_size.y
- if tmphue < 0 or tmphue > 1:
- _focused = false
- return
+ var tmphue = clamp(position.y / rect_size.y, 0, 1)
set_hue(tmphue)
emit_signal("hue_changed", hue)
func set_hue(newhue):
- hue = newhue
- update()
+ if newhue != hue:
+ hue = newhue
+ update()
func _draw():
@@ -31,7 +26,3 @@ func _draw():
draw_line(Vector2(0, y - 1), Vector2(x, y - 1), Color.black, 1, true)
draw_line(Vector2(0, y), Vector2(x, y), Color.white, 1, true)
draw_line(Vector2(0, y + 1), Vector2(x, y + 1), Color.black, 1, true)
-
-
-func set_focused(focused):
- _focused = focused
diff --git a/ui/theme/smallbutton.tres b/ui/theme/smallbutton.tres
deleted file mode 100644
index 8e87d11..0000000
--- a/ui/theme/smallbutton.tres
+++ /dev/null
@@ -1,11 +0,0 @@
-[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/theme/smallbuttonhover.tres b/ui/theme/smallbuttonhover.tres
deleted file mode 100644
index 3189e53..0000000
--- a/ui/theme/smallbuttonhover.tres
+++ /dev/null
@@ -1,11 +0,0 @@
-[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