home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / midnightstrike1.swf / scripts / __Packages / com / neodelight / std / Inputs.as < prev    next >
Encoding:
Text File  |  2007-04-02  |  1001 b   |  39 lines

  1. class com.neodelight.std.Inputs
  2. {
  3.    static var inputs = new Object();
  4.    static var locked = false;
  5.    function Inputs()
  6.    {
  7.    }
  8.    static function defineInput(id, key)
  9.    {
  10.       if(!com.neodelight.std.Inputs.inputs[id])
  11.       {
  12.          com.neodelight.std.Inputs.inputs[id] = {pressed:false,keys:new Array()};
  13.       }
  14.       com.neodelight.std.Inputs.inputs[id].keys.push(key);
  15.    }
  16.    static function update()
  17.    {
  18.       var _loc3_ = com.neodelight.std.Inputs.inputs;
  19.       for(var _loc4_ in _loc3_)
  20.       {
  21.          var _loc1_ = _loc3_[_loc4_];
  22.          _loc1_.pressed = false;
  23.          var _loc2_ = _loc1_.keys.length;
  24.          while(_loc2_--)
  25.          {
  26.             if(Key.isDown(_loc1_.keys[_loc2_]))
  27.             {
  28.                _loc1_.pressed = true;
  29.                break;
  30.             }
  31.          }
  32.       }
  33.    }
  34.    static function isPressed(id)
  35.    {
  36.       return !com.neodelight.std.Inputs.locked && com.neodelight.std.Inputs.inputs[id].pressed;
  37.    }
  38. }
  39.