You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
940 B
28 lines
940 B
extends Control
|
|
|
|
export var default_width = 500
|
|
export var default_height = 500
|
|
export var default_spacing = 5
|
|
var width = default_width
|
|
var height = default_height
|
|
var spacing = default_spacing
|
|
|
|
var poisson_disc_sampling: PoissonDiscSampling = PoissonDiscSampling.new()
|
|
var points = []
|
|
|
|
signal new_poisson(points)
|
|
|
|
func _ready():
|
|
$HBoxContainer/Properties/width/width_edit.text = str(default_width)
|
|
$HBoxContainer/Properties/height/height_edit.text = str(default_height)
|
|
$HBoxContainer/Properties/spacing/spacing_edit.text = str(default_spacing)
|
|
pass
|
|
|
|
func _on_Button_pressed():
|
|
width = int($HBoxContainer/Properties/width/width_edit.text)
|
|
height = int($HBoxContainer/Properties/height/height_edit.text)
|
|
spacing = int($HBoxContainer/Properties/spacing/spacing_edit.text)
|
|
var rect = Rect2(Vector2(0, 0), Vector2(width, height))
|
|
points = poisson_disc_sampling.generate_points(spacing, rect, 20)
|
|
emit_signal("new_poisson", points)
|
|
|
|
|