Use the current color for drawing.

This commit is contained in:
Relintai 2022-11-16 14:22:24 +01:00
parent 6ac6df6e7d
commit a58c95caaf
2 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,12 @@ extends PaintCanvas
var _mouse_down : bool = false var _mouse_down : bool = false
func draw(local_position : Vector2) -> void: func draw(local_position : Vector2) -> void:
set_pixel(local_position.x, local_position.y, Color(1, 1, 1, 1)) var proj : PaintProject = get_paint_project()
if !proj:
print("!proj!")
set_pixel(local_position.x, local_position.y, proj.current_color)
func is_local(var pos : Vector2) -> bool: func is_local(var pos : Vector2) -> bool:
if pos.x < 0 || pos.y < 0 || pos.x > size.x || pos.y > size.y: if pos.x < 0 || pos.y < 0 || pos.x > size.x || pos.y > size.y:

View File

@ -5,7 +5,7 @@
[node name="PaintProject" type="PaintProject"] [node name="PaintProject" type="PaintProject"]
size = Vector2i( 128, 128 ) size = Vector2i( 128, 128 )
current_color = Color( 0.86538, 0.233915, 0.49333, 1 ) current_color = Color( 0.511169, 0.141401, 0.0907945, 1 )
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="PaintCanvas" type="PaintCanvas" parent="."] [node name="PaintCanvas" type="PaintCanvas" parent="."]