initial commit
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
[gd_scene format=3 uid="uid://vmidl7iyrccl"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bkuqj2wtyqkjx" path="res://menus/display_settings/display_settings_node.gd" id="1_f476r"]
|
||||
[ext_resource type="PackedScene" uid="uid://b55tkiwybe2m7" path="res://menus/display_settings/shape_settings.tscn" id="2_0xivn"]
|
||||
|
||||
[node name="DisplaySettings" type="Node2D" unique_id=1870712361]
|
||||
script = ExtResource("1_f476r")
|
||||
metadata/_custom_type_script = "uid://bkuqj2wtyqkjx"
|
||||
|
||||
[node name="ShapeSettings" parent="." unique_id=1568036432 instance=ExtResource("2_0xivn")]
|
||||
@@ -0,0 +1,16 @@
|
||||
extends Node2D
|
||||
class_name DisplaySettingsNode
|
||||
|
||||
var window_size: Vector2i
|
||||
var window_center: Vector2i
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
window_size = DisplayServer.window_get_size()
|
||||
window_center = Vector2i(window_size.x/2, window_size.y/2)
|
||||
position = window_center
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
@@ -0,0 +1 @@
|
||||
uid://bkuqj2wtyqkjx
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
extends Polygon2D
|
||||
|
||||
var num_circle_points: int = 100
|
||||
var circle_radius: float = 100.
|
||||
|
||||
var window_size: Vector2i
|
||||
var window_center: Vector2i
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
window_size = DisplayServer.window_get_size()
|
||||
window_center = Vector2i(window_size.x/2, window_size.y/2)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_option_button_item_selected(index: int) -> void:
|
||||
if index == 0:
|
||||
# circle
|
||||
_generate_circle_points()
|
||||
elif index == 1:
|
||||
# rectangle
|
||||
pass
|
||||
|
||||
func _generate_circle_points():
|
||||
var new_polygon = []
|
||||
for i in range(num_circle_points-1):
|
||||
var rot_angle: float = 2.*PI * ((i+1) / float(num_circle_points))
|
||||
var x = circle_radius * cos(rot_angle)
|
||||
var y = circle_radius * sin(rot_angle)
|
||||
new_polygon.append(Vector2(x, y))
|
||||
polygon = PackedVector2Array(new_polygon)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://y4ip1k68kcs7
|
||||
@@ -0,0 +1,44 @@
|
||||
[gd_scene format=3 uid="uid://b55tkiwybe2m7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bymmfukcuf4ud" path="res://menus/display_settings/shape_settings_panel.gd" id="1_2lsof"]
|
||||
[ext_resource type="Script" uid="uid://y4ip1k68kcs7" path="res://menus/display_settings/shape_render.gd" id="2_wjy8x"]
|
||||
|
||||
[node name="ShapeSettings" type="Control" unique_id=1568036432]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Panel" type="Panel" parent="." unique_id=1960042247]
|
||||
layout_mode = 0
|
||||
offset_right = 315.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("1_2lsof")
|
||||
|
||||
[node name="Label" type="Label" parent="Panel" unique_id=116013553]
|
||||
layout_mode = 0
|
||||
offset_left = 4.0
|
||||
offset_top = 8.0
|
||||
offset_right = 112.0
|
||||
offset_bottom = 32.0
|
||||
text = "Display Shape"
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="Panel" unique_id=715446751]
|
||||
layout_mode = 0
|
||||
offset_left = 186.0
|
||||
offset_top = 4.0
|
||||
offset_right = 311.0
|
||||
offset_bottom = 36.0
|
||||
item_count = 2
|
||||
popup/item_0/text = "Circular"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "Rectangular"
|
||||
popup/item_1/id = 1
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="." unique_id=2092896646]
|
||||
invert_border = 10.0
|
||||
script = ExtResource("2_wjy8x")
|
||||
|
||||
[connection signal="item_selected" from="Panel/OptionButton" to="Polygon2D" method="_on_option_button_item_selected"]
|
||||
@@ -0,0 +1,10 @@
|
||||
extends Panel
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
position = Vector2(-size.x/2, -size.y/2)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
@@ -0,0 +1 @@
|
||||
uid://bymmfukcuf4ud
|
||||
Reference in New Issue
Block a user