1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-14 01:19:59 +00:00

Merge branch 'controller_cursor_mode_dhc' into 'master'

Draft: Dehardcode Gamepad Cursor Mode switching, add settings and information

See merge request OpenMW/openmw!4474
This commit is contained in:
Zackhasacat 2025-03-10 16:08:10 +00:00
commit 33fe94eb8f
3 changed files with 18 additions and 7 deletions

View File

@ -284,10 +284,6 @@ namespace MWInput
case SDL_CONTROLLER_BUTTON_RIGHTSHOULDER:
MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Tab, 0, false);
return true;
case SDL_CONTROLLER_BUTTON_LEFTSTICK:
mGamepadGuiCursorEnabled = !mGamepadGuiCursorEnabled;
MWBase::Environment::get().getWindowManager()->setCursorActive(mGamepadGuiCursorEnabled);
return true;
default:
return false;
}

View File

@ -21,7 +21,7 @@ PLAYER: scripts/omw/input/playercontrols.lua
PLAYER: scripts/omw/camera/camera.lua
PLAYER: scripts/omw/input/actionbindings.lua
PLAYER: scripts/omw/input/smoothmovement.lua
PLAYER: scripts/omw/input/gamepadcontrols.lua
MENU: scripts/omw/input/gamepadcontrols.lua
NPC,CREATURE: scripts/omw/ai.lua
# User interface

View File

@ -1,12 +1,27 @@
local input = require('openmw.input')
local ui = require("openmw.ui")
return {
interfaceName = 'GamepadControls',
---
-- Gamepad control interface
-- @module GamepadControls
engineHandlers = {
onControllerButtonPress = function(id)
if id == input.CONTROLLER_BUTTON.LeftStick then
local gamePadActive = input._isGamepadCursorActive()
local options = {
showInDialog = false
}
if gamePadActive then
ui.showMessage("Gamepad Cursor active", options)
else
ui.showMessage("Gamepad Cursor inactive, Tab mode engaged", options) --temp
end
input._setGamepadCursorActive(not gamePadActive)
end
end
},
interface = {
--- Interface version
-- @field [parent=#GamepadControls] #number version