Class InputProvider
Class InputProvider
The central provider that maps real device input into abstract commands defined by the developer. Registering a control against an command with this class will cause the provider to produce an event for the command when the input is pressed and released.
입력을 받을 때 커맨드를 등록시켜서 상수화 하는 클래스 인 것 같다.
void blindCommand(Control control, Command command): control을 command로 묶는다.
여기서 Control은KeyControl클래스의 생성자 KeyControl(int keycode)로 만들 수 있다. 예를들어
provider.bindCommand(new KeyControl(Input.KEY_DOWN), Down); 이렇게 맨 앞 provider은 InputProvider의 참조변수이고 new KeyControl(Input.KEY_DOWN) 은 Control타입의 값 하나를 나타내는데 Input.KEY_DOWN은 Input클래스에서 키보드 키값 상수를 리터럴상수화 시킨 것이다. 결국 이 예시는 KEY_DOWN값을 Down명령으로 묶어놓은 것이다. 이해가 잘 안되서 설명도 잘 못한다.
void addListener(InputProviderListener listener): 해당 인스턴스를 이 클래스의 listener로써 추가한다. 그러면 해당 인스턴스는 이 클래스 명령체계로부터 입력받은 것을 수신할 수 있다.