2019-08-04 09:57:42 +02:00
|
|
|
tool
|
|
|
|
extends Control
|
|
|
|
|
|
|
|
export var color = Color()
|
|
|
|
|
2020-10-26 17:01:31 +01:00
|
|
|
|
2019-08-04 09:57:42 +02:00
|
|
|
func _ready():
|
|
|
|
pass
|
|
|
|
|
2020-10-26 17:01:31 +01:00
|
|
|
|
2019-08-04 09:57:42 +02:00
|
|
|
func _draw():
|
2020-10-26 17:01:31 +01:00
|
|
|
var size = get_parent().rect_size
|
|
|
|
var pos = Vector2.ZERO #get_parent().rect_global_position
|
2020-10-25 18:39:10 +01:00
|
|
|
draw_outline_box(pos, size, color, 1)
|
2019-08-04 09:57:42 +02:00
|
|
|
|
2020-10-26 17:01:31 +01:00
|
|
|
|
2020-10-25 18:39:10 +01:00
|
|
|
func draw_outline_box(pos, size, color, width):
|
2019-08-04 09:57:42 +02:00
|
|
|
#Top line
|
2020-10-25 18:39:10 +01:00
|
|
|
draw_line(pos, pos + Vector2(size.x, 0), color, width)
|
2019-08-04 09:57:42 +02:00
|
|
|
#Left line
|
2020-10-25 18:39:10 +01:00
|
|
|
draw_line(pos, pos + Vector2(0, size.y), color, width)
|
2019-08-04 09:57:42 +02:00
|
|
|
#Bottom line
|
2020-10-25 18:39:10 +01:00
|
|
|
draw_line(pos + Vector2(0, size.y), pos + Vector2(size.x, size.y), color, width)
|
2019-08-04 09:57:42 +02:00
|
|
|
#Right line
|
2020-10-25 18:39:10 +01:00
|
|
|
draw_line(pos + Vector2(size.x, 0), pos + Vector2(size.x, size.y), color, width)
|
2019-08-04 09:57:42 +02:00
|
|
|
|
2020-10-26 17:01:31 +01:00
|
|
|
|
2019-08-04 09:57:42 +02:00
|
|
|
func _process(delta):
|
2020-11-09 12:53:55 +01:00
|
|
|
if not is_visible_in_tree():
|
|
|
|
return
|
2019-11-23 12:33:43 +01:00
|
|
|
update()
|