Circle can now set points count and anti-aliasing! (=

This commit is contained in:
Harmony Honey 2022-12-20 20:16:18 -05:00
parent c86c328ab0
commit 391e47bcc4
6 changed files with 44 additions and 22 deletions

View file

@ -4,13 +4,28 @@ extends CanvasItem
export var radius := 50.0 setget set_radius
export var offset := Vector2.ZERO setget set_offset
var gon := PoolVector2Array()
export var points := 16 setget set_points
func u():
gon = []
for i in points:
gon.append(offset + (radius * Vector2.RIGHT.rotated(TAU * (float(i) / points))))
update()
func _draw():
draw_circle(offset, radius, Color.white)
draw_colored_polygon(gon, Color.white, PoolVector2Array(), null, null, true)
func set_radius(arg := radius):
radius = abs(arg)
update()
u()
func set_offset(arg := offset):
offset = arg
update()
u()
func set_points(arg := points):
points = max(arg, 3)
u()

View file

@ -489,6 +489,7 @@ modulate = Color( 1, 0.717647, 0.717647, 1 )
position = Vector2( 0, -25 )
script = ExtResource( 3 )
radius = 20.0
points = 24
[node name="Eyes" type="Node2D" parent="Sprites/Root/Body"]
modulate = Color( 0.498039, 0, 1, 1 )
@ -519,12 +520,14 @@ use_parent_material = true
position = Vector2( -25, 5 )
script = ExtResource( 3 )
radius = 7.5
points = 12
[node name="Right" type="Node2D" parent="Sprites/Hands"]
use_parent_material = true
position = Vector2( 25, 5 )
script = ExtResource( 3 )
radius = 7.5
points = 12
[node name="SpriteArea" type="Area2D" parent="Sprites"]
visible = false

View file

@ -31,7 +31,9 @@ modulate = Color( 0.494118, 0.890196, 0.337255, 1 )
self_modulate = Color( 1, 1, 1, 0 )
texture = ExtResource( 1 )
[node name="Line2D" type="Line2D" parent="Sprite"]
[node name="Lines" type="Node2D" parent="Sprite"]
[node name="Line2D" type="Line2D" parent="Sprite/Lines"]
points = PoolVector2Array( 0, -130, 0, 130 )
width = 140.0
default_color = Color( 1, 1, 1, 1 )
@ -41,7 +43,7 @@ end_cap_mode = 2
round_precision = 12
antialiased = true
[node name="Line2D2" type="Line2D" parent="Sprite"]
[node name="Line2D2" type="Line2D" parent="Sprite/Lines"]
points = PoolVector2Array( -130, 0, 130, 0 )
width = 140.0
default_color = Color( 1, 1, 1, 1 )
@ -51,7 +53,7 @@ end_cap_mode = 2
round_precision = 12
antialiased = true
[node name="Line2D3" type="Line2D" parent="Sprite"]
[node name="Line2D3" type="Line2D" parent="Sprite/Lines"]
points = PoolVector2Array( -100, -100, 100, 100 )
width = 140.0
default_color = Color( 1, 1, 1, 1 )
@ -61,7 +63,7 @@ end_cap_mode = 2
round_precision = 12
antialiased = true
[node name="Line2D4" type="Line2D" parent="Sprite"]
[node name="Line2D4" type="Line2D" parent="Sprite/Lines"]
points = PoolVector2Array( 100, -100, -100, 100 )
width = 140.0
default_color = Color( 1, 1, 1, 1 )

View file

@ -156,6 +156,7 @@ func set_open(arg := is_open):
fill_items()
UI.menu_keys(text_accept, text_cancel)
open()
row()
else:
emit_signal("closed")
close()

View file

@ -1,7 +1,6 @@
extends MenuBase
export var palette : PoolColorArray = []
onready var palette : PoolColorArray = Shared.player.palette
var player
var pale = [3,2,2,1,0,16]
@ -9,9 +8,6 @@ var pale = [3,2,2,1,0,16]
onready var arrows := $Dialog/Arrows.get_children()
export var arrow_margin := Vector2.ZERO
func _ready():
palette = Shared.player.palette
func row():
if !arrows: return
var c = items[cursor]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=2]
[gd_scene load_steps=14 format=2]
[ext_resource path="res://media/font/mini-wakuwaku.otf" type="DynamicFontData" id=1]
[ext_resource path="res://src/menu/MenuMakeover.gd" type="Script" id=2]
@ -6,7 +6,6 @@
[ext_resource path="res://src/actor/Hair.tscn" type="PackedScene" id=4]
[ext_resource path="res://media/font/profile/OptionsItem.tres" type="DynamicFont" id=5]
[ext_resource path="res://src/actor/Circle.gd" type="Script" id=6]
[ext_resource path="res://media/image/UI/hand.png" type="Texture" id=7]
[ext_resource path="res://src/menu/options/scroll/Color.gd" type="Script" id=8]
[ext_resource path="res://media/image/UI/eye.svg" type="Texture" id=9]
@ -178,6 +177,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Hair" parent="Dialog/List/Hair/HBoxContainer/Circle" instance=ExtResource( 4 )]
position = Vector2( 45, 32 )
@ -195,6 +195,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Hair" parent="Dialog/List/Hair/HBoxContainer/Circle2" instance=ExtResource( 4 )]
position = Vector2( 45, 32 )
@ -212,6 +213,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Hair" parent="Dialog/List/Hair/HBoxContainer/Circle3" instance=ExtResource( 4 )]
position = Vector2( 45, 32 )
@ -228,6 +230,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Hair" parent="Dialog/List/Hair/HBoxContainer/Circle4" instance=ExtResource( 4 )]
position = Vector2( 45, 32 )
@ -245,6 +248,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Hair" parent="Dialog/List/Hair/HBoxContainer/Circle5" instance=ExtResource( 4 )]
position = Vector2( 45, 32 )
@ -277,6 +281,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Eyes" type="Node2D" parent="Dialog/List/Eye/HBoxContainer/Circle"]
position = Vector2( 35, 35 )
@ -307,6 +312,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Eyes" type="Node2D" parent="Dialog/List/Eye/HBoxContainer/Circle2"]
position = Vector2( 35, 35 )
@ -371,6 +377,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Eyes" type="Node2D" parent="Dialog/List/Eye/HBoxContainer/Circle4"]
position = Vector2( 35, 35 )
@ -401,6 +408,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Eyes" type="Node2D" parent="Dialog/List/Eye/HBoxContainer/Circle5"]
position = Vector2( 35, 35 )
@ -467,14 +475,6 @@ script = ExtResource( 6 )
radius = 30.0
offset = Vector2( 35, 35 )
[node name="TextureRect" type="TextureRect" parent="Dialog/List/Skin/HBoxContainer/Circle3"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 7 )
expand = true
stretch_mode = 5
[node name="Circle4" type="Control" parent="Dialog/List/Skin/HBoxContainer"]
margin_left = 244.0
margin_right = 314.0
@ -518,6 +518,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Fit" type="Node2D" parent="Dialog/List/Fit/HBoxContainer/Circle"]
position = Vector2( 35, 35 )
@ -555,6 +556,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Fit" type="Node2D" parent="Dialog/List/Fit/HBoxContainer/Circle2"]
position = Vector2( 35, 35 )
@ -592,6 +594,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Fit" type="Node2D" parent="Dialog/List/Fit/HBoxContainer/Circle3"]
position = Vector2( 35, 35 )
@ -628,6 +631,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Fit" type="Node2D" parent="Dialog/List/Fit/HBoxContainer/Circle4"]
position = Vector2( 35, 35 )
@ -665,6 +669,7 @@ rect_min_size = Vector2( 70, 70 )
script = ExtResource( 6 )
radius = 0.0
offset = Vector2( 35, 35 )
points = 8
[node name="Fit" type="Node2D" parent="Dialog/List/Fit/HBoxContainer/Circle5"]
position = Vector2( 35, 35 )