mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 11:54:44 -04:00
Canvas transparent background changes on dark & gold themes
It's also in Global.gd instead of Canvas.gd
This commit is contained in:
parent
d08841da62
commit
c6ded721d1
11 changed files with 48 additions and 21 deletions
|
@ -3,7 +3,6 @@ class_name Canvas
|
|||
|
||||
var layers := []
|
||||
var current_layer_index := 0
|
||||
var trans_background : ImageTexture
|
||||
var location := Vector2.ZERO
|
||||
var size := Vector2(64, 64)
|
||||
var frame := 0 setget frame_changed
|
||||
|
@ -27,9 +26,6 @@ var line_2d : Line2D
|
|||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
Global.can_draw = false
|
||||
#Background
|
||||
trans_background = ImageTexture.new()
|
||||
trans_background.create_from_image(preload("res://Assets/Graphics/Transparent Background.png"), 0)
|
||||
|
||||
#The sprite itself
|
||||
if layers.empty():
|
||||
|
@ -381,7 +377,7 @@ func get_layer_container(layer_index : int) -> LayerContainer:
|
|||
return null
|
||||
|
||||
func _draw() -> void:
|
||||
draw_texture_rect(trans_background, Rect2(location, size), true) #Draw transparent background
|
||||
draw_texture_rect(Global.transparent_background, Rect2(location, size), true) #Draw transparent background
|
||||
#Onion Skinning
|
||||
#Past
|
||||
if Global.onion_skinning_past_rate > 0:
|
||||
|
|
|
@ -17,6 +17,7 @@ var canvases := []
|
|||
var hidden_canvases := []
|
||||
var left_cursor_tool_texture : ImageTexture
|
||||
var right_cursor_tool_texture : ImageTexture
|
||||
var transparent_background : ImageTexture
|
||||
# warning-ignore:unused_class_variable
|
||||
var selected_pixels := []
|
||||
var image_clipboard : Image
|
||||
|
@ -205,6 +206,8 @@ func _ready() -> void:
|
|||
config_cache.load("user://cache.ini")
|
||||
|
||||
undo_redo = UndoRedo.new()
|
||||
transparent_background = ImageTexture.new()
|
||||
transparent_background.create_from_image(preload("res://Assets/Graphics/Transparent Background Godot.png"), 0)
|
||||
image_clipboard = Image.new()
|
||||
|
||||
var root = get_tree().get_root()
|
||||
|
|
|
@ -32,24 +32,28 @@ func change_theme(ID : int) -> void:
|
|||
var ruler_style
|
||||
if ID == 0: #Dark Theme
|
||||
Global.theme_type = "Dark"
|
||||
VisualServer.set_default_clear_color(Color(0.301961, 0.301961, 0.301961))
|
||||
Global.transparent_background.create_from_image(preload("res://Assets/Graphics/Transparent Background Dark.png"), 0)
|
||||
VisualServer.set_default_clear_color(Color(0.247059, 0.25098, 0.247059))
|
||||
main_theme = preload("res://Themes & Styles/Dark Theme/Dark Theme.tres")
|
||||
top_menu_style = preload("res://Themes & Styles/Dark Theme/DarkTopMenuStyle.tres")
|
||||
ruler_style = preload("res://Themes & Styles/Dark Theme/DarkRulerStyle.tres")
|
||||
elif ID == 1: #Gray Theme
|
||||
Global.theme_type = "Dark"
|
||||
Global.transparent_background.create_from_image(preload("res://Assets/Graphics/Transparent Background Godot.png"), 0)
|
||||
VisualServer.set_default_clear_color(Color(0.301961, 0.301961, 0.301961))
|
||||
main_theme = preload("res://Themes & Styles/Gray Theme/Gray Theme.tres")
|
||||
top_menu_style = preload("res://Themes & Styles/Gray Theme/GrayTopMenuStyle.tres")
|
||||
ruler_style = preload("res://Themes & Styles/Dark Theme/DarkRulerStyle.tres")
|
||||
elif ID == 2: #Godot's Theme
|
||||
Global.theme_type = "Dark"
|
||||
Global.transparent_background.create_from_image(preload("res://Assets/Graphics/Transparent Background Godot.png"), 0)
|
||||
VisualServer.set_default_clear_color(Color(0.301961, 0.301961, 0.301961))
|
||||
main_theme = preload("res://Themes & Styles/Godot\'s Theme/Godot\'s Theme.tres")
|
||||
top_menu_style = preload("res://Themes & Styles/Godot\'s Theme/TopMenuStyle.tres")
|
||||
ruler_style = preload("res://Themes & Styles/Godot\'s Theme/RulerStyle.tres")
|
||||
elif ID == 3: #Gold Theme
|
||||
Global.theme_type = "Light"
|
||||
Global.transparent_background.create_from_image(preload("res://Assets/Graphics/Transparent Background Gold.png"), 0)
|
||||
VisualServer.set_default_clear_color(Color(0.694118, 0.619608, 0.458824))
|
||||
main_theme = preload("res://Themes & Styles/Gold Theme/Gold Theme.tres")
|
||||
top_menu_style = preload("res://Themes & Styles/Gold Theme/GoldTopMenuStyle.tres")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue