diff --git a/apps/openmw/mwlua/inputbindings.cpp b/apps/openmw/mwlua/inputbindings.cpp index dbe79ca377..cc1e4b99f8 100644 --- a/apps/openmw/mwlua/inputbindings.cpp +++ b/apps/openmw/mwlua/inputbindings.cpp @@ -214,6 +214,12 @@ namespace MWLua input->setGamepadGuiCursorEnabled(v); MWBase::Environment::get().getWindowManager()->setCursorActive(v); }; + api["_selectNextMenuElement"] = []() { + MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Period, 0, false); + }; + api["_selectPrevMenuElement"] = []() { + MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Slash, 0, false); + }; api["getMouseMoveX"] = [input]() { return input->getMouseMoveX(); }; api["getMouseMoveY"] = [input]() { return input->getMouseMoveY(); }; api["getAxisValue"] = [input](int axis) { diff --git a/files/data/scripts/omw/input/gamepadcontrols.lua b/files/data/scripts/omw/input/gamepadcontrols.lua index 0af17efa39..9c8810b98f 100644 --- a/files/data/scripts/omw/input/gamepadcontrols.lua +++ b/files/data/scripts/omw/input/gamepadcontrols.lua @@ -25,5 +25,17 @@ return { setGamepadCursorActive = function(state) input._setGamepadCursorActive(state) end, + + --- Sends an event to the interface to select the next menu element + -- @function [parent=#GamepadControls] selectNextMenuElement + selectNextMenuElement = function(state) + input._selectNextMenuElement() + end, + + --- Sends an event to the interface to select the next menu element + -- @function [parent=#GamepadControls] selectPrevMenuElement + selectPrevMenuElement = function(state) + input._selectPrevMenuElement() + end, } }