GraphicsEditor/addons/graphics_editor/CanvasOutline.gd

24 lines
556 B
GDScript3
Raw Normal View History

2019-08-04 09:57:42 +02:00
tool
extends Control
export var color = Color()
2019-08-06 03:19:40 +02:00
export var width = 3
2019-08-04 09:57:42 +02:00
func _ready():
pass
func _draw():
2019-08-06 03:19:40 +02:00
draw_outline_box(rect_size, color, width)
2019-08-04 09:57:42 +02:00
func draw_outline_box(size, color, width):
#Top line
draw_line(Vector2(0 + 1, 0), Vector2(size.x, 0), color, width)
#Left line
draw_line(Vector2(0 + 1, 0), Vector2(0, size.y), color, width)
#Bottom line
draw_line(Vector2(0 + 1, size.y), Vector2(size.x, size.y), color, width)
#Right line
draw_line(Vector2(size.x, 0), Vector2(size.x, size.y), color, width)
func _process(delta):
update()