summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/SCsub2
-rw-r--r--main/input_default.cpp62
-rw-r--r--main/input_default.h5
-rw-r--r--main/main.cpp14
4 files changed, 78 insertions, 5 deletions
diff --git a/main/SCsub b/main/SCsub
index fa60ffc3e8..cd9002de0a 100644
--- a/main/SCsub
+++ b/main/SCsub
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
Import('env')
env.main_sources=[]
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 2020f7a5ad..c60fcd2243 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -1050,8 +1050,8 @@ void InputDefault::parse_mapping(String p_mapping) {
if (entry[idx] == "")
continue;
- String from = entry[idx].get_slice(":", 1);
- String to = entry[idx].get_slice(":", 0);
+ String from = entry[idx].get_slice(":", 1).replace(" ", "");
+ String to = entry[idx].get_slice(":", 0).replace(" ", "");
JoyEvent to_event = _find_to_event(to);
if (to_event.type == -1)
@@ -1159,3 +1159,61 @@ Array InputDefault::get_connected_joysticks() {
}
return ret;
}
+
+static const char* _buttons[] = {
+ "Face Button Bottom",
+ "Face Button Right",
+ "Face Button Left",
+ "Face Button Top",
+ "L",
+ "R",
+ "L2",
+ "R2",
+ "L3",
+ "R3",
+ "Select",
+ "Start",
+ "DPAD Up",
+ "DPAD Down",
+ "DPAD Left",
+ "DPAD Right"
+};
+
+static const char* _axes[] = {
+ "Left Stick X",
+ "Left Stick Y",
+ "Right Stick X",
+ "Right Stick Y",
+ "",
+ "",
+ "L2",
+ "R2"
+};
+
+String InputDefault::get_joy_button_string(int p_button) {
+ ERR_FAIL_INDEX_V(p_button, JOY_BUTTON_MAX, "");
+ return _buttons[p_button];
+}
+
+int InputDefault::get_joy_button_index_from_string(String p_button) {
+ for (int i = 0; i < JOY_BUTTON_MAX; i++) {
+ if (p_button == _buttons[i]) {
+ return i;
+ }
+ }
+ ERR_FAIL_V(-1);
+}
+
+String InputDefault::get_joy_axis_string(int p_axis) {
+ ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, "");
+ return _axes[p_axis];
+}
+
+int InputDefault::get_joy_axis_index_from_string(String p_axis) {
+ for (int i = 0; i < JOY_AXIS_MAX; i++) {
+ if (p_axis == _axes[i]) {
+ return i;
+ }
+ }
+ ERR_FAIL_V(-1);
+}
diff --git a/main/input_default.h b/main/input_default.h
index fbf7837b3b..2db6d28abf 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -235,6 +235,11 @@ public:
virtual bool is_joy_known(int p_device);
virtual String get_joy_guid(int p_device) const;
+ virtual String get_joy_button_string(int p_button);
+ virtual String get_joy_axis_string(int p_axis);
+ virtual int get_joy_axis_index_from_string(String p_axis);
+ virtual int get_joy_button_index_from_string(String p_button);
+
bool is_joy_mapped(int p_device);
String get_joy_guid_remapped(int p_device) const;
void set_fallback_mapping(String p_guid);
diff --git a/main/main.cpp b/main/main.cpp
index d803817541..7db04023a4 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -57,7 +57,6 @@
#include "tools/editor/editor_node.h"
#include "tools/editor/project_manager.h"
-#include "tools/pck/pck_packer.h"
#endif
#include "io/file_access_network.h"
@@ -560,6 +559,16 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
goto error;
}
+ } else if (I->get()=="-epid") {
+ if (I->next()) {
+
+ int editor_pid=I->next()->get().to_int();
+ Globals::get_singleton()->set("editor_pid",editor_pid);
+ N=I->next()->next();
+ } else {
+ goto error;
+
+ }
} else {
//test for game path
@@ -996,7 +1005,7 @@ Error Main::setup2() {
#ifdef TOOLS_ENABLED
ObjectTypeDB::set_current_api(ObjectTypeDB::API_EDITOR);
EditorNode::register_editor_types();
- ObjectTypeDB::register_type<PCKPacker>(); // todo: move somewhere else
+
ObjectTypeDB::set_current_api(ObjectTypeDB::API_CORE);
#endif
@@ -1759,4 +1768,3 @@ void Main::cleanup() {
}
-