/**
 *  KeyboardController 類別負責追蹤鍵盤的按鍵狀態。
  export namespace KeyboardController { let _states = { } ; function _set ( e , on ) { _states [ e . code . toLowerCase ( ) ] = on ; _states [ e . key . toLowerCase ( ) ] = on ; } export function $isPressed ( key ) { return Boolean ( _states [ key ] ) ; } export function $init ( ) { document . body . addEventListener ( 'keydown' , e => _set ( e , true ) ) ; document . body . addEventListener ( 'keyup' , e => _set ( e , false ) ) ; window . addEventListener ( 'blur' , ( ) => _states = { } ) ; } }