Skip to content

Commit

Permalink
didsr tool restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanc490 committed May 13, 2024
1 parent 1573cc4 commit 67acc9f
Show file tree
Hide file tree
Showing 99 changed files with 18,501 additions and 856 deletions.
267 changes: 153 additions & 114 deletions Custom/ControllerComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,8 @@ init: function () {
this.el.addEventListener('thumbstickmoved', this.logThumbstick);
},
logThumbstick: function (evt) {
if (evt.detail.y > 0.95) {

}
if (evt.detail.y < -0.95) {

}
if (evt.detail.x < -0.95) {

}
if (evt.detail.x > 0.95) {

}
thumbstickDetailL.x = evt.detail.x
thumbstickDetailL.y = evt.detail.y
}
});

Expand All @@ -32,19 +22,8 @@ init: function () {
this.el.addEventListener('thumbstickmoved', this.logThumbstick);
},
logThumbstick: function (evt) {
if (evt.detail.y > 0.95) {

}
if (evt.detail.y < -0.95) {

}
if (evt.detail.x < -0.95) {

}
if (evt.detail.x > 0.95) {


}
thumbstickDetailR.x = evt.detail.x
thumbstickDetailR.y = evt.detail.y

}
});
Expand All @@ -54,18 +33,8 @@ AFRAME.registerComponent('trackpad-left',{
this.el.addEventListener('trackpadmoved', this.logTrackpad);
},
logTrackpad: function (evt) {
if (evt.detail.y > 0.2) {

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

}
if (evt.detail.x < -0.2) {

}
if (evt.detail.x > 0.2) {

}
trackpadDetailL.x = evt.detail.x;
trackpadDetailL.y = evt.detail.y;

}
});
Expand All @@ -76,18 +45,9 @@ AFRAME.registerComponent('trackpad-left',{
this.el.addEventListener('trackpadmoved', this.logTrackpad);
},
logTrackpad: function (evt) {
if (evt.detail.y > 0.2) {

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

}
if (evt.detail.x < -0.2) {

}
if (evt.detail.x > 0.2) {

}
console.log(JSON.stringify(evt.detail));
trackpadDetailR.x = evt.detail.x;
trackpadDetailR.y = evt.detail.y;

}
});
Expand All @@ -97,60 +57,95 @@ init: function () {
var el = this.el;

el.addEventListener('gripdown', function (evt) {
displayNext(true);
buttonsDownR['grip'] = true;
if(thumbstickDetailR.y <= -.75 || trackpadDetailR.y <= -.75){
displayNext(false)
} else if(thumbstickDetailR.y >= .75 || trackpadDetailR.y >= .75){
displayNext(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(thumbstickDetailR.y <= -.75 || trackpadDetailR.y <= -.75){
displayNext(false)
} else if(thumbstickDetailR.y >= .75 || trackpadDetailR.y >= .75){
displayNext(true);
}
});

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

el.addEventListener('abuttondown', function (evt) {
displayNext(true);
buttonsDownR['abutton'] = true;
if(thumbstickDetailR.y <= -.75 || trackpadDetailR.y <= -.75){
displayNext(false)
} else if(thumbstickDetailR.y >= .75 || trackpadDetailR.y >= .75){
displayNext(true);
}
});
el.addEventListener('abuttonup', function (evt) {
buttonsDownR['abutton'] = false;
});
/*el.addEventListener('abuttonup', function (evt) {
});*/

el.addEventListener('bbuttondown', function (evt) {
displayNext(true);
buttonsDownR['bbutton'] = true;
if(thumbstickDetailR.y <= -.75 || trackpadDetailR.y <= -.75){
displayNext(false)
} else if(thumbstickDetailR.y >= .75 || trackpadDetailR.y >= .75){
displayNext(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(trackpadDetailR.y >= .75 || thumbstickDetailR.y >= .75 ){
stopAll()
} else if(trackpadDetailR.x >= .75 || thumbstickDetailR.x >= .75 ){
if(startAllButton.disabled){
pauseAll();
} else {
startAll();
}
}
});
el.addEventListener('thumbstickup', function (evt) {
buttonsDownR['thumbstick'] = false;
});
/*el.addEventListener('thumbstickup', function (evt) {
});*/

el.addEventListener('trackpaddown', function (evt) {
displayNext(true);
});
/*
el.addEventListener('trackpadup', function (evt) {
console.log("Trackpad detail: "+JSON.stringify(trackpadDetailR))
console.log("Thumbstick detail: "+JSON.stringify(thumbstickDetailR))
buttonsDownR['trackpad'] = true;
if(trackpadDetailR.y >= .75 || thumbstickDetailR.y >= .75 ){
stopAll()
} else if(trackpadDetailR.x >= .75 || thumbstickDetailR.x >= .75 ){
if(startAllButton.disabled){
pauseAll();
} else {
startAll();
}
}
});

el.addEventListener('trackpadtouchstart', function (evt) {
el.addEventListener('trackpadup', function (evt) {
buttonsDownR['trackpad'] = false;
});
el.addEventListener('trackpadtouchend', function (evt) {
});*/
}
});

Expand All @@ -159,63 +154,107 @@ init: function () {
var el = this.el;

el.addEventListener('gripdown', function (evt) {
displayNext(false);
buttonsDownL['grip'] = true;
if(thumbstickDetailL.y <= -.75 || trackpadDetailL.y <= -.75){
displayNext(false)
} else if(thumbstickDetailL.y >= .75 || trackpadDetailL.y >= .75){
displayNext(true);
}
});
/*

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

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

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

el.addEventListener('xbuttondown', function (evt) {
displayNext(false);
buttonsDownL['xbutton'] = true;
if(thumbstickDetailL.y <= -.75 || trackpadDetailL.y <= -.75){
displayNext(false)
} else if(thumbstickDetailL.y >= .75 || trackpadDetailL.y >= .75){
displayNext(true);
}
});

/*el.addEventListener('xbuttonup', function (evt) {
});*/
el.addEventListener('xbuttonup', function (evt) {
buttonsDownL['xbutton'] = false;
if(thumbstickDetailL.y <= -.75 || trackpadDetailL.y <= -.75){
displayNext(false)
} else if(thumbstickDetailL.y >= .75 || trackpadDetailL.y >= .75){
displayNext(true);
}
});

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

/*el.addEventListener('ybuttonup', function (evt) {
});*/

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

el.addEventListener('thumbstickdown', function (evt) {
displayNext(false);
buttonsDownL['thumbstick'] = true
if(trackpadDetailL.y >= .75 || thumbstickDetailL.y >= .75){
stopAll()
} else if(trackpadDetailL.x >= .75 || thumbstickDetailL.x >= .75){
if(startAllButton.disabled){
pauseAll();
} else {
startAll();
}
}
});
el.addEventListener('thumbstickup', function (evt) {
buttonsDownL['thumbstick'] = false;
});
/*el.addEventListener('thumbstickup', function (evt) {
});*/

el.addEventListener('trackpaddown', function (evt) {
displayNext(false);
buttonsDownL['trackpad'] = true
if(trackpadDetailL.y >= .75 || thumbstickDetailL.y >= .75){
stopAll()
} else if(trackpadDetailL.x >= .75 || thumbstickDetailL.x >= .75){
if(startAllButton.disabled){
pauseAll();
} else {
startAll();
}
}
});

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

el.addEventListener('trackpadtouchstart', function (evt) {
}
});

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

el.addEventListener('trackpadtouchend', function (evt) {
thumbstickDetailR = {x: 0, y: 0}
trackpadDetailR = {x: 0, y: 0}
buttonsDownR = {trigger: false, grip: false, trackpad: false, thumbstick: false, xbutton: false, ybutton: false}

});*/
}
});


// trigger/grip controls pattern selection
// trigger while holding up- go to previous pattern
// trigger while holding down- go to next pattern

// thumbstick/trackpad controls animations
// thumbstick while holding right- start/pause
// thumbstick while holding down- stop animation
Loading

0 comments on commit 67acc9f

Please sign in to comment.