1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Don't change the cursor tool icon texture _input() call

Seems like my past self has made some pretty embarassing optimization mistakes...
This commit is contained in:
Manolis Papadeas 2021-11-23 02:52:21 +02:00
parent 536250f517
commit 41b5db4622
3 changed files with 9 additions and 16 deletions

View file

@ -25,9 +25,6 @@ var panel_layout = PanelLayout.AUTO
var layers_changed_skip := false
var can_draw := false
var has_focus := false
var cursor_image = preload("res://assets/graphics/cursor.png")
var left_cursor_tool_texture := StreamTexture.new()
var right_cursor_tool_texture := StreamTexture.new()
var play_only_tags := true
var show_x_symmetry_axis := false
@ -140,12 +137,6 @@ onready var zoom_level_spinbox : SpinBox = control.find_node("ZoomSpinbox")
onready var cursor_position_label : Label = control.find_node("CursorPosition")
onready var current_frame_mark_label : Label = control.find_node("CurrentFrameMark")
onready var open_sprites_dialog : FileDialog = control.find_node("OpenSprite")
onready var save_sprites_dialog : FileDialog = control.find_node("SaveSprite")
onready var save_sprites_html5_dialog : ConfirmationDialog = control.find_node("SaveSpriteHTML5")
onready var export_dialog : AcceptDialog = control.find_node("ExportDialog")
onready var preferences_dialog : AcceptDialog = control.find_node("PreferencesDialog")
onready var animation_timeline : Panel = control.find_node("AnimationTimeline")
onready var animation_timer : Timer = animation_timeline.find_node("AnimationTimer")
onready var frame_ids : HBoxContainer = animation_timeline.find_node("FrameIDs")
@ -154,11 +145,9 @@ onready var play_backwards : BaseButton = animation_timeline.find_node("PlayBack
onready var layers_container : VBoxContainer = animation_timeline.find_node("LayersContainer")
onready var frames_container : VBoxContainer = animation_timeline.find_node("FramesContainer")
onready var tag_container : Control = animation_timeline.find_node("TagContainer")
onready var remove_frame_button : BaseButton = animation_timeline.find_node("DeleteFrame")
onready var move_left_frame_button : BaseButton = animation_timeline.find_node("MoveLeft")
onready var move_right_frame_button : BaseButton = animation_timeline.find_node("MoveRight")
onready var remove_layer_button : BaseButton = animation_timeline.find_node("RemoveLayer")
onready var move_up_layer_button : BaseButton = animation_timeline.find_node("MoveUpLayer")
onready var move_down_layer_button : BaseButton = animation_timeline.find_node("MoveDownLayer")
@ -166,6 +155,11 @@ onready var merge_down_layer_button : BaseButton = animation_timeline.find_node(
onready var layer_opacity_slider : HSlider = animation_timeline.find_node("OpacitySlider")
onready var layer_opacity_spinbox : SpinBox = animation_timeline.find_node("OpacitySpinBox")
onready var open_sprites_dialog : FileDialog = control.find_node("OpenSprite")
onready var save_sprites_dialog : FileDialog = control.find_node("SaveSprite")
onready var save_sprites_html5_dialog : ConfirmationDialog = control.find_node("SaveSpriteHTML5")
onready var export_dialog : AcceptDialog = control.find_node("ExportDialog")
onready var preferences_dialog : AcceptDialog = control.find_node("PreferencesDialog")
onready var error_dialog : AcceptDialog = control.find_node("ErrorDialog")
onready var quit_and_save_dialog : ConfirmationDialog = control.find_node("QuitAndSaveDialog")

View file

@ -183,9 +183,9 @@ func update_tool_buttons() -> void:
func update_tool_cursors() -> void:
var left_image = load("res://assets/graphics/tools/cursors/%s.png" % _slots[BUTTON_LEFT].tool_node.name.to_lower())
Global.left_cursor_tool_texture = left_image
Global.left_cursor.texture = left_image
var right_image = load("res://assets/graphics/tools/cursors/%s.png" % _slots[BUTTON_RIGHT].tool_node.name.to_lower())
Global.right_cursor_tool_texture = right_image
Global.right_cursor.texture = right_image
func draw_indicator() -> void:

View file

@ -6,6 +6,7 @@ var redone := false
var is_quitting_on_save := false
var tallscreen_is_active = false
var alternate_transparent_background := ColorRect.new()
var cursor_image = preload("res://assets/graphics/cursor.png")
onready var ui := $MenuAndUI/UI
onready var tools_and_canvas : HSplitContainer = $MenuAndUI/UI/ToolsAndCanvas
@ -38,7 +39,7 @@ func _ready() -> void:
if OS.get_name() == "OSX":
use_osx_shortcuts()
Input.set_custom_mouse_cursor(Global.cursor_image, Input.CURSOR_CROSS, Vector2(15, 15))
Input.set_custom_mouse_cursor(cursor_image, Input.CURSOR_CROSS, Vector2(15, 15))
Global.window_title = tr("untitled") + " - Pixelorama " + Global.current_version
Global.current_project.layers[0].name = tr("Layer") + " 0"
@ -196,9 +197,7 @@ func reparent_node_to(node : Node, dest : Node, pos : int) -> bool:
func _input(event : InputEvent) -> void:
Global.left_cursor.position = get_global_mouse_position() + Vector2(-32, 32)
Global.left_cursor.texture = Global.left_cursor_tool_texture
Global.right_cursor.position = get_global_mouse_position() + Vector2(32, 32)
Global.right_cursor.texture = Global.right_cursor_tool_texture
if event is InputEventKey and (event.scancode == KEY_ENTER or event.scancode == KEY_KP_ENTER):
if get_focus_owner() is LineEdit: