Java 类com.badlogic.gdx.utils.IntMap.Keys 实例源码

项目:fabulae    文件:Inventory.java   
/**
 * Moves all items from this Inventory's fromBag into the destinationInventory's
 * destinationBag.
 * 
 * @param fromBag
 * @param destinationBag
 * @param destinationInventory
 */
public void moveAllItems(BagType fromBag, BagType destinationBag, Inventory destinationInventory) {
    IntMap<InventoryItem> bag = bags.get(fromBag);
    Keys iterator = bag.keys();
    while (iterator.hasNext) {
        InventoryItem item = removeFromBag(fromBag, iterator.next(), true);
        if (item != null) {
            destinationInventory.addToBag(destinationBag, item);
        }
    }
}
项目:gaiasky    文件:EventManager.java   
/**
 * Unregisters all the subscriptions of the given listeners.
 * 
 * @param listeners
 *            The listeners to remove.
 */
public void removeAllSubscriptions(IObserver... listeners) {
    synchronized (subscriptions) {
        Keys km = subscriptions.keys();
        while (km.hasNext) {
            int key = km.next();
            for (IObserver listener : listeners) {
                subscriptions.get(key).remove(listener);
            }
        }
    }
}
项目:gdx.automation    文件:EventBufferAccessHelper.java   
@SuppressWarnings("unchecked")
private static void copyPressedKeys(Input input) {
    // TODO no actual input type check. Just assuming on app type
    while (input instanceof InputProxy) {
        input = ((InputProxy) input).getProxiedInput();
    }
    if (Gdx.app.getType() == ApplicationType.Android) {
        if (keysPressedAndroid == null || keyPressedFrom != input) {
            keysPressedAndroid = (IntMap<Object>) accessField(
                    getField(input.getClass(), "keys"), input);
            keyPressedFrom = input;
        }
        Keys keysKeys = keysPressedAndroid.keys();
        while (keysKeys.hasNext) {
            pressedKeys.append(keysKeys.next(), Boolean.TRUE);
        }
    } else if (Gdx.app.getType() == ApplicationType.Desktop) {
        if (keysPressedDesktop == null || keyPressedFrom != input) {
            keysPressedDesktop = (ByteBuffer) accessField(
                    getField(getClass("org.lwjgl.input.Keyboard"),
                            "keyDownBuffer"), null);
            keyPressedFrom = input;
        }
        for (int i = 0; i < keysPressedDesktop.capacity(); i++) {
            if (keysPressedDesktop.get(i) != 0) {
                pressedKeys.put(i, Boolean.TRUE);
            }
        }
    } else {
        throw new IllegalStateException("Unsupported application type: "
                + Gdx.app.getType());
    }
}