ChocolateBird/scripts/managers/ThemeManager.gd

47 lines
1.5 KiB
GDScript3
Raw Normal View History

extends Node
var menu_r5 := 0
var menu_g5 := 0
var menu_b5 := 16
var theme := preload('res://theme/menu_theme.tres')
var border_image: Image = preload('res://theme/border.png')
var border_texture := preload('res://theme/border_imagetexture.tres')
var border_stylebox := preload('res://theme/border_stylebox.tres')
const r1 := Rect2(4, 3, 2, 4)
const r2 := Rect2(3, 4, 4, 2)
func update_menu_color() -> void:
var c := Color(menu_r5/31.0, menu_g5/31.0, menu_b5/31.0)
# print(c)
border_image.fill_rect(r1, c)
border_image.fill_rect(r2, c)
border_texture.set_data(border_image)
func set_menu_color_555(r5: int, g5: int, b5: int) -> void:
self.menu_r5 = r5
self.menu_g5 = g5
self.menu_b5 = b5
self.update_configuration_warning()
# Not really theme as such, move later?
const icon_ability_command := preload('res://theme/icons/ability_command.tres')
const icon_ability_character := preload('res://theme/icons/ability_character.tres')
const icon_ability_party := preload('res://theme/icons/ability_party.tres')
const icon_ability_menu := preload('res://theme/icons/ability_menu.tres')
func get_ability_icon(id: int) -> Texture:
if id < 128:
return icon_ability_command
if ((0x9A <= id) and (id <= 0x9E)) or (id == 0xA0):
return icon_ability_party
return icon_ability_character
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
border_texture.create_from_image(border_image, 0)
self.update_menu_color()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
# pass