mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-03 17:39:36 +01:00
Ported: Enable long press, pan and scale gestures for the Godot Android Editor
Fix the bug causing the editor to crash when running the project.
- m4gr3d
63df48a59c
This commit is contained in:
parent
0bb6a05a4e
commit
7268ef04f7
@ -30,18 +30,18 @@
|
||||
|
||||
#include "progress_dialog.h"
|
||||
|
||||
#include "core/object/message_queue.h"
|
||||
#include "core/os/os.h"
|
||||
#include "editor_scale.h"
|
||||
#include "main/main.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/math/math_defs.h"
|
||||
#include "core/math/rect2.h"
|
||||
#include "core/math/vector2.h"
|
||||
#include "core/os/memory.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/message_queue.h"
|
||||
#include "core/object/reference.h"
|
||||
#include "core/os/memory.h"
|
||||
#include "core/os/os.h"
|
||||
#include "core/typedefs.h"
|
||||
#include "editor_scale.h"
|
||||
#include "main/main.h"
|
||||
#include "scene/2d/canvas_item.h"
|
||||
#include "scene/gui/button.h"
|
||||
#include "scene/gui/control.h"
|
||||
@ -226,7 +226,10 @@ bool ProgressDialog::task_step(const String &p_task, const String &p_state, int
|
||||
OS::get_singleton()->force_process_input();
|
||||
}
|
||||
|
||||
#ifndef ANDROID_ENABLED
|
||||
Main::iteration(); // this will not work on a lot of platforms, so it's only meant for the editor
|
||||
#endif
|
||||
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,12 @@ open class PandemoniumEditor : FullScreenPandemoniumApp() {
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Enable long press, panning and scaling gestures
|
||||
godotFragment?.mView?.inputHandler?.apply {
|
||||
enableLongPress(enableLongPressGestures())
|
||||
enablePanningAndScalingGestures(enablePanAndScaleGestures())
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateCommandLineParams(args: Array<String>?) {
|
||||
@ -148,6 +154,16 @@ open class PandemoniumEditor : FullScreenPandemoniumApp() {
|
||||
*/
|
||||
protected open fun overrideOrientationRequest() = true
|
||||
|
||||
/**
|
||||
* Enable long press gestures for the Godot Android editor.
|
||||
*/
|
||||
protected open fun enableLongPressGestures() = true
|
||||
|
||||
/**
|
||||
* Enable pan and scale gestures for the Godot Android editor.
|
||||
*/
|
||||
protected open fun enablePanAndScaleGestures() = true
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
// Check if we got the MANAGE_EXTERNAL_STORAGE permission
|
||||
|
@ -35,4 +35,8 @@ package net.relintai.pandemonium.editor
|
||||
*/
|
||||
class PandemoniumGame : PandemoniumEditor() {
|
||||
override fun overrideOrientationRequest() = false
|
||||
|
||||
override fun enableLongPressGestures() = false
|
||||
|
||||
override fun enablePanAndScaleGestures() = false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user