Skip to content

Commit

Permalink
feat(backend): Removes an image warning
Browse files Browse the repository at this point in the history
From [here](ivanskodje-godotengine#8)

Godot 3.4.x throws a warning to load image textures directly instead of loading them dynamically as it may not work in exported games. The Godot documentation also warns against this. see https://docs.godotengine.org/en/stable/classes/class_imagetexture.html
  • Loading branch information
pablojimenezmateo committed Jun 7, 2022
1 parent 482455b commit eb06315
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions addons/calendar_button/scripts/calendar_script.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,8 @@ func _enter_tree():
refresh_data()

func setup_calendar_icon():
var normal_texture := create_button_texture("btn_32x32_03.png")
set_normal_texture(normal_texture)

var pressed_texture := create_button_texture("btn_32x32_04.png")
set_pressed_texture(pressed_texture)

func create_button_texture(var image_name : String) -> ImageTexture:
var image_normal := Image.new()
image_normal.load("res://addons/calendar_button/btn_img/" + image_name)
var image_texture_normal := ImageTexture.new()
image_texture_normal.create_from_image(image_normal)
return image_texture_normal
texture_normal = load("res://addons/calendar_button/btn_img/btn_32x32_03.png")
texture_pressed = load("res://addons/calendar_button/btn_img/btn_32x32_04.png")

func create_popup_scene() -> Popup:
return preload("res://addons/calendar_button/popup.tscn").instance() as Popup
Expand Down

0 comments on commit eb06315

Please sign in to comment.