Commit cad0d55d authored by Cody Ede (cme527)'s avatar Cody Ede (cme527)
Browse files

All Keys live

parent de1660f0
......@@ -3,45 +3,45 @@ var kd = require('keydrown');
function KeyboardManager() {
this._SPACEKeydown = false;
this._SHIFTKeydown = false;
this._aKeydown = false;
this._bKeydown = false;
this._cKeydown = false;
this._dKeydown = false;
this._eKeydown = false;
this._fKeydown = false;
this._gKeydown = false;
this._hKeydown = false;
this._iKeydown = false;
this._jKeydown = false;
this._Kkeydown = false;
this._lKeydown = false;
this._mKeydown = false;
this._nKeydown = false;
this._oKeydown = false;
this._pKeydown = false;
this._qKeydown = false;
this._rKeydown = false;
this._sKeydown = false;
this._tKeydown = false;
this._uKeydown = false;
this._vKeydown = false;
this._wKeydown = false;
this._xKeydown = false;
this._yKeydown = false;
this._zKeydown = false;
this._1Keydown = false;
this._2Keydown = false;
this._3Keydown = false;
this._4Keydown = false;
this._5Keydown = false;
this._6Keydown = false;
this._7Keydown = false;
this._8Keydown = false;
this._9Keydown = false;
this._0Keydown = false;
_aKeydown = {state: false, value: 'a'};
_bKeydown = {state: false, value: 'b'};
_cKeydown = {state: false, value: 'c'};
_dKeydown = {state: false, value: 'd'};
_eKeydown = {state: false, value: 'e'};
_fKeydown = {state: false, value: 'f'};
_gKeydown = {state: false, value: 'g'};
_hKeydown = {state: false, value: 'h'};
_iKeydown = {state: false, value: 'i'};
_jKeydown = {state: false, value: 'j'};
_kKeydown = {state: false, value: 'k'};
_lKeydown = {state: false, value: 'l'};
_mKeydown = {state: false, value: 'm'};
_nKeydown = {state: false, value: 'n'};
_oKeydown = {state: false, value: 'o'};
_pKeydown = {state: false, value: 'p'};
_qKeydown = {state: false, value: 'q'};
_rKeydown = {state: false, value: 'r'};
_sKeydown = {state: false, value: 's'};
_tKeydown = {state: false, value: 't'};
_uKeydown = {state: false, value: 'u'};
_vKeydown = {state: false, value: 'v'};
_wKeydown = {state: false, value: 'w'};
_xKeydown = {state: false, value: 'x'};
_yKeydown = {state: false, value: 'y'};
_zKeydown = {state: false, value: 'z'};
_1Keydown = {state: false, value: '1'};
_2Keydown = {state: false, value: '2'};
_3Keydown = {state: false, value: '3'};
_4Keydown = {state: false, value: '4'};
_5Keydown = {state: false, value: '5'};
_6Keydown = {state: false, value: '6'};
_7Keydown = {state: false, value: '7'};
_8Keydown = {state: false, value: '8'};
_9Keydown = {state: false, value: '9'};
_0Keydown = {state: false, value: '0'};
this._stateChangeHandlers = [];
this._keysPressed = [];
}
......@@ -55,16 +55,309 @@ KeyboardManager.prototype.tick = function() {
this._SPACEKeydown = false;
this.notifyObservers();
}
if (kd.SHIFT.isDown() && this._SHIFTKeydown == false)
{
this._SHIFTKeydown = true;
console.log('The Shiftkey is live');
if(kd.SHIFT.isDown() && this._SHIFTKeydown == false){
this._SHIFTKeydown = true;
}
if(!kd.SHIFT.isDown() && this._SHIFTKeydown == true){
this._SHIFTKeydown = false;
}
if(kd.A.isDown() && _aKeydown.state == false && this._SHIFTKeydown == true){
_aKeydown.state = true;
console.log('Shift + A');
}
if (!kd.A.isDown() && _aKeydown.state == true ){
_aKeydown.state = false;
}
if(kd.B.isDown() && _bKeydown.state == false && this._SHIFTKeydown == true){
_bKeydown.state = true;
console.log('Shift + B');
}
if (!kd.B.isDown() && _bKeydown.state == true ){
_bKeydown.state = false;
}
if(kd.C.isDown() && _cKeydown.state == false && this._SHIFTKeydown == true){
_cKeydown.state = true;
console.log('Shift + C');
}
if (!kd.C.isDown() && _cKeydown.state == true ){
_aKeydown.state = false;
}
if(kd.D.isDown() && _dKeydown.state == false && this._SHIFTKeydown == true){
_dKeydown.state = true;
console.log('Shift + D');
}
if (!kd.D.isDown() && _dKeydown.state == true ){
_dKeydown.state = false;
}
if(kd.E.isDown() && _eKeydown.state == false && this._SHIFTKeydown == true){
_eKeydown.state = true;
console.log('Shift + E');
}
if (!kd.E.isDown() && _eKeydown.state == true ){
_eKeydown.state = false;
}
if(kd.F.isDown() && _fKeydown.state == false && this._SHIFTKeydown == true){
_fKeydown.state = true;
console.log('Shift + F');
}
if (!kd.F.isDown() && _fKeydown.state == true ){
_fKeydown.state = false;
}
if(kd.G.isDown() && _gKeydown.state == false && this._SHIFTKeydown == true){
_gKeydown.state = true;
console.log('Shift + G');
}
if (!kd.G.isDown() && _gKeydown.state == true ){
_gKeydown.state = false;
}
if(kd.H.isDown() && _hKeydown.state == false && this._SHIFTKeydown == true){
_hKeydown.state = true;
console.log('Shift + H');
}
if (!kd.H.isDown() && _hKeydown.state == true ){
_hKeydown.state = false;
}
if(kd.I.isDown() && _iKeydown.state == false && this._SHIFTKeydown == true){
_iKeydown.state = true;
console.log('Shift + I');
}
if (!kd.I.isDown() && _iKeydown.state == true ){
_iKeydown.state = false;
}
if(kd.J.isDown() && _jKeydown.state == false && this._SHIFTKeydown == true){
_jKeydown.state = true;
console.log('Shift + J');
}
if (!kd.J.isDown() && _jKeydown.state == true ){
_jKeydown.state = false;
}
if(kd.K.isDown() && _kKeydown.state == false && this._SHIFTKeydown == true){
_kKeydown.state = true;
console.log('Shift + K');
}
if (!kd.K.isDown() && _kKeydown.state == true ){
_kKeydown.state = false;
}
if(kd.L.isDown() && _lKeydown.state == false && this._SHIFTKeydown == true){
_lKeydown.state = true;
console.log('Shift + L');
}
if (!kd.L.isDown() && _lKeydown.state == true ){
_lKeydown.state = false;
}
if(kd.M.isDown() && _mKeydown.state == false && this._SHIFTKeydown == true){
_mKeydown.state = true;
console.log('Shift + M');
}
if (!kd.M.isDown() && _mKeydown.state == true ){
_mKeydown.state = false;
}
if(kd.N.isDown() && _nKeydown.state == false && this._SHIFTKeydown == true){
_nKeydown.state = true;
console.log('Shift + N');
}
if (!kd.N.isDown() && _nKeydown.state == true ){
_nKeydown.state = false;
}
if(kd.O.isDown() && _oKeydown.state == false && this._SHIFTKeydown == true){
_oKeydown.state = true;
console.log('Shift + O');
}
if (!kd.O.isDown() && _oKeydown.state == true ){
_oKeydown.state = false;
}
if(kd.P.isDown() && _pKeydown.state == false && this._SHIFTKeydown == true){
_pKeydown.state = true;
console.log('Shift + P');
}
if (!kd.P.isDown() && _pKeydown.state == true ){
_pKeydown.state = false;
}
if(kd.P.isDown() && _pKeydown.state == false && this._SHIFTKeydown == true){
_pKeydown.state = true;
console.log('Shift + P');
}
if (!kd.P.isDown() && _pKeydown.state == true ){
_pKeydown.state = false;
}
if(kd.Q.isDown() && _qKeydown.state == false && this._SHIFTKeydown == true){
_qKeydown.state = true;
console.log('Shift + Q');
}
if (!kd.Q.isDown() && _qKeydown.state == true ){
_qKeydown.state = false;
}
if(kd.R.isDown() && _rKeydown.state == false && this._SHIFTKeydown == true){
_rKeydown.state = true;
console.log('Shift + R');
}
if (!kd.R.isDown() && _rKeydown.state == true ){
_rKeydown.state = false;
}
if(kd.S.isDown() && _sKeydown.state == false && this._SHIFTKeydown == true){
_sKeydown.state = true;
console.log('Shift + S');
}
if (!kd.S.isDown() && _sKeydown.state == true ){
_sKeydown.state = false;
}
if(kd.T.isDown() && _tKeydown.state == false && this._SHIFTKeydown == true){
_tKeydown.state = true;
console.log('Shift + T');
}
if (!kd.T.isDown() && _tKeydown.state == true ){
_tKeydown.state = false;
}
if(kd.U.isDown() && _uKeydown.state == false && this._SHIFTKeydown == true){
_uKeydown.state = true;
console.log('Shift + U');
}
if (!kd.U.isDown() && _uKeydown.state == true ){
_uKeydown.state = false;
}
if(kd.V.isDown() && _vKeydown.state == false && this._SHIFTKeydown == true){
_vKeydown.state = true;
console.log('Shift + V');
}
if (!kd.V.isDown() && _vKeydown.state == true ){
_vKeydown.state = false;
}
if(kd.W.isDown() && _wKeydown.state == false && this._SHIFTKeydown == true){
_wKeydown.state = true;
console.log('Shift + W');
}
if (!kd.W.isDown() && _wKeydown.state == true ){
_wKeydown.state = false;
}
if(kd.X.isDown() && _xKeydown.state == false && this._SHIFTKeydown == true){
_xKeydown.state = true;
console.log('Shift + X');
}
if (!kd.X.isDown() && _xKeydown.state == true ){
_xKeydown.state = false;
}
if(kd.Y.isDown() && _yKeydown.state == false && this._SHIFTKeydown == true){
_yKeydown.state = true;
console.log('Shift + Y');
}
if (!kd.Y.isDown() && _yKeydown.state == true ){
_yKeydown.state = false;
}
if (!kd.SHIFT.isDown() && this._SHIFTKeydown == true)
{
this._SHIFTKeydown = false;
if(kd.Z.isDown() && _zKeydown.state == false && this._SHIFTKeydown == true){
_zKeydown.state = true;
console.log('Shift + Z');
}
if (!kd.Z.isDown() && _zKeydown.state == true ){
_zKeydown.state = false;
}
// if(kd.1.isDown() && _1Keydown.state == false && this._SHIFTKeydown == true){
// _1Keydown.state = true;
// console.log('Shift + 1');
// }
// if (!kd.1.isDown() && _1Keydown.state == true ){
// _1Keydown.state = false;
// }
// if(kd.2.isDown() && _2Keydown.state == false && this._SHIFTKeydown == true){
// _2Keydown.state = true;
// console.log('Shift + 2');
// }
// if (!kd.2.isDown() && _2Keydown.state == true ){
// _aKeydown.state = false;
// }
// if(kd.3.isDown() && _3Keydown.state == false && this._SHIFTKeydown == true){
// _3Keydown.state = true;
// console.log('Shift + 3');
// }
// if (!kd.3.isDown() && _3Keydown.state == true ){
// _3Keydown.state = false;
// }
// if(kd.4.isDown() && _4Keydown.state == false && this._SHIFTKeydown == true){
// _4Keydown.state = true;
// console.log('Shift + 4');
// }
// if (!kd.4.isDown() && _4Keydown.state == true ){
// _4Keydown.state = false;
// }
// if(kd.5.isDown() && _5Keydown.state == false && this._SHIFTKeydown == true){
// _5Keydown.state = true;
// console.log('Shift + 5');
// }
// if (!kd.5.isDown() && _5Keydown.state == true ){
// _5Keydown.state = false;
// }
// if(kd.6.isDown() && _6Keydown.state == false && this._SHIFTKeydown == true){
// _6Keydown.state = true;
// console.log('Shift + 6');
// }
// if (!kd.6.isDown() && _6Keydown.state == true ){
// _6Keydown.state = false;
// }
// if(kd.7.isDown() && _7Keydown.state == false && this._SHIFTKeydown == true){
// _7Keydown.state = true;
// console.log('Shift + 7');
// }
// if (!kd.8.isDown() && _8Keydown.state == true ){
// _8Keydown.state = false;
// }
// if(kd.9.isDown() && _9Keydown.state == false && this._SHIFTKeydown == true){
// _9Keydown.state = true;
// console.log('Shift + 9');
// }
// if (!kd.9.isDown() && _9Keydown.state == true ){
// _9Keydown.state = false;
// }
// if(kd.0.isDown() && _0Keydown.state == false && this._SHIFTKeydown == true){
// _0Keydown.state = true;
// console.log('Shift + 0');
// }
// if (!kd.0.isDown() && _0Keydown.state == true ){
// _0Keydown.state = false;
// }
};
KeyboardManager.prototype.addKeyPress = function(f) {
this._keyPressed.push(f.value);
};
KeyboardManager.prototype.notifyObservers = function() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment