Explorar el Código

make it also usable on android

Laserlicht hace 1 año
padre
commit
aa6cbdf13b

+ 4 - 0
client/windows/settings/AdventureOptionsTab.cpp

@@ -11,6 +11,7 @@
 
 #include "AdventureOptionsTab.h"
 
+#include "../../eventsSDL/InputHandler.h"
 #include "../../../lib/filesystem/ResourcePath.h"
 #include "../../gui/CGuiHandler.h"
 #include "../../widgets/Buttons.h"
@@ -36,6 +37,9 @@ AdventureOptionsTab::AdventureOptionsTab()
 	OBJECT_CONSTRUCTION;
 	setRedrawParent(true);
 
+	addConditional("touchscreen", GH.input().getCurrentInputMode() == InputMode::TOUCH);
+	addConditional("keyboardMouse", GH.input().getCurrentInputMode() == InputMode::KEYBOARD_AND_MOUSE);
+	addConditional("controller", GH.input().getCurrentInputMode() == InputMode::CONTROLLER);
 #ifdef VCMI_MOBILE
 	addConditional("mobile", true);
 	addConditional("desktop", false);

+ 3 - 1
client/windows/settings/GeneralOptionsTab.cpp

@@ -97,7 +97,9 @@ GeneralOptionsTab::GeneralOptionsTab()
 	OBJECT_CONSTRUCTION;
 	setRedrawParent(true);
 
-	addConditional("touchscreen", GH.input().hasTouchInputDevice());
+	addConditional("touchscreen", GH.input().getCurrentInputMode() == InputMode::TOUCH);
+	addConditional("keyboardMouse", GH.input().getCurrentInputMode() == InputMode::KEYBOARD_AND_MOUSE);
+	addConditional("controller", GH.input().getCurrentInputMode() == InputMode::CONTROLLER);
 #ifdef VCMI_MOBILE
 	addConditional("mobile", true);
 	addConditional("desktop", false);

+ 5 - 0
client/windows/settings/SettingsMainWindow.cpp

@@ -196,3 +196,8 @@ void SettingsMainWindow::onScreenResize()
 	if (tab)
 		tab->updateResolutionSelector();
 }
+
+void SettingsMainWindow::inputModeChanged(InputMode mode)
+{
+	tabContentArea->reset();
+}

+ 1 - 0
client/windows/settings/SettingsMainWindow.h

@@ -42,5 +42,6 @@ public:
 
 	void showAll(Canvas & to) override;
 	void onScreenResize() override;
+	void inputModeChanged(InputMode mode) override;
 };
 

+ 4 - 4
config/widgets/settings/adventureOptionsTab.json

@@ -364,7 +364,7 @@
 				},
 				{
 					"text": "vcmi.adventureOptions.leftButtonDrag.hover",
-					"created" : "desktop"
+					"created" : "keyboardMouse"
 				},
 				{
 					"text": "vcmi.adventureOptions.smoothDragging.hover"
@@ -379,7 +379,7 @@
 			[
 				{
 					"text": "vcmi.adventureOptions.rightButtonDrag.hover",
-					"created" : "desktop"
+					"created" : "keyboardMouse"
 				}
 			]
 		},
@@ -423,7 +423,7 @@
 					"name": "leftButtonDragCheckbox",
 					"help": "vcmi.adventureOptions.leftButtonDrag",
 					"callback": "leftButtonDragChanged",
-					"created" : "desktop"
+					"created" : "keyboardMouse"
 				},
 				{
 					"name": "smoothDraggingCheckbox",
@@ -442,7 +442,7 @@
 					"name": "rightButtonDragCheckbox",
 					"help": "vcmi.adventureOptions.rightButtonDrag",
 					"callback": "rightButtonDragChanged",
-					"created" : "desktop"
+					"created" : "keyboardMouse"
 				}
 			]
 		}