mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 21:39:41 +00:00
Move gamepad controls to lua interface
This commit is contained in:
parent
c2782426fc
commit
873877795a
9 changed files with 48 additions and 13 deletions
|
@ -202,8 +202,8 @@ namespace MWLua
|
||||||
};
|
};
|
||||||
api["isMouseButtonPressed"]
|
api["isMouseButtonPressed"]
|
||||||
= [](int button) -> bool { return SDL_GetMouseState(nullptr, nullptr) & SDL_BUTTON(button); };
|
= [](int button) -> bool { return SDL_GetMouseState(nullptr, nullptr) & SDL_BUTTON(button); };
|
||||||
api["isGamepadCursorActive"] = [input]() -> bool { return input->isGamepadGuiCursorEnabled(); };
|
api["_isGamepadCursorActive"] = [input]() -> bool { return input->isGamepadGuiCursorEnabled(); };
|
||||||
api["setGamepadCursorActive"] = [input](bool v) {
|
api["_setGamepadCursorActive"] = [input](bool v) {
|
||||||
input->setGamepadGuiCursorEnabled(v);
|
input->setGamepadGuiCursorEnabled(v);
|
||||||
MWBase::Environment::get().getWindowManager()->setCursorActive(v);
|
MWBase::Environment::get().getWindowManager()->setCursorActive(v);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@ paths=(
|
||||||
scripts/omw/ai.lua
|
scripts/omw/ai.lua
|
||||||
scripts/omw/mechanics/animationcontroller.lua
|
scripts/omw/mechanics/animationcontroller.lua
|
||||||
scripts/omw/playercontrols.lua
|
scripts/omw/playercontrols.lua
|
||||||
|
scripts/omw/input/gamepadcontrols.lua
|
||||||
scripts/omw/camera/camera.lua
|
scripts/omw/camera/camera.lua
|
||||||
scripts/omw/mwui/init.lua
|
scripts/omw/mwui/init.lua
|
||||||
scripts/omw/settings/player.lua
|
scripts/omw/settings/player.lua
|
||||||
|
|
|
@ -37,6 +37,7 @@ Lua API reference
|
||||||
interface_animation
|
interface_animation
|
||||||
interface_camera
|
interface_camera
|
||||||
interface_controls
|
interface_controls
|
||||||
|
interface_gamepadcontrols
|
||||||
interface_item_usage
|
interface_item_usage
|
||||||
interface_mwui
|
interface_mwui
|
||||||
interface_settings
|
interface_settings
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Interface GamepadControls
|
||||||
|
=========================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
:file: generated_html/scripts_omw_input_gamepadcontrols.html
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
- by player scripts
|
- by player scripts
|
||||||
- | Allows to alter behavior of the built-in script
|
- | Allows to alter behavior of the built-in script
|
||||||
| that handles player controls.
|
| that handles player controls.
|
||||||
|
* - :ref:`Controls <Interface GamepadControls>`
|
||||||
|
- by player scripts
|
||||||
|
- | Allows to alter behavior of the built-in script
|
||||||
|
| that handles player gamepad controls.
|
||||||
* - :ref:`ItemUsage <Interface ItemUsage>`
|
* - :ref:`ItemUsage <Interface ItemUsage>`
|
||||||
- by global scripts
|
- by global scripts
|
||||||
- | Allows to extend or override built-in item usage
|
- | Allows to extend or override built-in item usage
|
||||||
|
|
|
@ -95,6 +95,7 @@ set(BUILTIN_DATA_FILES
|
||||||
scripts/omw/worldeventhandlers.lua
|
scripts/omw/worldeventhandlers.lua
|
||||||
scripts/omw/input/actionbindings.lua
|
scripts/omw/input/actionbindings.lua
|
||||||
scripts/omw/input/smoothmovement.lua
|
scripts/omw/input/smoothmovement.lua
|
||||||
|
scripts/omw/input/gamepadcontrols.lua
|
||||||
|
|
||||||
shaders/adjustments.omwfx
|
shaders/adjustments.omwfx
|
||||||
shaders/bloomlinear.omwfx
|
shaders/bloomlinear.omwfx
|
||||||
|
|
|
@ -16,6 +16,7 @@ PLAYER: scripts/omw/playercontrols.lua
|
||||||
PLAYER: scripts/omw/camera/camera.lua
|
PLAYER: scripts/omw/camera/camera.lua
|
||||||
PLAYER: scripts/omw/input/actionbindings.lua
|
PLAYER: scripts/omw/input/actionbindings.lua
|
||||||
PLAYER: scripts/omw/input/smoothmovement.lua
|
PLAYER: scripts/omw/input/smoothmovement.lua
|
||||||
|
PLAYER: scripts/omw/input/gamepadcontrols.lua
|
||||||
NPC,CREATURE: scripts/omw/ai.lua
|
NPC,CREATURE: scripts/omw/ai.lua
|
||||||
|
|
||||||
# User interface
|
# User interface
|
||||||
|
|
29
files/data/scripts/omw/input/gamepadcontrols.lua
Normal file
29
files/data/scripts/omw/input/gamepadcontrols.lua
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
local input = require('openmw.input')
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
interfaceName = 'GamepadControls',
|
||||||
|
---
|
||||||
|
-- Gamepad control interface
|
||||||
|
-- @module GamepadControls
|
||||||
|
|
||||||
|
interface = {
|
||||||
|
--- Interface version
|
||||||
|
-- @field [parent=#GamepadControls] #number version
|
||||||
|
version = 0,
|
||||||
|
|
||||||
|
--- Checks if the gamepad cursor is active. If it is active, the left stick can move the cursor, and A will be interpreted as a mouse click.
|
||||||
|
-- @function [parent=#GamepadControls] isGamepadCursorActive
|
||||||
|
-- @return #boolean
|
||||||
|
isGamepadCursorActive = function()
|
||||||
|
return input._isGamepadCursorActive()
|
||||||
|
end,
|
||||||
|
|
||||||
|
--- Set if the gamepad cursor is active. If it is active, the left stick can move the cursor, and A will be interpreted as a mouse click.
|
||||||
|
-- @function [parent=#GamepadControls] setGamepadCursorActive
|
||||||
|
-- @param #boolean value
|
||||||
|
setGamepadCursorActive = function(state)
|
||||||
|
input._setGamepadCursorActive(state)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,16 +28,6 @@
|
||||||
-- @param #number buttonId Button index (see @{openmw.input#CONTROLLER_BUTTON})
|
-- @param #number buttonId Button index (see @{openmw.input#CONTROLLER_BUTTON})
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
|
|
||||||
---
|
|
||||||
-- Checks if the gamepad cursor is active. If it is active, the left stick can move the cursor, and A will be interpreted as a mouse click.
|
|
||||||
-- @function [parent=#input] isGamepadCursorActive
|
|
||||||
-- @return #boolean
|
|
||||||
|
|
||||||
---
|
|
||||||
-- Set if the gamepad cursor is active. If it is active, the left stick can move the cursor, and A will be interpreted as a mouse click.
|
|
||||||
-- @function [parent=#input] setGamepadCursorActive
|
|
||||||
-- @param #boolean value
|
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Is `Shift` key pressed.
|
-- Is `Shift` key pressed.
|
||||||
-- @function [parent=#input] isShiftPressed
|
-- @function [parent=#input] isShiftPressed
|
||||||
|
|
Loading…
Reference in a new issue