From 02c76cfd144502852c248e7dcebfe4e093114df7 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 27 Dec 2019 16:12:19 +0100 Subject: [PATCH] Don't call `update()` in the canvas on non-mouse input events This partially addresses #85. --- Scripts/Canvas.gd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index eb6ebab48..d04edb868 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -80,8 +80,12 @@ func camera_zoom() -> void: Global.camera2.offset = size / 2 Global.camera_preview.offset = size / 2 -# warning-ignore:unused_argument -func _input(event) -> void: +func _input(event : InputEvent) -> void: + # Don't process anything below if the input isn't a mouse event. + # This decreases CPU/GPU usage slightly. + if not event is InputEventMouse: + return + sprite_changed_this_frame = false if Global.current_frame == frame: update()