summaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp55
1 files changed, 46 insertions, 9 deletions
diff --git a/main/main.cpp b/main/main.cpp
index f35e73cdc2..68016a5cef 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -139,7 +139,6 @@ static DisplayServer::ScreenOrientation window_orientation = DisplayServer::SCRE
static uint32_t window_flags = 0;
static Size2i window_size = Size2i(1024, 600);
static bool window_vsync_via_compositor = false;
-static bool disable_wintab = false;
static int init_screen = -1;
static bool init_fullscreen = false;
@@ -313,7 +312,13 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --enable-vsync-via-compositor When vsync is enabled, vsync via the OS' window compositor (Windows only).\n");
OS::get_singleton()->print(" --disable-vsync-via-compositor Disable vsync via the OS' window compositor (Windows only).\n");
OS::get_singleton()->print(" --single-window Use a single window (no separate subwindows).\n");
- OS::get_singleton()->print(" --disable-wintab Disable WinTab API and always use Windows Ink API for the pen input (Windows only).\n");
+ OS::get_singleton()->print(" --tablet-driver Tablet input driver (");
+ for (int i = 0; i < OS::get_singleton()->get_tablet_driver_count(); i++) {
+ if (i != 0)
+ OS::get_singleton()->print(", ");
+ OS::get_singleton()->print("'%s'", OS::get_singleton()->get_tablet_driver_name(i).utf8().get_data());
+ }
+ OS::get_singleton()->print(") (Windows only).\n");
OS::get_singleton()->print("\n");
#endif
@@ -438,6 +443,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
String display_driver = "";
String audio_driver = "";
+ String tablet_driver = "";
String project_path = ".";
bool upwards = false;
String debug_uri = "";
@@ -590,8 +596,26 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--gpu-abort") { // force windowed window
Engine::singleton->abort_on_gpu_errors = true;
- } else if (I->get() == "--disable-wintab") {
- disable_wintab = true;
+ } else if (I->get() == "--tablet-driver") {
+ if (I->next()) {
+ tablet_driver = I->next()->get();
+ bool found = false;
+ for (int i = 0; i < OS::get_singleton()->get_tablet_driver_count(); i++) {
+ if (tablet_driver == OS::get_singleton()->get_tablet_driver_name(i)) {
+ found = true;
+ }
+ }
+
+ if (!found) {
+ OS::get_singleton()->print("Unknown tablet driver '%s', aborting.\n", tablet_driver.utf8().get_data());
+ goto error;
+ }
+
+ N = I->next()->next();
+ } else {
+ OS::get_singleton()->print("Missing tablet driver argument, aborting.\n");
+ goto error;
+ }
} else if (I->get() == "--single-window") { // force single window
single_window = true;
@@ -1056,12 +1080,20 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->_vsync_via_compositor = window_vsync_via_compositor;
- if (!disable_wintab) {
- // No "--disable_wintab" option
- disable_wintab = GLOBAL_DEF("display/window/disable_wintab_api", false);
+ if (tablet_driver == "") { // specified in project.godot
+ tablet_driver = GLOBAL_DEF_RST("display/window/tablet_driver", OS::get_singleton()->get_tablet_driver_name(0));
}
- OS::get_singleton()->_disable_wintab = disable_wintab;
+ for (int i = 0; i < OS::get_singleton()->get_tablet_driver_count(); i++) {
+ if (tablet_driver == OS::get_singleton()->get_tablet_driver_name(i)) {
+ OS::get_singleton()->set_current_tablet_driver(OS::get_singleton()->get_tablet_driver_name(i));
+ break;
+ }
+ }
+
+ if (tablet_driver == "") {
+ OS::get_singleton()->set_current_tablet_driver(OS::get_singleton()->get_tablet_driver_name(0));
+ }
/* todo restore
OS::get_singleton()->_allow_layered = GLOBAL_DEF("display/window/per_pixel_transparency/allowed", false);
@@ -1175,6 +1207,7 @@ error:
display_driver = "";
audio_driver = "";
+ tablet_driver = "";
project_path = "";
args.clear();
@@ -1532,7 +1565,11 @@ bool Main::start() {
} else if (args[i].length() && args[i][0] != '-' && positional_arg == "") {
positional_arg = args[i];
- if (args[i].ends_with(".scn") || args[i].ends_with(".tscn") || args[i].ends_with(".escn")) {
+ if (args[i].ends_with(".scn") ||
+ args[i].ends_with(".tscn") ||
+ args[i].ends_with(".escn") ||
+ args[i].ends_with(".res") ||
+ args[i].ends_with(".tres")) {
// Only consider the positional argument to be a scene path if it ends with
// a file extension associated with Godot scenes. This makes it possible
// for projects to parse command-line arguments for custom CLI arguments