Skip to content

Commit

Permalink
Pushing upload and validator changes
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanc490 committed Apr 4, 2024
1 parent cd00553 commit 2964036
Show file tree
Hide file tree
Showing 46 changed files with 11,500 additions and 553 deletions.
153 changes: 107 additions & 46 deletions Custom/ControllerComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ AFRAME.registerComponent('trackpad-left',{
this.el.addEventListener('trackpadmoved', this.logTrackpad);
},
logTrackpad: function (evt) {
if (evt.detail.y > 0.2) {
trackpadDetail.x = evt.detail.x
trackpadDetail.y = evt.detail.y
if (evt.detail.y > 0.5) {

}
if (evt.detail.y < -0.2) {
if (evt.detail.y < -0.5) {

}
if (evt.detail.x < -0.2) {
Expand All @@ -98,53 +100,78 @@ init: function () {

el.addEventListener('gripdown', function (evt) {
displayNext(true);
buttonsDownR['grip'] = true;
});

el.addEventListener('gripup', function (evt) {
buttonsDownR['grip'] = false;
});
/*el.addEventListener('gripup', function (evt) {
});*/

el.addEventListener('triggerdown', function (evt) {
displayNext(true);
buttonsDownR['trigger'] = true;
if(buttonsDownR['trigger'] && ((buttonsDownR['trackpad'] && trackpadDetailR.y > .5) || (buttonsDownR['thumbstick'] && thumbstickDetailR.y > .5))){
handleAll()
} else if(buttonsDownR['trigger'] && ((buttonsDownR['trackpad'] && trackpadDetailR.y < -.5) || (buttonsDownR['thumbstick'] && thumbstickDetailR.y < -.5))){
stopAll()
} else {
displayNext(false);
}
});

el.addEventListener('triggerup', function (evt) {
buttonsDownR['grip'] = false;
});
/*el.addEventListener('triggerup', function (evt) {
});*/

el.addEventListener('abuttondown', function (evt) {
displayNext(true);
buttonsDownR['abutton'] = true;
});
el.addEventListener('abuttonup', function (evt) {
buttonsDownR['abutton'] = false;
});
/*el.addEventListener('abuttonup', function (evt) {
});*/

el.addEventListener('bbuttondown', function (evt) {
displayNext(true);
buttonsDownR['bbutton'] = true;
});
el.addEventListener('bbuttonup', function (evt) {
buttonsDownR['bbutton'] = false;
});
/*el.addEventListener('bbuttonup', function (evt) {
});*/

/*el.addEventListener('menudown', function (evt) {
menuRightPressed = true;
rightMenu.setAttribute("value", "Right Menu: Yes"); rightMenu.setAttribute("color","green")
});*/

el.addEventListener('thumbstickdown', function (evt) {
displayNext(true);
buttonsDownR['thumbstick'] = true;
if(buttonsDownR['thumbstick'] && ((buttonsDownR['thumbstick'] && trackpadDetailR.y > .5) || (buttonsDownR['thumbstick'] && thumbstickDetailR.y > .5))){
handleAll()
} else if(buttonsDownR['thumbstick'] && ((buttonsDownR['thumbstick'] && trackpadDetailR.y < -.5) || (buttonsDownR['thumbstick'] && thumbstickDetailR.y < -.5))){
stopAll()
} else {
displayNext(false);
}
});
el.addEventListener('thumbstickup', function (evt) {
buttonsDownR['thumbstick'] = false;
});
/*el.addEventListener('thumbstickup', function (evt) {
});*/

el.addEventListener('trackpaddown', function (evt) {
displayNext(true);
buttonsDownR['trackpad'] = true;
if(buttonsDownR['trackpad'] && ((buttonsDownR['trackpad'] && trackpadDetailR.y > .5) || (buttonsDownR['trackpad'] && thumbstickDetailR.y > .5))){
handleAll()
} else if(buttonsDownR['trackpad'] && ((buttonsDownR['trackpad'] && trackpadDetailR.y < -.5) || (buttonsDownR['trackpad'] && thumbstickDetailR.y < -.5))){
stopAll()
} else {
displayNext(false);
}
});
/*

el.addEventListener('trackpadup', function (evt) {
buttonsDownR['trackpad'] = false;
});
el.addEventListener('trackpadtouchstart', function (evt) {
/*el.addEventListener('trackpadtouchstart', function (evt) {
});
Expand All @@ -160,56 +187,82 @@ init: function () {

el.addEventListener('gripdown', function (evt) {
displayNext(false);
buttonsDownL['grip'] = true;
});
/*

el.addEventListener('gripup', function (evt) {
});*/
buttonsDownL['grip'] = false;
});

el.addEventListener('triggerdown', function (evt) {
displayNext(false);
buttonsDownL['trigger'] = true;
if(buttonsDownL['trigger'] && ((buttonsDownL['trackpad'] && trackpadDetailL.y > .5) || (buttonsDownL['thumbstick'] && thumbstickDetailL.y > .5))){
handleAll()
} else if(buttonsDownL['trigger'] && ((buttonsDownL['trackpad'] && trackpadDetailL.y < -.5) || (buttonsDownL['thumbstick'] && thumbstickDetailL.y < -.5))){
stopAll()
} else {
displayNext(false);
}
});
/*

el.addEventListener('triggerup', function (evt) {
});*/
buttonsDownL['grip'] = false;
});

el.addEventListener('xbuttondown', function (evt) {
displayNext(false);
//handleAll()
buttonsDownL['xbutton'] = true;
});

/*el.addEventListener('xbuttonup', function (evt) {
});*/
el.addEventListener('xbuttonup', function (evt) {
buttonsDownL['xbutton'] = false;
});

el.addEventListener('ybuttondown', function (evt) {
displayNext(false);
//stopAll()
buttonsDownL['ybutton'] = true;
});

/*el.addEventListener('ybuttonup', function (evt) {
});*/
el.addEventListener('ybuttonup', function (evt) {
buttonsDownL['ybutton'] = false;
});

/*el.addEventListener('menudown', function (evt) {
menuLeftPressed = true;
leftMenu.setAttribute("value", "Left Menu: Yes"); leftMenu.setAttribute("color","green")
});*/

el.addEventListener('thumbstickdown', function (evt) {
displayNext(false);
buttonsDownL['thumbstick'] = true;
if(buttonsDownL['thumbstick'] && ((buttonsDownL['thumbstick'] && trackpadDetailL.y > .5) || (buttonsDownL['thumbstick'] && thumbstickDetailL.y > .5))){
handleAll()
} else if(buttonsDownL['thumbstick'] && ((buttonsDownL['thumbstick'] && trackpadDetailL.y < -.5) || (buttonsDownL['thumbstick'] && thumbstickDetailL.y < -.5))){
stopAll()
} else {
displayNext(false);
}
});
el.addEventListener('thumbstickup', function (evt) {
buttonsDownL['thumbstick'] = false;
});
/*el.addEventListener('thumbstickup', function (evt) {
});*/

el.addEventListener('trackpaddown', function (evt) {
displayNext(false);
buttonsDownL['trackpad'] = true;
if(buttonsDownL['trackpad'] && ((buttonsDownL['trackpad'] && trackpadDetailL.y > .5) || (buttonsDownL['trackpad'] && thumbstickDetailL.y > .5))){
handleAll()
} else if(buttonsDownL['trackpad'] && ((buttonsDownL['trackpad'] && trackpadDetailL.y < -.5) || (buttonsDownL['trackpad'] && thumbstickDetailL.y < -.5))){
stopAll()
} else {
displayNext(false);
}
});

/*el.addEventListener('trackpadup', function (evt) {
el.addEventListener('trackpadup', function (evt) {
buttonsDownL['trackpad'] = false;
});
/*
el.addEventListener('trackpadtouchstart', function (evt) {
});
Expand All @@ -218,4 +271,12 @@ init: function () {
});*/
}
});
});

thumbstickDetailL = {x: 0, y: 0}
trackpadDetailL = {x: 0, y: 0}
buttonsDownL = {trigger: false, grip: false, trackpad: false, thumbstick: false, abutton: false, bbutton: false}

thumbstickDetailR = {x: 0, y: 0}
trackpadDetailR = {x: 0, y: 0}
buttonsDownR = {trigger: false, grip: false, trackpad: false, thumbstick: false, xbutton: false, ybutton: false}
2 changes: 1 addition & 1 deletion Custom/ControllerInputMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import data from '../Compatibility/controller_profiles.json' assert { type: "json" };
//import data from '../Compatibility/controller_profiles.json' assert { type: "json" };
const windows = data[0]['windows']
const oc_touch = data[0]['oc_touch']
const oc_go = data[0]['oc_go']
Expand Down
Loading

0 comments on commit 2964036

Please sign in to comment.