From 721cab876566d9521f463a943a244de71646f92a Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Sat, 2 Oct 2021 15:08:58 +0300 Subject: [PATCH] Minor changes that make Pixelorama work with Android Just planting the seeds of a possible Android version, probably tablet-only, at least at first. I do not know when that will happen yet. --- .gitignore | 9 ++++++--- project.godot | 3 +++ src/Main.gd | 4 ++++ src/Preferences/PreferencesDialog.gd | 2 +- src/UI/Canvas/CameraMovement.gd | 2 ++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index db79d0147..bfe3676bd 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,11 @@ mono_crash.*.json .directory *~ -#Visual Studio Code ignores +# Visual Studio Code ignores .vscode/ -#macOS ignores -.DS_Store \ No newline at end of file +# macOS ignores +.DS_Store + +# Android ignores +android/ diff --git a/project.godot b/project.godot index 8a40b0506..0f9b401e5 100644 --- a/project.godot +++ b/project.godot @@ -150,6 +150,7 @@ config/icon="res://assets/graphics/icons/icon.png" config/macos_native_icon="res://assets/graphics/icons/icon.icns" config/windows_native_icon="res://assets/graphics/icons/icon.ico" config/Version="v0.9-stable" +run/low_processor_mode.Android=false [audio] @@ -181,6 +182,8 @@ window/per_pixel_transparency/allowed.HTML5=false window/per_pixel_transparency/enabled.HTML5=false window/per_pixel_transparency/allowed.OSX=false window/per_pixel_transparency/enabled.OSX=false +window/per_pixel_transparency/allowed.Android=false +window/per_pixel_transparency/enabled.Android=false [gui] diff --git a/src/Main.gd b/src/Main.gd index 2ea2fdd79..0321afbb9 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -18,6 +18,7 @@ onready var canvas_preview_container := $MenuAndUI/UI/RightPanel/MarginContainer onready var tool_panel := $MenuAndUI/UI/ToolsAndCanvas/ToolPanel onready var scroll_container := $MenuAndUI/UI/RightPanel/MarginContainer/PreviewAndPalettes/ToolAndPaletteVSplit/ColorAndToolOptions/ScrollContainer + # Called when the node enters the scene tree for the first time. func _ready() -> void: var alternate_transparent_background = ColorRect.new() @@ -77,6 +78,9 @@ func _ready() -> void: OpenSave.handle_loading_files(OS.get_cmdline_args()) get_tree().connect("files_dropped", self, "_on_files_dropped") + if OS.get_name() == "Android": + OS.request_permissions() + func handle_resize() -> void: var aspect_ratio = get_viewport_rect().size.x/(0.00001 if get_viewport_rect().size.y == 0 else get_viewport_rect().size.y) diff --git a/src/Preferences/PreferencesDialog.gd b/src/Preferences/PreferencesDialog.gd index 52a2d8e1f..eae40d0c1 100644 --- a/src/Preferences/PreferencesDialog.gd +++ b/src/Preferences/PreferencesDialog.gd @@ -161,7 +161,7 @@ func preference_update(prop : String) -> void: if prop in ["fps_limit"]: Engine.set_target_fps(Global.fps_limit) - + if prop in ["fps_limit_focus"]: idle_fps_spinbox.editable = !idle_fps_spinbox.editable diff --git a/src/UI/Canvas/CameraMovement.gd b/src/UI/Canvas/CameraMovement.gd index 86915bd92..8cdc5639e 100644 --- a/src/UI/Canvas/CameraMovement.gd +++ b/src/UI/Canvas/CameraMovement.gd @@ -168,6 +168,8 @@ func _input(event : InputEvent) -> void: else: zoom_camera(-1) elif event is InputEventPanGesture: # Pan Gesture on a Latop touchpad + if OS.get_name() == "Android": + return offset = offset + event.delta * zoom * 7 # for moving the canvas elif event is InputEventMouseMotion && drag: offset = offset - event.relative * zoom