Skip to content

Commit

Permalink
highlighter with alpha color
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Petit committed Jul 11, 2023
1 parent 99760f4 commit 9feba64
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lorien/Config.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class_name Config

const VERSION_MAJOR := 0
const VERSION_MINOR := 6
const VERSION_MINOR := 7
const VERSION_PATCH := 0
const VERSION_STATUS := "-dev"
const VERSION_STRING := "%d.%d.%d%s" % [VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_STATUS]
Expand Down
8 changes: 5 additions & 3 deletions lorien/InfiniteCanvas/InfiniteCanvas.gd
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,14 @@ func start_stroke() -> void:
var _selected_layer := _active_tool.get_layer()
_current_stroke = BRUSH_STROKE.instance()
_current_stroke.layer = _selected_layer
_current_stroke.size = _brush_size
_current_stroke.color = _brush_color

if _selected_layer == 1 :
_current_stroke.size = _brush_size * 10
_current_stroke.color = Color(_brush_color.r,_brush_color.g,_brush_color.b,0.8)
_strokes_highlighter.add_child(_current_stroke)
else :
_current_stroke.size = _brush_size
_current_stroke.color = _brush_color
_strokes_brush.add_child(_current_stroke)

_optimizer.reset()
Expand All @@ -205,7 +207,7 @@ func add_stroke(stroke: BrushStroke) -> void:
if _current_project != null:
_current_project.strokes.append(stroke)
if stroke.layer == 1 :
_strokes_highlighter.add_child(stroke)
_strokes_highlighter.add_child(stroke)
else :
_strokes_brush.add_child(stroke)
info.point_count += stroke.points.size()
Expand Down
11 changes: 8 additions & 3 deletions lorien/ProjectManager/Serializer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const BRUSH_STROKE = preload("res://BrushStroke/BrushStroke.tscn")
const COMPRESSION_METHOD = File.COMPRESSION_DEFLATE
const POINT_ELEM_SIZE := 3

const VERSION_NUMBER := 2
const VERSION_NUMBER := 3
const TYPE_BRUSH_STROKE := 0
const TYPE_ERASER_STROKE_DEPRECATED := 1 # Deprecated since v0; will be ignored when read; structually the same as normal brush stroke

Expand Down Expand Up @@ -58,7 +58,7 @@ static func load_project(project: Project) -> void:
while true:

var layer := 0
if _version_number == 2 :
if _version_number >= 2 :
layer = file.get_8()

# Type
Expand All @@ -72,7 +72,11 @@ static func load_project(project: Project) -> void:
var r := file.get_8()
var g := file.get_8()
var b := file.get_8()
brush_stroke.color = Color(r/255.0, g/255.0, b/255.0, 1.0)
var a := 255.0
if _version_number >= 3 :
a = file.get_8()

brush_stroke.color = Color(r/255.0, g/255.0, b/255.0, a/255.0)

# Brush size
brush_stroke.size = file.get_16()
Expand Down Expand Up @@ -140,6 +144,7 @@ static func _save_strokes(file: File, strokes: Array) -> void:
file.store_8(stroke.color.r8)
file.store_8(stroke.color.g8)
file.store_8(stroke.color.b8)
file.store_8(stroke.color.a8)

# Brush size
file.store_16(int(stroke.size))
Expand Down

0 comments on commit 9feba64

Please sign in to comment.