use of com.shatteredpixel.shatteredpixeldungeon.input.PDInputProcessor in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WndKeymap method populateList.
private void populateList() {
listContent.clear();
tempPos = 0;
final PDInputProcessor inputProcessor = (PDInputProcessor) Game.instance.getInputProcessor();
final Map<Integer, PDInputProcessor.GameActionWrapper> keyMappings = inputProcessor.getKeyMappings();
final Map<GameAction, KeyPair> mappings = new TreeMap<>();
for (GameAction action : GameAction.values()) {
if (action.getDescription() != null) {
mappings.put(action, new KeyPair());
}
}
for (Map.Entry<Integer, PDInputProcessor.GameActionWrapper> entry : keyMappings.entrySet()) {
final Integer key = entry.getKey();
final PDInputProcessor.GameActionWrapper value = entry.getValue();
final GameAction action = value.gameAction;
final KeyPair keyPair = mappings.get(action);
/* if (keyPair == null) {
mappings.put(action, keyPair = new KeyPair());
}*/
if (value.defaultKey) {
keyPair.key1 = key;
} else {
keyPair.key2 = key;
}
}
for (Map.Entry<GameAction, KeyPair> entry : mappings.entrySet()) {
addKey(listContent, width, entry);
}
listContent.setSize(0, tempPos);
}
Aggregations