diff --git a/bundles/bundle.properties b/bundles/bundle.properties
new file mode 100644
index 0000000..743770b
--- /dev/null
+++ b/bundles/bundle.properties
@@ -0,0 +1 @@
+console = Console
diff --git a/mod.json b/mod.json
index 51696f6..7e992a4 100644
--- a/mod.json
+++ b/mod.json
@@ -1,8 +1,7 @@
{
"name": "dev-mode",
"displayName": "Developer Mode",
- "author": "deltanedas",
- "description": "Lets you type into the console.\nPress [stat]F8[] to open.",
+ "description": "Lets you type into the console.\nPress [stat]F8[] to open on PC.\n[stat]Requires [#00aaff]DeltaNedas/ui-lib[] on mobile.",
"version": "3.3.2",
"hidden": true,
"minGameVersion": "136",
diff --git a/scripts/button.js b/scripts/button.js
new file mode 100644
index 0000000..b969beb
--- /dev/null
+++ b/scripts/button.js
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) DeltaNedas 2020
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+const ui = require("ui-lib/library");
+
+// Android also doesn't load the logger automatically in 6.0
+Vars.loadLogger();
+
+var shown = false;
+
+const toggle = () => {
+ shown = !shown;
+};
+
+/* button for poor mobile users */
+ui.addButton("console", "terminal", toggle);
+
+/* or if you don't want to start a game */
+ui.addMenuButton("$console", "terminal", toggle);
+
+// Always show console - even outside of a game
+ui.addArea("console", {
+ init(console) {
+ Core.scene.add(console.bottom().left());
+ console.visibility = () => shown;
+ },
+ post() {},
+
+ group: null
+});
+
+ui.addTable("console", "console", console => {
+ console.bottom().left();
+ console.background(Tex.buttonTrans);
+ console.defaults().margin(8);
+
+ // Clear the console
+ console.button(Icon.refresh, Styles.cleari, 40, () => {
+ Vars.ui.consolefrag.clearMessages();
+ });
+
+ // Prompt for a line of JS
+ console.button(Icon.terminal, Styles.cleari, 40, () => {
+ Vars.ui.consolefrag.toggle();
+ }).marginRight(8);
+
+ console.add("$console").marginLeft(8);
+});
+
+ui.onLoad(() => {
+ Vars.ui.consolefrag.visibility = () => shown;
+});
diff --git a/scripts/main.js b/scripts/main.js
index 995d240..75a54eb 100644
--- a/scripts/main.js
+++ b/scripts/main.js
@@ -8,11 +8,13 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ along with this program. If not, see .
*/
-Vars.enableConsole = true;
+if (Vars.mobile) {
+ require("button");
+}