blob: a3e849d5b6957593bbd1fb1e949b8800e1fcc5d7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.fourisland.fourpuzzle;
import com.fourisland.fourpuzzle.util.Inputable;
import java.util.concurrent.CopyOnWriteArrayList;
/**
*
* @author hatkirby
*/
public class KeyboardInput {
private static CopyOnWriteArrayList<Inputable> inputables = new CopyOnWriteArrayList<Inputable>();
private static KeyInput key = new KeyInput();
public static synchronized void registerInputable(Inputable inputable)
{
inputables.add(inputable);
}
public static synchronized void unregisterInputable(Inputable inputable)
{
inputables.remove(inputable);
}
public static void processInput()
{
Game.getGameState().processInput(key);
for (Inputable inputable : inputables)
{
inputable.processInput(key);
}
}
static synchronized KeyInput getKey()
{
return key;
}
}
|