From baf8242624613e2d1b31830fdee9609bed23ef53 Mon Sep 17 00:00:00 2001 From: Pipo Date: Fri, 2 Dec 2022 11:52:20 +0100 Subject: [PATCH] Button to GamepadButton --- .../cauldron/direction_2D_to_3D_converter.js | 100 ++++++++++++++---- .../js/pp/gameplay/grab_throw/grabber_hand.js | 32 +++--- .../js/pp/input/cauldron/mouse.js | 1 - .../js/pp/input/gamepad/base_gamepad.js | 68 ++++++------ .../gamepad/cauldron/gamepad_mesh_animator.js | 18 ++-- .../input/gamepad/cauldron/gamepad_utils.js | 32 +++--- .../js/pp/input/gamepad/gamepad_buttons.js | 18 ++-- .../gamepad_cores/keyboard_gamepad_core.js | 45 ++++---- .../gamepad/gamepad_cores/xr_gamepad_core.js | 9 +- .../pp/plugin/extensions/array_extension.js | 6 ++ .../pp/tool/console_vr/console_vr_widget.js | 4 +- .../easy_object_tuners/easy_light_color.js | 4 +- .../easy_object_tuners/easy_mesh_color.js | 4 +- .../easy_object_tuners/easy_text_color.js | 4 +- .../easy_tune_widgets/easy_tune_widget.js | 4 +- 15 files changed, 204 insertions(+), 145 deletions(-) diff --git a/wle_pp/wle_pp_bundler/js/pp/gameplay/cauldron/direction_2D_to_3D_converter.js b/wle_pp/wle_pp_bundler/js/pp/gameplay/cauldron/direction_2D_to_3D_converter.js index 27611c1..8556bde 100644 --- a/wle_pp/wle_pp_bundler/js/pp/gameplay/cauldron/direction_2D_to_3D_converter.js +++ b/wle_pp/wle_pp_bundler/js/pp/gameplay/cauldron/direction_2D_to_3D_converter.js @@ -28,13 +28,15 @@ PP.Direction2DTo3DConverter = class Direction2DTo3DConverter { this._myLastValidFlatRight = PP.vec3_create(); //Setup + this._myMinAngleToBeValid = 5; } - // directionUp is needed when u want to understand when the direction is going to fly or not - // if you don't want the direction to be flat (so like it's always flying) you can avoid specifying it - convert(direction2D, referenceTransformQuat, directionUp = null, outDirection3D = PP.vec3_create()) { - // implemented outside class definition + // direction3DUp can be used to flat the direction if the conversionTransform is not aligned with it + // it's also needed to specify the fly axis, if different from the conversionTransform up + // if direction3DUp is null, conversionTransform up is used + convert(direction2D, conversionTransform, direction3DUp = null, outDirection3D = PP.vec3_create()) { + return this.convertTransform(direction2D, conversionTransform, direction3DUp, outDirection3D); } isFlying() { @@ -99,15 +101,67 @@ PP.Direction2DTo3DConverter = class Direction2DTo3DConverter { this._myLastValidFlatRight.vec3_zero(); } + + // Convert Alternatives + + // if direction3DUp is null, [0, 1, 0] is used + // does not work properly if forward is aligned with direction3DUp + convertForward(direction2D, forward, direction3DUp = null, outDirection3D = PP.vec3_create()) { + // implemented outside class definition + } + + // direction3DUp can be used to flat the direction if the conversionTransform is not aligned with it + // it's also needed to specify the fly axis, if different from the conversionTransform up + // if direction3DUp is null, conversionTransform up is used + convertTransform(direction2D, conversionTransform, direction3DUp = null, outDirection3D = PP.vec3_create()) { + return this.convertTransformMatrix(direction2D, conversionTransform, direction3DUp = null, outDirection3D); + } + + convertTransformMatrix(direction2D, conversionTransformMatrix, direction3DUp = null, outDirection3D = PP.vec3_create()) { + // implemented outside class definition + } + + convertTransformQuat(direction2D, conversionTransformQuat, direction3DUp = null, outDirection3D = PP.vec3_create()) { + // implemented outside class definition + } + + convertRotationQuat(direction2D, conversionRotationQuat, direction3DUp = null, outDirection3D = PP.vec3_create()) { + // implemented outside class definition + } }; -PP.Direction2DTo3DConverter.prototype.convert = function () { +PP.Direction2DTo3DConverter.prototype.convertForward = function () { + let rotationQuat = PP.quat_create(); + return function convertForward(direction2D, forward, direction3DUp = null, outDirection3D = PP.vec3_create()) { + rotationQuat.quat_identity(); + rotationQuat.quat_setForward(forward, direction3DUp); + return this.convertRotationQuat(direction2D, rotationQuat, direction3DUp, outDirection3D); + } +}(); + +PP.Direction2DTo3DConverter.prototype.convertTransformMatrix = function () { + let rotationQuat = PP.quat_create(); + return function convertTransformMatrix(direction2D, conversionTransformMatrix, direction3DUp = null, outDirection3D = PP.vec3_create()) { + rotationQuat = conversionTransformMatrix.mat4_getRotationQuat(rotationQuat); + return this.convertRotationQuat(direction2D, rotationQuat, direction3DUp, outDirection3D); + } +}(); + +PP.Direction2DTo3DConverter.prototype.convertTransformQuat = function () { + let rotationQuat = PP.quat_create(); + return function convertTransformQuat(direction2D, conversionTransformQuat, direction3DUp = null, outDirection3D = PP.vec3_create()) { + rotationQuat = conversionTransformQuat.quat2_getRotationQuat(rotationQuat); + return this.convertRotationQuat(direction2D, rotationQuat, direction3DUp, outDirection3D); + } +}(); + +PP.Direction2DTo3DConverter.prototype.convertRotationQuat = function () { let forward = PP.vec3_create(); let right = PP.vec3_create(); - let directionUpNegate = PP.vec3_create(); + let direction3DUpNegate = PP.vec3_create(); let forwardScaled = PP.vec3_create(); let rightScaled = PP.vec3_create(); - return function convert(direction2D, referenceTransformQuat, directionUp = null, outDirection3D = PP.vec3_create()) { + return function convertRotationQuat(direction2D, conversionRotationQuat, direction3DUp = null, outDirection3D = PP.vec3_create()) { if (direction2D.vec2_isZero()) { let resetFlyForward = this._myParams.myAutoUpdateFlyForward && this._myParams.myResetFlyForwardWhenZero; if (resetFlyForward) { @@ -130,21 +184,21 @@ PP.Direction2DTo3DConverter.prototype.convert = function () { } } - forward = referenceTransformQuat.quat2_getForward(forward); - right = referenceTransformQuat.quat2_getRight(right); + forward = conversionRotationQuat.quat_getForward(forward); + right = conversionRotationQuat.quat_getRight(right); - if (directionUp != null) { - directionUpNegate = directionUp.vec3_negate(directionUpNegate); + if (direction3DUp != null) { + direction3DUpNegate = direction3DUp.vec3_negate(direction3DUpNegate); // check if it is flying based on the convert transform orientation if (this._myParams.myAutoUpdateFlyForward) { - let angleForwardWithDirectionUp = forward.vec3_angle(directionUp); + let angleForwardWithDirectionUp = forward.vec3_angle(direction3DUp); this._myIsFlyingForward = this._myIsFlyingForward || (angleForwardWithDirectionUp < 90 - this._myParams.myMinAngleToFlyForwardUp || angleForwardWithDirectionUp > 90 + this._myParams.myMinAngleToFlyForwardDown); } if (this._myParams.myAutoUpdateFlyRight) { - let angleRightWithDirectionUp = right.vec3_angle(directionUp); + let angleRightWithDirectionUp = right.vec3_angle(direction3DUp); this._myIsFlyingRight = this._myIsFlyingRight || (angleRightWithDirectionUp < 90 - this._myParams.myMinAngleToFlyRightUp || angleRightWithDirectionUp > 90 + this._myParams.myMinAngleToFlyRightDown); } @@ -152,7 +206,7 @@ PP.Direction2DTo3DConverter.prototype.convert = function () { // remove the component to prevent flying, if needed if (!this._myIsFlyingForward) { // if the forward is too similar to the up (or down) take the last valid forward - if (!this._myLastValidFlatForward.vec3_isZero(0.000001) && (forward.vec3_angle(directionUp) < this._myMinAngleToBeValid || forward.vec3_angle(directionUpNegate) < this._myMinAngleToBeValid)) { + if (!this._myLastValidFlatForward.vec3_isZero(0.000001) && (forward.vec3_angle(direction3DUp) < this._myMinAngleToBeValid || forward.vec3_angle(direction3DUpNegate) < this._myMinAngleToBeValid)) { if (forward.vec3_isConcordant(this._myLastValidFlatForward)) { forward.pp_copy(this._myLastValidFlatForward); } else { @@ -160,13 +214,13 @@ PP.Direction2DTo3DConverter.prototype.convert = function () { } } - forward = forward.vec3_removeComponentAlongAxis(directionUp, forward); + forward = forward.vec3_removeComponentAlongAxis(direction3DUp, forward); forward.vec3_normalize(forward); } if (!this._myIsFlyingRight) { // if the right is too similar to the up (or down) take the last valid right - if (!this._myLastValidFlatRight.vec3_isZero(0.000001) && (right.vec3_angle(directionUp) < this._myMinAngleToBeValid || right.vec3_angle(directionUpNegate) < this._myMinAngleToBeValid)) { + if (!this._myLastValidFlatRight.vec3_isZero(0.000001) && (right.vec3_angle(direction3DUp) < this._myMinAngleToBeValid || right.vec3_angle(direction3DUpNegate) < this._myMinAngleToBeValid)) { if (right.vec3_isConcordant(this._myLastValidFlatRight)) { right.pp_copy(this._myLastValidFlatRight); } else { @@ -174,20 +228,20 @@ PP.Direction2DTo3DConverter.prototype.convert = function () { } } - right = right.vec3_removeComponentAlongAxis(directionUp, right); + right = right.vec3_removeComponentAlongAxis(direction3DUp, right); right.vec3_normalize(right); } // update last valid - if ((forward.vec3_angle(directionUp) > this._myMinAngleToBeValid && forward.vec3_angle(directionUpNegate) > this._myMinAngleToBeValid) || + if ((forward.vec3_angle(direction3DUp) > this._myMinAngleToBeValid && forward.vec3_angle(direction3DUpNegate) > this._myMinAngleToBeValid) || (direction2D[1] != 0 && this._myLastValidFlatForward.vec3_isZero(0.000001))) { - this._myLastValidFlatForward = forward.vec3_removeComponentAlongAxis(directionUp, this._myLastValidFlatForward); + this._myLastValidFlatForward = forward.vec3_removeComponentAlongAxis(direction3DUp, this._myLastValidFlatForward); this._myLastValidFlatForward.vec3_normalize(this._myLastValidFlatForward); } - if ((right.vec3_angle(directionUp) > this._myMinAngleToBeValid && right.vec3_angle(directionUpNegate) > this._myMinAngleToBeValid) || + if ((right.vec3_angle(direction3DUp) > this._myMinAngleToBeValid && right.vec3_angle(direction3DUpNegate) > this._myMinAngleToBeValid) || (direction2D[0] != 0 && this._myLastValidFlatRight.vec3_isZero(0.000001))) { - this._myLastValidFlatRight = right.vec3_removeComponentAlongAxis(directionUp, this._myLastValidFlatRight); + this._myLastValidFlatRight = right.vec3_removeComponentAlongAxis(direction3DUp, this._myLastValidFlatRight); this._myLastValidFlatRight.vec3_normalize(this._myLastValidFlatRight); } } @@ -195,8 +249,8 @@ PP.Direction2DTo3DConverter.prototype.convert = function () { // compute direction 3D outDirection3D = right.vec3_scale(direction2D[0], rightScaled).vec3_add(forward.vec3_scale(direction2D[1], forwardScaled), outDirection3D); - if (directionUp != null && !this._myIsFlyingForward && !this._myIsFlyingRight) { - outDirection3D = outDirection3D.vec3_removeComponentAlongAxis(directionUp, outDirection3D); + if (direction3DUp != null && !this._myIsFlyingForward && !this._myIsFlyingRight) { + outDirection3D = outDirection3D.vec3_removeComponentAlongAxis(direction3DUp, outDirection3D); } outDirection3D.vec3_normalize(outDirection3D); diff --git a/wle_pp/wle_pp_bundler/js/pp/gameplay/grab_throw/grabber_hand.js b/wle_pp/wle_pp_bundler/js/pp/gameplay/grab_throw/grabber_hand.js index 6eb4284..77b2eb1 100644 --- a/wle_pp/wle_pp_bundler/js/pp/gameplay/grab_throw/grabber_hand.js +++ b/wle_pp/wle_pp_bundler/js/pp/gameplay/grab_throw/grabber_hand.js @@ -81,17 +81,17 @@ WL.registerComponent('pp-grabber-hand', { } if (this._myGrabButton == 0) { - this._myGamepad.registerButtonEventListener(PP.ButtonType.SELECT, PP.ButtonEvent.PRESS_START, this, this._grab.bind(this, PP.ButtonType.SELECT)); - this._myGamepad.registerButtonEventListener(PP.ButtonType.SELECT, PP.ButtonEvent.PRESS_END, this, this._throw.bind(this, PP.ButtonType.SELECT)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonType.SELECT)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonType.SELECT)); } else if (this._myGrabButton == 1) { - this._myGamepad.registerButtonEventListener(PP.ButtonType.SQUEEZE, PP.ButtonEvent.PRESS_START, this, this._grab.bind(this, PP.ButtonType.SQUEEZE)); - this._myGamepad.registerButtonEventListener(PP.ButtonType.SQUEEZE, PP.ButtonEvent.PRESS_END, this, this._throw.bind(this, PP.ButtonType.SQUEEZE)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonType.SQUEEZE)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonType.SQUEEZE)); } else { - this._myGamepad.registerButtonEventListener(PP.ButtonType.SQUEEZE, PP.ButtonEvent.PRESS_START, this, this._grab.bind(this, PP.ButtonType.SQUEEZE)); - this._myGamepad.registerButtonEventListener(PP.ButtonType.SQUEEZE, PP.ButtonEvent.PRESS_END, this, this._throw.bind(this, PP.ButtonType.SQUEEZE)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonType.SQUEEZE)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonType.SQUEEZE)); - this._myGamepad.registerButtonEventListener(PP.ButtonType.SELECT, PP.ButtonEvent.PRESS_START, this, this._grab.bind(this, PP.ButtonType.SELECT)); - this._myGamepad.registerButtonEventListener(PP.ButtonType.SELECT, PP.ButtonEvent.PRESS_END, this, this._throw.bind(this, PP.ButtonType.SELECT)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_START, this, this._grab.bind(this, PP.GamepadButtonType.SELECT)); + this._myGamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_END, this, this._throw.bind(this, PP.GamepadButtonType.SELECT)); } }, onDeactivate() { @@ -100,17 +100,17 @@ WL.registerComponent('pp-grabber-hand', { } if (this._myGrabButton == 0) { - this._myGamepad.unregisterButtonEventListener(PP.ButtonType.SELECT, PP.ButtonEvent.PRESS_START, this); - this._myGamepad.unregisterButtonEventListener(PP.ButtonType.SELECT, PP.ButtonEvent.PRESS_END, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_START, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_END, this); } else if (this._myGrabButton == 1) { - this._myGamepad.unregisterButtonEventListener(PP.ButtonType.SQUEEZE, PP.ButtonEvent.PRESS_START, this); - this._myGamepad.unregisterButtonEventListener(PP.ButtonType.SQUEEZE, PP.ButtonEvent.PRESS_END, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this); } else { - this._myGamepad.unregisterButtonEventListener(PP.ButtonType.SQUEEZE, PP.ButtonEvent.PRESS_START, this); - this._myGamepad.unregisterButtonEventListener(PP.ButtonType.SQUEEZE, PP.ButtonEvent.PRESS_END, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_START, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.PRESS_END, this); - this._myGamepad.unregisterButtonEventListener(PP.ButtonType.SELECT, PP.ButtonEvent.PRESS_START, this); - this._myGamepad.unregisterButtonEventListener(PP.ButtonType.SELECT, PP.ButtonEvent.PRESS_END, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_START, this); + this._myGamepad.unregisterButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.PRESS_END, this); } }, _grab: function (grabButton) { diff --git a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/mouse.js b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/mouse.js index e4abdbc..dfd63c9 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/cauldron/mouse.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/cauldron/mouse.js @@ -7,7 +7,6 @@ PP.MouseButtonType = { PP.Mouse = class Mouse { constructor() { // #TODO refactor Mouse/Keyboard/Gamepad and create a sort of parent ButtonHandler that have the base ButtonInfo and all of them inherit - // ButtonType could also become GamepadButtonID or directly GamepadButton like in Unity this._myButtonInfos = new Map(); for (let typeKey in PP.MouseButtonType) { diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/base_gamepad.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/base_gamepad.js index 870f154..acb24ca 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/base_gamepad.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/base_gamepad.js @@ -4,26 +4,26 @@ PP.BaseGamepad = class BaseGamepad { this._myHandedness = handedness; this._myButtonInfos = []; - for (let key in PP.ButtonType) { - this._myButtonInfos[PP.ButtonType[key]] = new PP.ButtonInfo(PP.ButtonType[key], this._myHandedness); + for (let key in PP.GamepadButtonType) { + this._myButtonInfos[PP.GamepadButtonType[key]] = new PP.GamepadButtonInfo(PP.GamepadButtonType[key], this._myHandedness); } - this._myAxesInfo = new PP.AxesInfo(this._myHandedness); + this._myAxesInfo = new PP.GamepadAxesInfo(this._myHandedness); this._myButtonCallbacks = []; // Signature: callback(ButtonInfo, Gamepad) - for (let typeKey in PP.ButtonType) { - this._myButtonCallbacks[PP.ButtonType[typeKey]] = []; - for (let eventKey in PP.ButtonEvent) { - this._myButtonCallbacks[PP.ButtonType[typeKey]][PP.ButtonEvent[eventKey]] = new Map(); + for (let typeKey in PP.GamepadButtonType) { + this._myButtonCallbacks[PP.GamepadButtonType[typeKey]] = []; + for (let eventKey in PP.GamepadButtonEvent) { + this._myButtonCallbacks[PP.GamepadButtonType[typeKey]][PP.GamepadButtonEvent[eventKey]] = new Map(); } } this._myAxesCallbacks = []; // Signature: callback(AxesInfo, Gamepad) - for (let eventKey in PP.AxesEvent) { - this._myAxesCallbacks[PP.AxesEvent[eventKey]] = new Map(); + for (let eventKey in PP.GamepadAxesEvent) { + this._myAxesCallbacks[PP.GamepadAxesEvent[eventKey]] = new Map(); } - this._myPulseInfo = new PP.PulseInfo(); + this._myPulseInfo = new PP.GamepadPulseInfo(); //Setup this._myMultiplePressMaxDelay = 0.3; @@ -160,13 +160,13 @@ PP.BaseGamepad = class BaseGamepad { } _updateButtonInfos() { - this._updateSingleButtonInfo(PP.ButtonType.SELECT); - this._updateSingleButtonInfo(PP.ButtonType.SQUEEZE); - this._updateSingleButtonInfo(PP.ButtonType.TOUCHPAD); - this._updateSingleButtonInfo(PP.ButtonType.THUMBSTICK); - this._updateSingleButtonInfo(PP.ButtonType.BOTTOM_BUTTON); - this._updateSingleButtonInfo(PP.ButtonType.TOP_BUTTON); - this._updateSingleButtonInfo(PP.ButtonType.THUMB_REST); + this._updateSingleButtonInfo(PP.GamepadButtonType.SELECT); + this._updateSingleButtonInfo(PP.GamepadButtonType.SQUEEZE); + this._updateSingleButtonInfo(PP.GamepadButtonType.TOUCHPAD); + this._updateSingleButtonInfo(PP.GamepadButtonType.THUMBSTICK); + this._updateSingleButtonInfo(PP.GamepadButtonType.BOTTOM_BUTTON); + this._updateSingleButtonInfo(PP.GamepadButtonType.TOP_BUTTON); + this._updateSingleButtonInfo(PP.GamepadButtonType.THUMB_REST); } _updateSingleButtonInfo(buttonType) { @@ -257,56 +257,56 @@ PP.BaseGamepad = class BaseGamepad { } }.bind(this)); - for (let typeKey in PP.ButtonType) { - let buttonInfo = this._myButtonInfos[PP.ButtonType[typeKey]]; - let buttonCallbacks = this._myButtonCallbacks[PP.ButtonType[typeKey]]; + for (let typeKey in PP.GamepadButtonType) { + let buttonInfo = this._myButtonInfos[PP.GamepadButtonType[typeKey]]; + let buttonCallbacks = this._myButtonCallbacks[PP.GamepadButtonType[typeKey]]; //PRESSED if (buttonInfo.myIsPressed && !buttonInfo.myPrevIsPressed) { - let callbacksMap = buttonCallbacks[PP.ButtonEvent.PRESS_START]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.PRESS_START]; this._triggerCallbacks(callbacksMap, buttonInfo); } if (!buttonInfo.myIsPressed && buttonInfo.myPrevIsPressed) { - let callbacksMap = buttonCallbacks[PP.ButtonEvent.PRESS_END]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.PRESS_END]; this._triggerCallbacks(callbacksMap, buttonInfo); } if (buttonInfo.myIsPressed) { - let callbacksMap = buttonCallbacks[PP.ButtonEvent.PRESSED]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.PRESSED]; this._triggerCallbacks(callbacksMap, buttonInfo); } else { - let callbacksMap = buttonCallbacks[PP.ButtonEvent.NOT_PRESSED]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.NOT_PRESSED]; this._triggerCallbacks(callbacksMap, buttonInfo); } //TOUCHED if (buttonInfo.myIsTouched && !buttonInfo.myPrevIsTouched) { - let callbacksMap = buttonCallbacks[PP.ButtonEvent.TOUCH_START]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.TOUCH_START]; this._triggerCallbacks(callbacksMap, buttonInfo); } if (!buttonInfo.myIsTouched && buttonInfo.myPrevIsTouched) { - let callbacksMap = buttonCallbacks[PP.ButtonEvent.TOUCH_END]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.TOUCH_END]; this._triggerCallbacks(callbacksMap, buttonInfo); } if (buttonInfo.myIsTouched) { - let callbacksMap = buttonCallbacks[PP.ButtonEvent.TOUCHED]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.TOUCHED]; this._triggerCallbacks(callbacksMap, buttonInfo); } else { - let callbacksMap = buttonCallbacks[PP.ButtonEvent.NOT_TOUCHED]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.NOT_TOUCHED]; this._triggerCallbacks(callbacksMap, buttonInfo); } //VALUE if (buttonInfo.myValue != buttonInfo.myPrevValue) { - let callbacksMap = buttonCallbacks[PP.ButtonEvent.VALUE_CHANGED]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.VALUE_CHANGED]; this._triggerCallbacks(callbacksMap, buttonInfo); } //ALWAYS - let callbacksMap = buttonCallbacks[PP.ButtonEvent.ALWAYS]; + let callbacksMap = buttonCallbacks[PP.GamepadButtonEvent.ALWAYS]; this._triggerCallbacks(callbacksMap, buttonInfo); } @@ -327,25 +327,25 @@ PP.BaseGamepad = class BaseGamepad { _postUpdateAxesInfos() { //X CHANGED if (this._myAxesInfo.myAxes[0] != this._myAxesInfo.myPrevAxes[0]) { - let callbacksMap = this._myAxesCallbacks[PP.AxesEvent.X_CHANGED]; + let callbacksMap = this._myAxesCallbacks[PP.GamepadAxesEvent.X_CHANGED]; this._triggerCallbacks(callbacksMap, this._myAxesInfo); } //Y CHANGED if (this._myAxesInfo.myAxes[1] != this._myAxesInfo.myPrevAxes[1]) { - let callbacksMap = this._myAxesCallbacks[PP.AxesEvent.Y_CHANGED]; + let callbacksMap = this._myAxesCallbacks[PP.GamepadAxesEvent.Y_CHANGED]; this._triggerCallbacks(callbacksMap, this._myAxesInfo); } //AXES CHANGED if (this._myAxesInfo.myAxes[0] != this._myAxesInfo.myPrevAxes[0] || this._myAxesInfo.myAxes[1] != this._myAxesInfo.myPrevAxes[1]) { - let callbacksMap = this._myAxesCallbacks[PP.AxesEvent.AXES_CHANGED]; + let callbacksMap = this._myAxesCallbacks[PP.GamepadAxesEvent.AXES_CHANGED]; this._triggerCallbacks(callbacksMap, this._myAxesInfo); } //ALWAYS - let callbacksMap = this._myAxesCallbacks[PP.AxesEvent.ALWAYS]; + let callbacksMap = this._myAxesCallbacks[PP.GamepadAxesEvent.ALWAYS]; this._triggerCallbacks(callbacksMap, this._myAxesInfo); } diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_mesh_animator.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_mesh_animator.js index cfc11f4..ca4436e 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_mesh_animator.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_mesh_animator.js @@ -54,33 +54,33 @@ WL.registerComponent('pp-gamepad-mesh-animator', { // PRESSED if (this._myThumbstick != null) { - gamepad.registerButtonEventListener(PP.ButtonType.THUMBSTICK, PP.ButtonEvent.PRESS_START, this, this._thumbstickPressedStart.bind(this)); - gamepad.registerButtonEventListener(PP.ButtonType.THUMBSTICK, PP.ButtonEvent.PRESS_END, this, this._thumbstickPressedEnd.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonType.THUMBSTICK, PP.GamepadButtonEvent.PRESS_START, this, this._thumbstickPressedStart.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonType.THUMBSTICK, PP.GamepadButtonEvent.PRESS_END, this, this._thumbstickPressedEnd.bind(this)); } if (this._myTopButton != null) { - gamepad.registerButtonEventListener(PP.ButtonType.TOP_BUTTON, PP.ButtonEvent.PRESS_START, this, this._topButtonPressedStart.bind(this)); - gamepad.registerButtonEventListener(PP.ButtonType.TOP_BUTTON, PP.ButtonEvent.PRESS_END, this, this._topButtonPressedEnd.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonType.TOP_BUTTON, PP.GamepadButtonEvent.PRESS_START, this, this._topButtonPressedStart.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonType.TOP_BUTTON, PP.GamepadButtonEvent.PRESS_END, this, this._topButtonPressedEnd.bind(this)); } if (this._myBottomButton != null) { - gamepad.registerButtonEventListener(PP.ButtonType.BOTTOM_BUTTON, PP.ButtonEvent.PRESS_START, this, this._bottomButtonPressedStart.bind(this)); - gamepad.registerButtonEventListener(PP.ButtonType.BOTTOM_BUTTON, PP.ButtonEvent.PRESS_END, this, this._bottomButtonPressedEnd.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonType.BOTTOM_BUTTON, PP.GamepadButtonEvent.PRESS_START, this, this._bottomButtonPressedStart.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonType.BOTTOM_BUTTON, PP.GamepadButtonEvent.PRESS_END, this, this._bottomButtonPressedEnd.bind(this)); } // VALUE CHANGED if (this._mySelect != null) { - gamepad.registerButtonEventListener(PP.ButtonType.SELECT, PP.ButtonEvent.VALUE_CHANGED, this, this._selectValueChanged.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonType.SELECT, PP.GamepadButtonEvent.VALUE_CHANGED, this, this._selectValueChanged.bind(this)); } if (this._mySqueeze != null) { - gamepad.registerButtonEventListener(PP.ButtonType.SQUEEZE, PP.ButtonEvent.VALUE_CHANGED, this, this._squeezeValueChanged.bind(this)); + gamepad.registerButtonEventListener(PP.GamepadButtonType.SQUEEZE, PP.GamepadButtonEvent.VALUE_CHANGED, this, this._squeezeValueChanged.bind(this)); } // AXES CHANGED if (this._myThumbstick != null) { - gamepad.registerAxesEventListener(PP.AxesEvent.AXES_CHANGED, this, this._thumbstickValueChanged.bind(this)); + gamepad.registerAxesEventListener(PP.GamepadAxesEvent.AXES_CHANGED, this, this._thumbstickValueChanged.bind(this)); } }, _thumbstickPressedStart: function () { diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_utils.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_utils.js index a8a88f4..bea7c99 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_utils.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/cauldron/gamepad_utils.js @@ -27,8 +27,8 @@ PP.GamepadUtils = { for (let gamepadButtonTypes of realGamepadButtonTypesList) { if (gamepadButtonTypes.length == 1) { - for (let key in PP.ButtonType) { - gamepadButtonTypes.push(PP.ButtonType[key]); + for (let key in PP.GamepadButtonType) { + gamepadButtonTypes.push(PP.GamepadButtonType[key]); } } } @@ -66,8 +66,8 @@ PP.GamepadUtils = { for (let gamepadButtonTypes of realGamepadButtonTypesList) { if (gamepadButtonTypes.length == 1) { - for (let key in PP.ButtonType) { - gamepadButtonTypes.push(PP.ButtonType[key]); + for (let key in PP.GamepadButtonType) { + gamepadButtonTypes.push(PP.GamepadButtonType[key]); } } } @@ -107,8 +107,8 @@ PP.GamepadUtils = { for (let gamepadButtonTypes of realGamepadButtonTypesList) { if (gamepadButtonTypes.length == 1) { - for (let key in PP.ButtonType) { - gamepadButtonTypes.push(PP.ButtonType[key]); + for (let key in PP.GamepadButtonType) { + gamepadButtonTypes.push(PP.GamepadButtonType[key]); } } } @@ -143,8 +143,8 @@ PP.GamepadUtils = { for (let gamepadButtonTypes of realGamepadButtonTypesList) { if (gamepadButtonTypes.length == 1) { - for (let key in PP.ButtonType) { - gamepadButtonTypes.push(PP.ButtonType[key]); + for (let key in PP.GamepadButtonType) { + gamepadButtonTypes.push(PP.GamepadButtonType[key]); } } } @@ -184,8 +184,8 @@ PP.GamepadUtils = { for (let gamepadButtonTypes of realGamepadButtonTypesList) { if (gamepadButtonTypes.length == 1) { - for (let key in PP.ButtonType) { - gamepadButtonTypes.push(PP.ButtonType[key]); + for (let key in PP.GamepadButtonType) { + gamepadButtonTypes.push(PP.GamepadButtonType[key]); } } } @@ -220,8 +220,8 @@ PP.GamepadUtils = { for (let gamepadButtonTypes of realGamepadButtonTypesList) { if (gamepadButtonTypes.length == 1) { - for (let key in PP.ButtonType) { - gamepadButtonTypes.push(PP.ButtonType[key]); + for (let key in PP.GamepadButtonType) { + gamepadButtonTypes.push(PP.GamepadButtonType[key]); } } } @@ -261,8 +261,8 @@ PP.GamepadUtils = { for (let gamepadButtonTypes of realGamepadButtonTypesList) { if (gamepadButtonTypes.length == 1) { - for (let key in PP.ButtonType) { - gamepadButtonTypes.push(PP.ButtonType[key]); + for (let key in PP.GamepadButtonType) { + gamepadButtonTypes.push(PP.GamepadButtonType[key]); } } } @@ -297,8 +297,8 @@ PP.GamepadUtils = { for (let gamepadButtonTypes of realGamepadButtonTypesList) { if (gamepadButtonTypes.length == 1) { - for (let key in PP.ButtonType) { - gamepadButtonTypes.push(PP.ButtonType[key]); + for (let key in PP.GamepadButtonType) { + gamepadButtonTypes.push(PP.GamepadButtonType[key]); } } } diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_buttons.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_buttons.js index 5f9efab..b6b7460 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_buttons.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_buttons.js @@ -1,4 +1,4 @@ -PP.ButtonType = { +PP.GamepadButtonType = { SELECT: 0, // Trigger SQUEEZE: 1, // Grip TOUCHPAD: 2, // This is to support older gamepads, you can just use TOP_BUTTON to use this button for both older and newer gamepads @@ -8,7 +8,7 @@ PP.ButtonType = { THUMB_REST: 6 }; -PP.ButtonEvent = { +PP.GamepadButtonEvent = { PRESS_START: 0, PRESS_END: 1, PRESSED: 2, //Every frame that it is pressed @@ -21,14 +21,14 @@ PP.ButtonEvent = { ALWAYS: 9, //Every frame }; -PP.AxesEvent = { +PP.GamepadAxesEvent = { X_CHANGED: 0, Y_CHANGED: 1, AXES_CHANGED: 2, ALWAYS: 3 }; -PP.ButtonInfo = class ButtonInfo { +PP.GamepadButtonInfo = class GamepadButtonInfo { constructor(type, handedness) { this.myType = type; this.myHandedness = handedness; @@ -102,7 +102,7 @@ PP.ButtonInfo = class ButtonInfo { } clone() { - let value = new ButtonInfo(this.myType, this.myHandedness); + let value = new PP.GamepadButtonInfo(this.myType, this.myHandedness); value.myIsPressed = this.myIsPressed; value.myPrevIsPressed = this.myPrevIsPressed; value.myIsTouched = this.myIsTouched; @@ -134,7 +134,7 @@ PP.ButtonInfo = class ButtonInfo { } }; -PP.AxesInfo = class AxesInfo { +PP.GamepadAxesInfo = class GamepadAxesInfo { constructor(handedness) { this.myHandedness = handedness; @@ -154,7 +154,7 @@ PP.AxesInfo = class AxesInfo { } clone() { - let value = new AxesInfo(this.myHandedness); + let value = new PP.GamepadAxesInfo(this.myHandedness); value.myAxes = this.myAxes; value.myPrevAxes = this.myPrevAxes; @@ -162,7 +162,7 @@ PP.AxesInfo = class AxesInfo { } }; -PP.PulseInfo = class PulseInfo { +PP.GamepadPulseInfo = class GamepadPulseInfo { constructor() { this.myIntensity = 0.0; this.myDuration = 0.0; @@ -171,7 +171,7 @@ PP.PulseInfo = class PulseInfo { } clone() { - let value = new PulseInfo(); + let value = new PP.GamepadPulseInfo(); value.myIntensity = this.myIntensity; value.myDuration = this.myDuration; value.myIsDevicePulsing = this.myIsDevicePulsing; diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/keyboard_gamepad_core.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/keyboard_gamepad_core.js index ed859c2..7514e40 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/keyboard_gamepad_core.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/keyboard_gamepad_core.js @@ -1,4 +1,3 @@ -// xr-standard mapping is assumed PP.KeyboardGamepadCore = class KeyboardGamepadCore extends PP.GamepadCore { constructor(handedness, handPose) { @@ -46,49 +45,49 @@ PP.KeyboardGamepadCore = class KeyboardGamepadCore extends PP.GamepadCore { if (this.isGamepadCoreActive()) { if (this.getHandedness() == PP.Handedness.LEFT) { switch (buttonType) { - case PP.ButtonType.SELECT: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.C) || PP.myKeyboard.isKeyPressed(PP.KeyType.c); + case PP.GamepadButtonType.SELECT: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.E) || PP.myKeyboard.isKeyPressed(PP.KeyType.e); break; - case PP.ButtonType.SQUEEZE: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.F) || PP.myKeyboard.isKeyPressed(PP.KeyType.f); + case PP.GamepadButtonType.SQUEEZE: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.Q) || PP.myKeyboard.isKeyPressed(PP.KeyType.q); break; - case PP.ButtonType.TOUCHPAD: + case PP.GamepadButtonType.TOUCHPAD: buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.X) || PP.myKeyboard.isKeyPressed(PP.KeyType.x); break; - case PP.ButtonType.THUMBSTICK: + case PP.GamepadButtonType.THUMBSTICK: buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.R) || PP.myKeyboard.isKeyPressed(PP.KeyType.r); break; - case PP.ButtonType.BOTTOM_BUTTON: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.Q) || PP.myKeyboard.isKeyPressed(PP.KeyType.q); + case PP.GamepadButtonType.BOTTOM_BUTTON: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.C) || PP.myKeyboard.isKeyPressed(PP.KeyType.c); break; - case PP.ButtonType.TOP_BUTTON: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.E) || PP.myKeyboard.isKeyPressed(PP.KeyType.e); + case PP.GamepadButtonType.TOP_BUTTON: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.F) || PP.myKeyboard.isKeyPressed(PP.KeyType.f); break; - case PP.ButtonType.THUMB_REST: + case PP.GamepadButtonType.THUMB_REST: buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.V) || PP.myKeyboard.isKeyPressed(PP.KeyType.v); break; } } else { switch (buttonType) { - case PP.ButtonType.SELECT: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.N) || PP.myKeyboard.isKeyPressed(PP.KeyType.n); + case PP.GamepadButtonType.SELECT: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.U) || PP.myKeyboard.isKeyPressed(PP.KeyType.u); break; - case PP.ButtonType.SQUEEZE: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.H) || PP.myKeyboard.isKeyPressed(PP.KeyType.h); + case PP.GamepadButtonType.SQUEEZE: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.O) || PP.myKeyboard.isKeyPressed(PP.KeyType.o); break; - case PP.ButtonType.TOUCHPAD: + case PP.GamepadButtonType.TOUCHPAD: buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.M) || PP.myKeyboard.isKeyPressed(PP.KeyType.m); break; - case PP.ButtonType.THUMBSTICK: + case PP.GamepadButtonType.THUMBSTICK: buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.Y) || PP.myKeyboard.isKeyPressed(PP.KeyType.y); break; - case PP.ButtonType.BOTTOM_BUTTON: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.O) || PP.myKeyboard.isKeyPressed(PP.KeyType.o); + case PP.GamepadButtonType.BOTTOM_BUTTON: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.N) || PP.myKeyboard.isKeyPressed(PP.KeyType.n); break; - case PP.ButtonType.TOP_BUTTON: - buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.U) || PP.myKeyboard.isKeyPressed(PP.KeyType.u); + case PP.GamepadButtonType.TOP_BUTTON: + buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.H) || PP.myKeyboard.isKeyPressed(PP.KeyType.h); break; - case PP.ButtonType.THUMB_REST: + case PP.GamepadButtonType.THUMB_REST: buttonData.myIsPressed = PP.myKeyboard.isKeyPressed(PP.KeyType.B) || PP.myKeyboard.isKeyPressed(PP.KeyType.b); break; } diff --git a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/xr_gamepad_core.js b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/xr_gamepad_core.js index 41ada6e..b90d546 100644 --- a/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/xr_gamepad_core.js +++ b/wle_pp/wle_pp_bundler/js/pp/input/gamepad/gamepad_cores/xr_gamepad_core.js @@ -1,4 +1,5 @@ // xr-standard mapping is assumed + PP.XRGamepadCore = class XRGamepadCore extends PP.GamepadCore { constructor(handedness, handPoseParams = new PP.HandPoseParams()) { @@ -48,7 +49,7 @@ PP.XRGamepadCore = class XRGamepadCore extends PP.GamepadCore { if (buttonType < this._myGamepad.buttons.length) { let gamepadButton = this._myGamepad.buttons[buttonType]; - if (buttonType != PP.ButtonType.SELECT && buttonType != PP.ButtonType.SQUEEZE) { + if (buttonType != PP.GamepadButtonType.SELECT && buttonType != PP.GamepadButtonType.SQUEEZE) { buttonData.myIsPressed = gamepadButton.pressed; } else { buttonData.myIsPressed = this._getSpecialButtonPressed(buttonType); @@ -56,7 +57,7 @@ PP.XRGamepadCore = class XRGamepadCore extends PP.GamepadCore { buttonData.myIsTouched = gamepadButton.touched; buttonData.myValue = gamepadButton.value; - } else if (buttonType == PP.ButtonType.TOP_BUTTON && this._myGamepad.buttons.length >= 3) { + } else if (buttonType == PP.GamepadButtonType.TOP_BUTTON && this._myGamepad.buttons.length >= 3) { //This way if you are using a basic touch gamepad, top button will work anyway let touchButton = this._myGamepad.buttons[2]; buttonData.myIsPressed = touchButton.pressed; @@ -133,9 +134,9 @@ PP.XRGamepadCore = class XRGamepadCore extends PP.GamepadCore { let isPressed = false; if (this.isGamepadCoreActive()) { - if (buttonType == PP.ButtonType.SELECT) { + if (buttonType == PP.GamepadButtonType.SELECT) { isPressed = this._mySelectPressed; - } else if (buttonType == PP.ButtonType.SQUEEZE) { + } else if (buttonType == PP.GamepadButtonType.SQUEEZE) { isPressed = this._mySqueezePressed; } } diff --git a/wle_pp/wle_pp_bundler/js/pp/plugin/extensions/array_extension.js b/wle_pp/wle_pp_bundler/js/pp/plugin/extensions/array_extension.js index 482bb25..7d8a603 100644 --- a/wle_pp/wle_pp_bundler/js/pp/plugin/extensions/array_extension.js +++ b/wle_pp/wle_pp_bundler/js/pp/plugin/extensions/array_extension.js @@ -69,6 +69,7 @@ VECTOR 2: ○ vec2_set + - vec2_normalize - vec2_length - vec2_isZero @@ -489,6 +490,11 @@ Array.prototype.vec2_length = function () { return glMatrix.vec2.length(this); }; +Array.prototype.vec2_normalize = function (out = glMatrix.vec2.create()) { + glMatrix.vec2.normalize(out, this); + return out; +}; + // New Functions Array.prototype.vec2_isZero = function () { diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/console_vr/console_vr_widget.js b/wle_pp/wle_pp_bundler/js/pp/tool/console_vr/console_vr_widget.js index 19907f4..a7d5d1e 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/console_vr/console_vr_widget.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/console_vr/console_vr_widget.js @@ -662,8 +662,8 @@ PP.ConsoleVRWidget = class ConsoleVRWidget { _updateGamepadsExtraActions(dt) { if (this._myLeftGamepad && this._myRightGamepad) { - if ((this._myLeftGamepad.getButtonInfo(PP.ButtonType.THUMBSTICK).isPressStart() && this._myRightGamepad.getButtonInfo(PP.ButtonType.THUMBSTICK).myIsPressed) || - (this._myRightGamepad.getButtonInfo(PP.ButtonType.THUMBSTICK).isPressStart() && this._myLeftGamepad.getButtonInfo(PP.ButtonType.THUMBSTICK).myIsPressed)) { + if ((this._myLeftGamepad.getButtonInfo(PP.GamepadButtonType.THUMBSTICK).isPressStart() && this._myRightGamepad.getButtonInfo(PP.GamepadButtonType.THUMBSTICK).myIsPressed) || + (this._myRightGamepad.getButtonInfo(PP.GamepadButtonType.THUMBSTICK).isPressStart() && this._myLeftGamepad.getButtonInfo(PP.GamepadButtonType.THUMBSTICK).myIsPressed)) { this._toggleVisibility(); } diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_light_color.js b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_light_color.js index 47d8f00..54ddd88 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_light_color.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_light_color.js @@ -76,8 +76,8 @@ PP.EasyLightColor = class EasyLightColor extends PP.EasyObjectTuner { light.color[3] = light.color[3]; } - if ((PP.myRightGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).myIsPressed) || - (PP.myLeftGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).myIsPressed)) { + if ((PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed) || + (PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed)) { let hsvColor = PP.ColorUtils.color1To255(PP.ColorUtils.rgbToHsv(color)); let rgbColor = PP.ColorUtils.color1To255(color); diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_mesh_color.js b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_mesh_color.js index 3ea9b76..a115079 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_mesh_color.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_mesh_color.js @@ -92,8 +92,8 @@ PP.EasyMeshColor = class EasyMeshColor extends PP.EasyObjectTuner { } if (this._myColorType != 6) { - if ((PP.myRightGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).myIsPressed) || - (PP.myLeftGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).myIsPressed)) { + if ((PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed) || + (PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed)) { let hsvColor = PP.ColorUtils.color1To255(PP.ColorUtils.rgbToHsv(color)); let rgbColor = PP.ColorUtils.color1To255(color); diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_text_color.js b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_text_color.js index a7f669d..35702ca 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_text_color.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_object_tuners/easy_text_color.js @@ -78,8 +78,8 @@ PP.EasyTextColor = class EasyTextColor extends PP.EasyObjectTuner { textMaterial[this._myColorVariableNames[this._myColorType]] = color; } - if ((PP.myRightGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).myIsPressed) || - (PP.myLeftGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).myIsPressed)) { + if ((PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed) || + (PP.myLeftGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && PP.myRightGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed)) { let hsvColor = PP.ColorUtils.color1To255(PP.ColorUtils.rgbToHsv(color)); let rgbColor = PP.ColorUtils.color1To255(color); diff --git a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget.js b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget.js index 933d777..9e5da38 100644 --- a/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget.js +++ b/wle_pp/wle_pp_bundler/js/pp/tool/easy_tune/easy_tune_widgets/easy_tune_widget.js @@ -185,8 +185,8 @@ PP.EasyTuneWidget = class EasyTuneWidget { _updateGamepadWidgetVisibility() { if (this._myGamepad) { - if ((this._myGamepad.getButtonInfo(PP.ButtonType.BOTTOM_BUTTON).isPressStart() && this._myGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).myIsPressed) || - (this._myGamepad.getButtonInfo(PP.ButtonType.TOP_BUTTON).isPressStart() && this._myGamepad.getButtonInfo(PP.ButtonType.BOTTOM_BUTTON).myIsPressed)) { + if ((this._myGamepad.getButtonInfo(PP.GamepadButtonType.BOTTOM_BUTTON).isPressStart() && this._myGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).myIsPressed) || + (this._myGamepad.getButtonInfo(PP.GamepadButtonType.TOP_BUTTON).isPressStart() && this._myGamepad.getButtonInfo(PP.GamepadButtonType.BOTTOM_BUTTON).myIsPressed)) { this._toggleVisibility(); } }