mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merge pull request #4531 from Laserlicht/mouse_right_drag
map drag with right mouse
This commit is contained in:
commit
fb28de5beb
@ -234,8 +234,10 @@
|
|||||||
"vcmi.adventureOptions.borderScroll.help" : "{Border Scrolling}\n\nScroll adventure map when cursor is adjacent to window edge. Can be disabled by holding down CTRL key.",
|
"vcmi.adventureOptions.borderScroll.help" : "{Border Scrolling}\n\nScroll adventure map when cursor is adjacent to window edge. Can be disabled by holding down CTRL key.",
|
||||||
"vcmi.adventureOptions.infoBarCreatureManagement.hover" : "Info Panel Creature Management",
|
"vcmi.adventureOptions.infoBarCreatureManagement.hover" : "Info Panel Creature Management",
|
||||||
"vcmi.adventureOptions.infoBarCreatureManagement.help" : "{Info Panel Creature Management}\n\nAllows rearranging creatures in info panel instead of cycling between default components.",
|
"vcmi.adventureOptions.infoBarCreatureManagement.help" : "{Info Panel Creature Management}\n\nAllows rearranging creatures in info panel instead of cycling between default components.",
|
||||||
"vcmi.adventureOptions.leftButtonDrag.hover" : "Left Click Drag Map",
|
"vcmi.adventureOptions.leftButtonDrag.hover" : "Left Click Drag",
|
||||||
"vcmi.adventureOptions.leftButtonDrag.help" : "{Left Click Drag Map}\n\nWhen enabled, moving mouse with left button pressed will drag adventure map view.",
|
"vcmi.adventureOptions.leftButtonDrag.help" : "{Left Click Drag}\n\nWhen enabled, moving mouse with left button pressed will drag adventure map view.",
|
||||||
|
"vcmi.adventureOptions.rightButtonDrag.hover" : "Right Click Drag",
|
||||||
|
"vcmi.adventureOptions.rightButtonDrag.help" : "{Right Click Drag}\n\nWhen enabled, moving mouse with right button pressed will drag adventure map view.",
|
||||||
"vcmi.adventureOptions.smoothDragging.hover" : "Smooth Map Dragging",
|
"vcmi.adventureOptions.smoothDragging.hover" : "Smooth Map Dragging",
|
||||||
"vcmi.adventureOptions.smoothDragging.help" : "{Smooth Map Dragging}\n\nWhen enabled, map dragging has a modern run out effect.",
|
"vcmi.adventureOptions.smoothDragging.help" : "{Smooth Map Dragging}\n\nWhen enabled, map dragging has a modern run out effect.",
|
||||||
"vcmi.adventureOptions.skipAdventureMapAnimations.hover" : "Skip fading effects",
|
"vcmi.adventureOptions.skipAdventureMapAnimations.hover" : "Skip fading effects",
|
||||||
|
@ -234,8 +234,10 @@
|
|||||||
"vcmi.adventureOptions.borderScroll.help" : "{Scrollen am Rand}\n\nScrollt die Abenteuerkarte, wenn sich der Cursor neben dem Fensterrand befindet. Kann mit gedrückter STRG-Taste deaktiviert werden.",
|
"vcmi.adventureOptions.borderScroll.help" : "{Scrollen am Rand}\n\nScrollt die Abenteuerkarte, wenn sich der Cursor neben dem Fensterrand befindet. Kann mit gedrückter STRG-Taste deaktiviert werden.",
|
||||||
"vcmi.adventureOptions.infoBarCreatureManagement.hover" : "Info-Panel Kreaturenmanagement",
|
"vcmi.adventureOptions.infoBarCreatureManagement.hover" : "Info-Panel Kreaturenmanagement",
|
||||||
"vcmi.adventureOptions.infoBarCreatureManagement.help" : "{Info-Panel Kreaturenmanagement}\n\nErmöglicht die Neuanordnung von Kreaturen im Info-Panel, anstatt zwischen den Standardkomponenten zu wechseln",
|
"vcmi.adventureOptions.infoBarCreatureManagement.help" : "{Info-Panel Kreaturenmanagement}\n\nErmöglicht die Neuanordnung von Kreaturen im Info-Panel, anstatt zwischen den Standardkomponenten zu wechseln",
|
||||||
"vcmi.adventureOptions.leftButtonDrag.hover" : "Ziehen der Karte mit Links",
|
"vcmi.adventureOptions.leftButtonDrag.hover" : "Ziehen mit Links",
|
||||||
"vcmi.adventureOptions.leftButtonDrag.help" : "{Ziehen der Karte mit Links}\n\nWenn aktiviert, wird die Maus bei gedrückter linker Taste in die Kartenansicht gezogen",
|
"vcmi.adventureOptions.leftButtonDrag.help" : "{Ziehen mit Links}\n\nWenn aktiviert, kann mit gedrückter linker Taste die Kartenansicht gezogen werden",
|
||||||
|
"vcmi.adventureOptions.rightButtonDrag.hover" : "Ziehen mit Rechts",
|
||||||
|
"vcmi.adventureOptions.rightButtonDrag.help" : "{Ziehen mit Rechts}\n\nWenn aktiviert, kann mit gedrückter rechter Taste die Kartenansicht gezogen werden",
|
||||||
"vcmi.adventureOptions.smoothDragging.hover" : "Nahtloses Ziehen der Karte",
|
"vcmi.adventureOptions.smoothDragging.hover" : "Nahtloses Ziehen der Karte",
|
||||||
"vcmi.adventureOptions.smoothDragging.help" : "{Nahtloses Ziehen der Karte}\n\nWenn aktiviert hat das Ziehen der Karte einen sanften Auslaufeffekt.",
|
"vcmi.adventureOptions.smoothDragging.help" : "{Nahtloses Ziehen der Karte}\n\nWenn aktiviert hat das Ziehen der Karte einen sanften Auslaufeffekt.",
|
||||||
"vcmi.adventureOptions.skipAdventureMapAnimations.hover" : "Fading-Effekte überspringen",
|
"vcmi.adventureOptions.skipAdventureMapAnimations.hover" : "Fading-Effekte überspringen",
|
||||||
|
@ -34,7 +34,7 @@ InputSourceMouse::InputSourceMouse()
|
|||||||
void InputSourceMouse::handleEventMouseMotion(const SDL_MouseMotionEvent & motion)
|
void InputSourceMouse::handleEventMouseMotion(const SDL_MouseMotionEvent & motion)
|
||||||
{
|
{
|
||||||
Point newPosition = Point(motion.x, motion.y) / GH.screenHandler().getScalingFactor();
|
Point newPosition = Point(motion.x, motion.y) / GH.screenHandler().getScalingFactor();
|
||||||
Point distance= Point(-motion.xrel, -motion.yrel) / GH.screenHandler().getScalingFactor();
|
Point distance = Point(-motion.xrel, -motion.yrel) / GH.screenHandler().getScalingFactor();
|
||||||
|
|
||||||
mouseButtonsMask = motion.state;
|
mouseButtonsMask = motion.state;
|
||||||
|
|
||||||
@ -42,6 +42,8 @@ void InputSourceMouse::handleEventMouseMotion(const SDL_MouseMotionEvent & motio
|
|||||||
GH.events().dispatchGesturePanning(middleClickPosition, newPosition, distance);
|
GH.events().dispatchGesturePanning(middleClickPosition, newPosition, distance);
|
||||||
else if (mouseButtonsMask & SDL_BUTTON(SDL_BUTTON_LEFT))
|
else if (mouseButtonsMask & SDL_BUTTON(SDL_BUTTON_LEFT))
|
||||||
GH.events().dispatchMouseDragged(newPosition, distance);
|
GH.events().dispatchMouseDragged(newPosition, distance);
|
||||||
|
else if (mouseButtonsMask & SDL_BUTTON(SDL_BUTTON_RIGHT))
|
||||||
|
GH.events().dispatchMouseDraggedPopup(newPosition, distance);
|
||||||
else
|
else
|
||||||
GH.input().setCursorPosition(newPosition);
|
GH.input().setCursorPosition(newPosition);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ void EventDispatcher::processLists(ui16 activityFlag, const Functor & cb)
|
|||||||
processList(AEventsReceiver::HOVER, hoverable);
|
processList(AEventsReceiver::HOVER, hoverable);
|
||||||
processList(AEventsReceiver::MOVE, motioninterested);
|
processList(AEventsReceiver::MOVE, motioninterested);
|
||||||
processList(AEventsReceiver::DRAG, draginterested);
|
processList(AEventsReceiver::DRAG, draginterested);
|
||||||
|
processList(AEventsReceiver::DRAG_POPUP, dragPopupInterested);
|
||||||
processList(AEventsReceiver::KEYBOARD, keyinterested);
|
processList(AEventsReceiver::KEYBOARD, keyinterested);
|
||||||
processList(AEventsReceiver::TIME, timeinterested);
|
processList(AEventsReceiver::TIME, timeinterested);
|
||||||
processList(AEventsReceiver::WHEEL, wheelInterested);
|
processList(AEventsReceiver::WHEEL, wheelInterested);
|
||||||
@ -433,3 +434,10 @@ void EventDispatcher::dispatchMouseDragged(const Point & currentPosition, const
|
|||||||
elem->mouseDragged(currentPosition, lastUpdateDistance);
|
elem->mouseDragged(currentPosition, lastUpdateDistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventDispatcher::dispatchMouseDraggedPopup(const Point & currentPosition, const Point & lastUpdateDistance)
|
||||||
|
{
|
||||||
|
EventReceiversList diCopy = dragPopupInterested;
|
||||||
|
for(auto & elem : diCopy)
|
||||||
|
elem->mouseDraggedPopup(currentPosition, lastUpdateDistance);
|
||||||
|
}
|
||||||
|
@ -30,6 +30,7 @@ class EventDispatcher
|
|||||||
EventReceiversList keyinterested;
|
EventReceiversList keyinterested;
|
||||||
EventReceiversList motioninterested;
|
EventReceiversList motioninterested;
|
||||||
EventReceiversList draginterested;
|
EventReceiversList draginterested;
|
||||||
|
EventReceiversList dragPopupInterested;
|
||||||
EventReceiversList timeinterested;
|
EventReceiversList timeinterested;
|
||||||
EventReceiversList wheelInterested;
|
EventReceiversList wheelInterested;
|
||||||
EventReceiversList doubleClickInterested;
|
EventReceiversList doubleClickInterested;
|
||||||
@ -66,6 +67,7 @@ public:
|
|||||||
void dispatchMouseMoved(const Point & distance, const Point & position);
|
void dispatchMouseMoved(const Point & distance, const Point & position);
|
||||||
|
|
||||||
void dispatchMouseDragged(const Point & currentPosition, const Point & lastUpdateDistance);
|
void dispatchMouseDragged(const Point & currentPosition, const Point & lastUpdateDistance);
|
||||||
|
void dispatchMouseDraggedPopup(const Point & currentPosition, const Point & lastUpdateDistance);
|
||||||
|
|
||||||
void dispatchShowPopup(const Point & position, int tolerance);
|
void dispatchShowPopup(const Point & position, int tolerance);
|
||||||
void dispatchClosePopup(const Point & position);
|
void dispatchClosePopup(const Point & position);
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
virtual void wheelScrolled(int distance) {}
|
virtual void wheelScrolled(int distance) {}
|
||||||
virtual void mouseMoved(const Point & cursorPosition, const Point & lastUpdateDistance) {}
|
virtual void mouseMoved(const Point & cursorPosition, const Point & lastUpdateDistance) {}
|
||||||
virtual void mouseDragged(const Point & cursorPosition, const Point & lastUpdateDistance) {}
|
virtual void mouseDragged(const Point & cursorPosition, const Point & lastUpdateDistance) {}
|
||||||
|
virtual void mouseDraggedPopup(const Point & cursorPosition, const Point & lastUpdateDistance) {}
|
||||||
|
|
||||||
/// Called when UI element hover status changes
|
/// Called when UI element hover status changes
|
||||||
virtual void hover(bool on) {}
|
virtual void hover(bool on) {}
|
||||||
@ -97,7 +98,8 @@ public:
|
|||||||
TEXTINPUT = 512,
|
TEXTINPUT = 512,
|
||||||
GESTURE = 1024,
|
GESTURE = 1024,
|
||||||
DRAG = 2048,
|
DRAG = 2048,
|
||||||
INPUT_MODE_CHANGE = 4096
|
INPUT_MODE_CHANGE = 4096,
|
||||||
|
DRAG_POPUP = 8192
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Returns true if element is currently hovered by mouse
|
/// Returns true if element is currently hovered by mouse
|
||||||
|
@ -34,7 +34,7 @@ MapViewActions::MapViewActions(MapView & owner, const std::shared_ptr<MapViewMod
|
|||||||
pos.w = model->getPixelsVisibleDimensions().x;
|
pos.w = model->getPixelsVisibleDimensions().x;
|
||||||
pos.h = model->getPixelsVisibleDimensions().y;
|
pos.h = model->getPixelsVisibleDimensions().y;
|
||||||
|
|
||||||
addUsedEvents(LCLICK | SHOW_POPUP | DRAG | GESTURE | HOVER | MOVE | WHEEL);
|
addUsedEvents(LCLICK | SHOW_POPUP | DRAG | DRAG_POPUP | GESTURE | HOVER | MOVE | WHEEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapViewActions::setContext(const std::shared_ptr<IMapRendererContext> & context)
|
void MapViewActions::setContext(const std::shared_ptr<IMapRendererContext> & context)
|
||||||
@ -101,6 +101,11 @@ void MapViewActions::mouseDragged(const Point & cursorPosition, const Point & la
|
|||||||
owner.onMapSwiped(lastUpdateDistance);
|
owner.onMapSwiped(lastUpdateDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapViewActions::mouseDraggedPopup(const Point & cursorPosition, const Point & lastUpdateDistance)
|
||||||
|
{
|
||||||
|
owner.onMapSwiped(lastUpdateDistance);
|
||||||
|
}
|
||||||
|
|
||||||
void MapViewActions::gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance)
|
void MapViewActions::gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance)
|
||||||
{
|
{
|
||||||
owner.onMapSwiped(lastUpdateDistance);
|
owner.onMapSwiped(lastUpdateDistance);
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
void gesture(bool on, const Point & initialPosition, const Point & finalPosition) override;
|
void gesture(bool on, const Point & initialPosition, const Point & finalPosition) override;
|
||||||
void mouseMoved(const Point & cursorPosition, const Point & lastUpdateDistance) override;
|
void mouseMoved(const Point & cursorPosition, const Point & lastUpdateDistance) override;
|
||||||
void mouseDragged(const Point & cursorPosition, const Point & lastUpdateDistance) override;
|
void mouseDragged(const Point & cursorPosition, const Point & lastUpdateDistance) override;
|
||||||
|
void mouseDraggedPopup(const Point & cursorPosition, const Point & lastUpdateDistance) override;
|
||||||
void wheelScrolled(int distance) override;
|
void wheelScrolled(int distance) override;
|
||||||
|
|
||||||
bool dragActive;
|
bool dragActive;
|
||||||
|
@ -245,8 +245,11 @@ void CRClickPopup::createAndPush(const CGObjectInstance * obj, const Point & p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CRClickPopupInt::CRClickPopupInt(const std::shared_ptr<CIntObject> & our)
|
CRClickPopupInt::CRClickPopupInt(const std::shared_ptr<CIntObject> & our) :
|
||||||
|
dragDistance(Point(0, 0))
|
||||||
{
|
{
|
||||||
|
addUsedEvents(DRAG_POPUP);
|
||||||
|
|
||||||
CCS->curh->hide();
|
CCS->curh->hide();
|
||||||
inner = our;
|
inner = our;
|
||||||
addChild(our.get(), false);
|
addChild(our.get(), false);
|
||||||
@ -257,6 +260,17 @@ CRClickPopupInt::~CRClickPopupInt()
|
|||||||
CCS->curh->show();
|
CCS->curh->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRClickPopupInt::mouseDraggedPopup(const Point & cursorPosition, const Point & lastUpdateDistance)
|
||||||
|
{
|
||||||
|
if(!settings["adventure"]["rightButtonDrag"].Bool())
|
||||||
|
return;
|
||||||
|
|
||||||
|
dragDistance += lastUpdateDistance;
|
||||||
|
|
||||||
|
if(dragDistance.length() > 16)
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
Point CInfoBoxPopup::toScreen(Point p)
|
Point CInfoBoxPopup::toScreen(Point p)
|
||||||
{
|
{
|
||||||
auto bounds = adventureInt->terrainAreaPixels();
|
auto bounds = adventureInt->terrainAreaPixels();
|
||||||
@ -267,6 +281,18 @@ Point CInfoBoxPopup::toScreen(Point p)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInfoBoxPopup::mouseDraggedPopup(const Point & cursorPosition, const Point & lastUpdateDistance)
|
||||||
|
{
|
||||||
|
if(!settings["adventure"]["rightButtonDrag"].Bool())
|
||||||
|
return;
|
||||||
|
|
||||||
|
dragDistance += lastUpdateDistance;
|
||||||
|
|
||||||
|
if(dragDistance.length() > 16)
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CInfoBoxPopup::CInfoBoxPopup(Point position, const CGTownInstance * town)
|
CInfoBoxPopup::CInfoBoxPopup(Point position, const CGTownInstance * town)
|
||||||
: CWindowObject(RCLICK_POPUP | PLAYER_COLORED, ImagePath::builtin("TOWNQVBK"), toScreen(position))
|
: CWindowObject(RCLICK_POPUP | PLAYER_COLORED, ImagePath::builtin("TOWNQVBK"), toScreen(position))
|
||||||
{
|
{
|
||||||
@ -275,6 +301,8 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGTownInstance * town)
|
|||||||
|
|
||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
tooltip = std::make_shared<CTownTooltip>(Point(9, 10), iah);
|
tooltip = std::make_shared<CTownTooltip>(Point(9, 10), iah);
|
||||||
|
|
||||||
|
addUsedEvents(DRAG_POPUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
CInfoBoxPopup::CInfoBoxPopup(Point position, const CGHeroInstance * hero)
|
CInfoBoxPopup::CInfoBoxPopup(Point position, const CGHeroInstance * hero)
|
||||||
@ -285,6 +313,8 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGHeroInstance * hero)
|
|||||||
|
|
||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
tooltip = std::make_shared<CHeroTooltip>(Point(9, 10), iah);
|
tooltip = std::make_shared<CHeroTooltip>(Point(9, 10), iah);
|
||||||
|
|
||||||
|
addUsedEvents(DRAG_POPUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
CInfoBoxPopup::CInfoBoxPopup(Point position, const CGGarrison * garr)
|
CInfoBoxPopup::CInfoBoxPopup(Point position, const CGGarrison * garr)
|
||||||
@ -295,6 +325,8 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGGarrison * garr)
|
|||||||
|
|
||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
tooltip = std::make_shared<CArmyTooltip>(Point(9, 10), iah);
|
tooltip = std::make_shared<CArmyTooltip>(Point(9, 10), iah);
|
||||||
|
|
||||||
|
addUsedEvents(DRAG_POPUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
CInfoBoxPopup::CInfoBoxPopup(Point position, const CGCreature * creature)
|
CInfoBoxPopup::CInfoBoxPopup(Point position, const CGCreature * creature)
|
||||||
@ -302,6 +334,8 @@ CInfoBoxPopup::CInfoBoxPopup(Point position, const CGCreature * creature)
|
|||||||
{
|
{
|
||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
tooltip = std::make_shared<CreatureTooltip>(Point(9, 10), creature);
|
tooltip = std::make_shared<CreatureTooltip>(Point(9, 10), creature);
|
||||||
|
|
||||||
|
addUsedEvents(DRAG_POPUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<WindowBase>
|
std::shared_ptr<WindowBase>
|
||||||
|
@ -78,9 +78,13 @@ class CRClickPopupInt : public CRClickPopup
|
|||||||
{
|
{
|
||||||
std::shared_ptr<CIntObject> inner;
|
std::shared_ptr<CIntObject> inner;
|
||||||
|
|
||||||
|
Point dragDistance;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CRClickPopupInt(const std::shared_ptr<CIntObject> & our);
|
CRClickPopupInt(const std::shared_ptr<CIntObject> & our);
|
||||||
~CRClickPopupInt();
|
~CRClickPopupInt();
|
||||||
|
|
||||||
|
void mouseDraggedPopup(const Point & cursorPosition, const Point & lastUpdateDistance) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// popup on adventure map for town\hero and other objects with customized popup content
|
/// popup on adventure map for town\hero and other objects with customized popup content
|
||||||
@ -89,11 +93,15 @@ class CInfoBoxPopup : public CWindowObject
|
|||||||
std::shared_ptr<CIntObject> tooltip;
|
std::shared_ptr<CIntObject> tooltip;
|
||||||
Point toScreen(Point pos);
|
Point toScreen(Point pos);
|
||||||
|
|
||||||
|
Point dragDistance;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CInfoBoxPopup(Point position, const CGTownInstance * town);
|
CInfoBoxPopup(Point position, const CGTownInstance * town);
|
||||||
CInfoBoxPopup(Point position, const CGHeroInstance * hero);
|
CInfoBoxPopup(Point position, const CGHeroInstance * hero);
|
||||||
CInfoBoxPopup(Point position, const CGGarrison * garr);
|
CInfoBoxPopup(Point position, const CGGarrison * garr);
|
||||||
CInfoBoxPopup(Point position, const CGCreature * creature);
|
CInfoBoxPopup(Point position, const CGCreature * creature);
|
||||||
|
|
||||||
|
void mouseDraggedPopup(const Point & cursorPosition, const Point & lastUpdateDistance) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// component selection window
|
/// component selection window
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "AdventureOptionsTab.h"
|
#include "AdventureOptionsTab.h"
|
||||||
|
|
||||||
|
#include "../../eventsSDL/InputHandler.h"
|
||||||
#include "../../../lib/filesystem/ResourcePath.h"
|
#include "../../../lib/filesystem/ResourcePath.h"
|
||||||
#include "../../gui/CGuiHandler.h"
|
#include "../../gui/CGuiHandler.h"
|
||||||
#include "../../widgets/Buttons.h"
|
#include "../../widgets/Buttons.h"
|
||||||
@ -36,6 +37,9 @@ AdventureOptionsTab::AdventureOptionsTab()
|
|||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
setRedrawParent(true);
|
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
|
#ifdef VCMI_MOBILE
|
||||||
addConditional("mobile", true);
|
addConditional("mobile", true);
|
||||||
addConditional("desktop", false);
|
addConditional("desktop", false);
|
||||||
@ -126,6 +130,10 @@ AdventureOptionsTab::AdventureOptionsTab()
|
|||||||
{
|
{
|
||||||
return setBoolSetting("adventure", "leftButtonDrag", value);
|
return setBoolSetting("adventure", "leftButtonDrag", value);
|
||||||
});
|
});
|
||||||
|
addCallback("rightButtonDragChanged", [](bool value)
|
||||||
|
{
|
||||||
|
return setBoolSetting("adventure", "rightButtonDrag", value);
|
||||||
|
});
|
||||||
addCallback("smoothDraggingChanged", [](bool value)
|
addCallback("smoothDraggingChanged", [](bool value)
|
||||||
{
|
{
|
||||||
return setBoolSetting("adventure", "smoothDragging", value);
|
return setBoolSetting("adventure", "smoothDragging", value);
|
||||||
@ -177,6 +185,10 @@ AdventureOptionsTab::AdventureOptionsTab()
|
|||||||
if (leftButtonDragCheckbox)
|
if (leftButtonDragCheckbox)
|
||||||
leftButtonDragCheckbox->setSelected(settings["adventure"]["leftButtonDrag"].Bool());
|
leftButtonDragCheckbox->setSelected(settings["adventure"]["leftButtonDrag"].Bool());
|
||||||
|
|
||||||
|
std::shared_ptr<CToggleButton> rightButtonDragCheckbox = widget<CToggleButton>("rightButtonDragCheckbox");
|
||||||
|
if (rightButtonDragCheckbox)
|
||||||
|
rightButtonDragCheckbox->setSelected(settings["adventure"]["rightButtonDrag"].Bool());
|
||||||
|
|
||||||
std::shared_ptr<CToggleButton> smoothDraggingCheckbox = widget<CToggleButton>("smoothDraggingCheckbox");
|
std::shared_ptr<CToggleButton> smoothDraggingCheckbox = widget<CToggleButton>("smoothDraggingCheckbox");
|
||||||
if (smoothDraggingCheckbox)
|
if (smoothDraggingCheckbox)
|
||||||
smoothDraggingCheckbox->setSelected(settings["adventure"]["smoothDragging"].Bool());
|
smoothDraggingCheckbox->setSelected(settings["adventure"]["smoothDragging"].Bool());
|
||||||
|
@ -97,7 +97,9 @@ GeneralOptionsTab::GeneralOptionsTab()
|
|||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
setRedrawParent(true);
|
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
|
#ifdef VCMI_MOBILE
|
||||||
addConditional("mobile", true);
|
addConditional("mobile", true);
|
||||||
addConditional("desktop", false);
|
addConditional("desktop", false);
|
||||||
|
@ -45,6 +45,8 @@ SettingsMainWindow::SettingsMainWindow(BattleInterface * parentBattleUi) : Inter
|
|||||||
addCallback("closeWindow", [this](int) { backButtonCallback(); });
|
addCallback("closeWindow", [this](int) { backButtonCallback(); });
|
||||||
build(config);
|
build(config);
|
||||||
|
|
||||||
|
addUsedEvents(INPUT_MODE_CHANGE);
|
||||||
|
|
||||||
std::shared_ptr<CIntObject> background = widget<CIntObject>("background");
|
std::shared_ptr<CIntObject> background = widget<CIntObject>("background");
|
||||||
pos.w = background->pos.w;
|
pos.w = background->pos.w;
|
||||||
pos.h = background->pos.h;
|
pos.h = background->pos.h;
|
||||||
@ -196,3 +198,8 @@ void SettingsMainWindow::onScreenResize()
|
|||||||
if (tab)
|
if (tab)
|
||||||
tab->updateResolutionSelector();
|
tab->updateResolutionSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsMainWindow::inputModeChanged(InputMode mode)
|
||||||
|
{
|
||||||
|
tabContentArea->reset();
|
||||||
|
}
|
||||||
|
@ -42,5 +42,6 @@ public:
|
|||||||
|
|
||||||
void showAll(Canvas & to) override;
|
void showAll(Canvas & to) override;
|
||||||
void onScreenResize() override;
|
void onScreenResize() override;
|
||||||
|
void inputModeChanged(InputMode mode) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@
|
|||||||
"type" : "object",
|
"type" : "object",
|
||||||
"additionalProperties" : false,
|
"additionalProperties" : false,
|
||||||
"default" : {},
|
"default" : {},
|
||||||
"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "smoothDragging", "backgroundDimLevel", "hideBackground", "backgroundDimSmallWindows" ],
|
"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "rightButtonDrag", "smoothDragging", "backgroundDimLevel", "hideBackground", "backgroundDimSmallWindows" ],
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"heroMoveTime" : {
|
"heroMoveTime" : {
|
||||||
"type" : "number",
|
"type" : "number",
|
||||||
|
@ -364,13 +364,25 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "vcmi.adventureOptions.leftButtonDrag.hover",
|
"text": "vcmi.adventureOptions.leftButtonDrag.hover",
|
||||||
"created" : "desktop"
|
"created" : "keyboardMouse"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "vcmi.adventureOptions.smoothDragging.hover"
|
"text": "vcmi.adventureOptions.smoothDragging.hover"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "verticalLayout",
|
||||||
|
"customType": "labelDescription",
|
||||||
|
"position": {"x": 225, "y": 415},
|
||||||
|
"items":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"text": "vcmi.adventureOptions.rightButtonDrag.hover",
|
||||||
|
"created" : "keyboardMouse"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "verticalLayout",
|
"type": "verticalLayout",
|
||||||
"customType": "checkbox",
|
"customType": "checkbox",
|
||||||
@ -411,7 +423,7 @@
|
|||||||
"name": "leftButtonDragCheckbox",
|
"name": "leftButtonDragCheckbox",
|
||||||
"help": "vcmi.adventureOptions.leftButtonDrag",
|
"help": "vcmi.adventureOptions.leftButtonDrag",
|
||||||
"callback": "leftButtonDragChanged",
|
"callback": "leftButtonDragChanged",
|
||||||
"created" : "desktop"
|
"created" : "keyboardMouse"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "smoothDraggingCheckbox",
|
"name": "smoothDraggingCheckbox",
|
||||||
@ -419,6 +431,20 @@
|
|||||||
"callback": "smoothDraggingChanged"
|
"callback": "smoothDraggingChanged"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "verticalLayout",
|
||||||
|
"customType": "checkbox",
|
||||||
|
"position": {"x": 190, "y": 413},
|
||||||
|
"items":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "rightButtonDragCheckbox",
|
||||||
|
"help": "vcmi.adventureOptions.rightButtonDrag",
|
||||||
|
"callback": "rightButtonDragChanged",
|
||||||
|
"created" : "keyboardMouse"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user