mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
fix mouse cursors
This commit is contained in:
parent
d3be224713
commit
45f9af8291
1 changed files with 8 additions and 4 deletions
|
@ -26,6 +26,7 @@ typedef struct A {
|
|||
float gamepad_y;
|
||||
float gamepad_vector_x;
|
||||
float gamepad_vector_y;
|
||||
bool has_gamepad;
|
||||
bool kick:1;
|
||||
bool fire:1;
|
||||
bool fire2:1;
|
||||
|
@ -255,9 +256,10 @@ local player_fns = {
|
|||
ComponentSetValue2(controlsComp, "mMousePositionRaw", message.mouseRaw_x, message.mouseRaw_y)
|
||||
ComponentSetValue2(controlsComp, "mMousePositionRawPrev", message.mouseRawPrev_x, message.mouseRawPrev_y)
|
||||
ComponentSetValue2(controlsComp, "mMouseDelta", message.mouseDelta_x, message.mouseDelta_y)
|
||||
if message.mouse_y == nil then
|
||||
if message.has_gamepad then
|
||||
ComponentSetValue2(controlsComp, "mGamePadAimingVectorRaw", message.aim_x, message.aim_y)
|
||||
ComponentSetValue2(controlsComp, "mGamePadCursorInWorld", message.gamepad_vector_x, message.gamepad_vector_y)
|
||||
ComponentSetValue2(controlsComp, "mMousePosition", message.gamepad_x, message.gamepad_y)
|
||||
else
|
||||
ComponentSetValue2(controlsComp, "mMousePosition", message.mouse_x, message.mouse_y)
|
||||
end
|
||||
|
@ -265,7 +267,7 @@ local player_fns = {
|
|||
local children = EntityGetAllChildren(player_data.entity) or {}
|
||||
for i, child in ipairs(children) do
|
||||
if (EntityGetName(child) == "cursor") then
|
||||
if message.gamepad_x == nil then
|
||||
if not message.has_gamepad then
|
||||
EntityApplyTransform(child, message.mouse_x, message.mouse_y)
|
||||
else
|
||||
EntityApplyTransform(child, message.gamepad_x, message.gamepad_y)
|
||||
|
@ -308,7 +310,8 @@ local player_fns = {
|
|||
local gamepad_x, gamepad_y -- float, float
|
||||
local gamepad_vector_x, gamepad_vector_y -- float, float
|
||||
|
||||
if GameGetIsGamepadConnected() then
|
||||
local has_gamepad = GameGetIsGamepadConnected()
|
||||
if has_gamepad then
|
||||
gamepad_x, gamepad_y = ComponentGetValue2(controls, "mGamePadCursorInWorld")
|
||||
gamepad_vector_x, gamepad_vector_y = ComponentGetValue2(controls, "mGamePadAimingVectorRaw")
|
||||
else
|
||||
|
@ -347,7 +350,8 @@ local player_fns = {
|
|||
gamepad_x = gamepad_x,
|
||||
gamepad_y = gamepad_y,
|
||||
gamepad_x = gamepad_vector_x,
|
||||
gamepad_y = gamepad_vector_y
|
||||
gamepad_y = gamepad_vector_y,
|
||||
has_gamepad = has_gamepad
|
||||
}
|
||||
|
||||
return c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue