當前位置: 首頁>>代碼示例>>Java>>正文


Java IntMap.get方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.utils.IntMap.get方法的典型用法代碼示例。如果您正苦於以下問題:Java IntMap.get方法的具體用法?Java IntMap.get怎麽用?Java IntMap.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.utils.IntMap的用法示例。


在下文中一共展示了IntMap.get方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: removeFromBag

import com.badlogic.gdx.utils.IntMap; //導入方法依賴的package包/類
/**
 * Removes the item in the supplied slot from the bag and returns it. If the
 * slot was empty, null is returned.
 * 
 * If the item was stackable and removeWholeStack is false, its stack is
 * decreased and the item removed from the stack is returned.
 * 
 * @param bagType
 * @param slot
 * @param removeWholeStack
 *            - if true, the whole stack is removed at once
 * @return
 */
public InventoryItem removeFromBag(BagType bagType, Integer slot,
		boolean removeWholeStack) {
	IntMap<InventoryItem> bag = bags.get(bagType);
	InventoryItem existingItem = bag.get(slot);
	if (existingItem == null) {
		return null;
	}
	if (existingItem.isInfinite() || (!removeWholeStack && existingItem.getStackSize() > 1)) {
		existingItem = existingItem.removeFromStack();
	} else {
		bag.remove(slot);
	}
	existingItem.setInventory(null);
	onItemRemove(existingItem, bagType);
	return existingItem;
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:30,代碼來源:Inventory.java

示例2: setUp

import com.badlogic.gdx.utils.IntMap; //導入方法依賴的package包/類
@Override
public void setUp() {
    if (!allLoaded) {
        int npairs = ids.size;
        if (lines == null) {
            lines = new IPosition[npairs][];
        }
        IntMap<IPosition> hipMap = sg.getStarMap();
        allLoaded = true;
        for (int i = 0; i < npairs; i++) {
            int[] pair = ids.get(i);
            IPosition s1, s2;
            s1 = hipMap.get(pair[0]);
            s2 = hipMap.get(pair[1]);
            if (lines[i] == null && s1 != null && s2 != null) {
                lines[i] = new IPosition[] { s1, s2 };
            } else {
                allLoaded = false;
            }
        }
    }
}
 
開發者ID:langurmonkey,項目名稱:gaiasky,代碼行數:23,代碼來源:Constellation.java

示例3: hasPendingChanges

import com.badlogic.gdx.utils.IntMap; //導入方法依賴的package包/類
public boolean hasPendingChanges () {
	State pending = this.pending;
	State current = this.current;

	if (pending.depthMasking != current.depthMasking) return true;

	if (pending.depthTesting != current.depthTesting) return true;

	if (pending.depthTesting && pending.depthFunc != current.depthFunc) return true;

	if (pending.blending != current.blending) return true;

	if (pending.blending) {
		if (pending.blendSrcFuncColor != current.blendSrcFuncColor || pending.blendDstFuncColor != current.blendDstFuncColor
			|| pending.blendSrcFuncAlpha != current.blendSrcFuncAlpha || pending.blendDstFuncAlpha != current.blendDstFuncAlpha)
			return true;
		if (pending.blendEquationColor != current.blendEquationColor || pending.blendEquationAlpha != current.blendEquationAlpha)
			return true;
	}

	IntMap<GLTexture> actualTextureUnits = current.textureUnits;
	for (IntMap.Entry<GLTexture> entry : pending.textureUnits) {
		if (actualTextureUnits.get(entry.key) != entry.value) return true;
	}

	return false;
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:28,代碼來源:RenderContextAccumulator.java

示例4: getTargetPlayerForKey

import com.badlogic.gdx.utils.IntMap; //導入方法依賴的package包/類
private Player getTargetPlayerForKey(int key, InputPeripheralType peripheralType){
    IntMap<Player> mappedKeys = this.mappedKeysForPlayer.get(peripheralType);
    if(mappedKeys == null)
        return null;
    else
        return mappedKeys.get(key);
}
 
開發者ID:unlimitedggames,項目名稱:gdxjam-ugg,代碼行數:8,代碼來源:InputController.java

示例5: getCommandClass

import com.badlogic.gdx.utils.IntMap; //導入方法依賴的package包/類
public <T extends Command> Class<T> getCommandClass(InputPeripheralType peripheralType, int key){
	IntMap<Class> mappedByPeripheral = mappedCommands.get(peripheralType);
	if(mappedByPeripheral != null){
		Class<T> command = mappedByPeripheral.get(key);
		if(command != null) {
			return command;
		}else{
			Logger.getInstance().error("No command found for key [" + key + "] and peripheral [" + peripheralType + "]");
		}
	}else{
		Logger.getInstance().log("No commands found for peripheral [" + peripheralType + "]");
	}
	return null;
}
 
開發者ID:unlimitedggames,項目名稱:gdxjam-ugg,代碼行數:15,代碼來源:Player.java

示例6: addToBag

import com.badlogic.gdx.utils.IntMap; //導入方法依賴的package包/類
/**
 * Adds the supplied InventoryItem to the supplied slot in the bag. If the
 * slot is already occupied, and the item there is not stackable, the item
 * there will be replaced by the new one and returned by this method.
 * 
 * Otherwise the new item is just added to the stack and null is returned.
 * 
 * If the supplied item already belonged to a different inventory, it will
 * be removed from there.
 * 
 * @param bagType
 * @param item
 * @param slot
 *            - if it is null, the first empty slot is used
 * @return
 */
public InventoryItem addToBag(BagType bagType, InventoryItem item,
		Integer slot) {
	IntMap<InventoryItem> bag = bags.get(bagType);
	InventoryItem existingItem = null;

	// remove from previous owner if we had one
	removeFromPreviousInventry(item);
	
	if (slot == null) {
		slot = findAcceptableSlot(bag, item);
	}

	if (bag.containsKey(slot)) {
		existingItem = bag.get(slot);
	}
	if (existingItem != null && existingItem.isStackable(item)) {
		existingItem.addToStack(item);
		existingItem = null;
	} else {
		item.setSlot(slot);
		item.setInventory(this);
		item.setInventoryBag(bagType);
		bag.put(slot, item);
		if (existingItem != null) {
			existingItem.setInventory(null);
			onItemRemove(existingItem, bagType);
		}
	}
	onItemAdd(item, bagType);
	return existingItem;
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:48,代碼來源:Inventory.java

示例7: getModifiersForArmorClass

import com.badlogic.gdx.utils.IntMap; //導入方法依賴的package包/類
/**
 * Returns the modifiers that should be used for the given armor class
 * if the wearer of that armor has the supplied skill level in Armor.
 * 
 * @param ac
 * @param skillLevel
 * @return
 */
public static Iterator<Modifier> getModifiersForArmorClass(ArmorClass ac, int skillLevel) {
	IntMap<ModifierContainer> modifiers = configuration.armorClassModifiers.get(ac);
	if (modifiers == null) {
		return EMPTY_MODIFIERS.getModifiers();
	}
	
	ModifierContainer returnValue = modifiers.get(skillLevel);
	return (returnValue != null ? returnValue : EMPTY_MODIFIERS).getModifiers();
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:18,代碼來源:Configuration.java

示例8: executeChanges

import com.badlogic.gdx.utils.IntMap; //導入方法依賴的package包/類
/** Applies the pending state changes and texture bindings to GL. This must be called in between {@link #begin()} and
 * {@link #end()}. */
public void executeChanges () {
	State pending = this.pending;
	State current = this.current;

	if (pending.depthMasking != current.depthMasking) {
		Gdx.gl.glDepthMask(pending.depthMasking);
		current.depthMasking = pending.depthMasking;
	}

	if (pending.depthTesting != current.depthTesting) {
		if (pending.depthTesting)
			Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
		else
			Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
		current.depthTesting = pending.depthTesting;
	}

	if (pending.depthTesting) {
		if (pending.depthFunc != current.depthFunc) {
			Gdx.gl.glDepthFunc(pending.depthFunc);
			current.depthFunc = pending.depthFunc;
		}

		if (pending.depthRangeNear != current.depthRangeNear || pending.depthRangeFar != current.depthRangeFar) {
			Gdx.gl.glDepthRangef(pending.depthRangeNear, pending.depthRangeFar);
			current.depthRangeNear = pending.depthRangeNear;
			current.depthRangeFar = pending.depthRangeFar;
		}
	}

	if (pending.blending != current.blending) {
		if (pending.blending)
			Gdx.gl.glEnable(GL20.GL_BLEND);
		else
			Gdx.gl.glDisable(GL20.GL_BLEND);
		current.blending = pending.blending;
	}

	if (pending.blending) {
		if (pending.blendSrcFuncColor != current.blendSrcFuncColor || pending.blendDstFuncColor != current.blendDstFuncColor
			|| pending.blendSrcFuncAlpha != current.blendSrcFuncAlpha || pending.blendDstFuncAlpha != current.blendDstFuncAlpha) {
			if (pending.blendSrcFuncColor == pending.blendSrcFuncAlpha
				&& pending.blendDstFuncColor == pending.blendDstFuncAlpha) {
				Gdx.gl.glBlendFunc(pending.blendSrcFuncColor, pending.blendDstFuncColor);
			} else {
				Gdx.gl.glBlendFuncSeparate(pending.blendSrcFuncColor, pending.blendDstFuncColor, pending.blendSrcFuncAlpha,
					pending.blendDstFuncAlpha);
			}
			current.blendSrcFuncColor = pending.blendSrcFuncColor;
			current.blendDstFuncColor = pending.blendDstFuncColor;
			current.blendSrcFuncAlpha = pending.blendSrcFuncAlpha;
			current.blendDstFuncAlpha = pending.blendDstFuncAlpha;
		}

		if (pending.blendEquationColor != current.blendEquationColor
			|| pending.blendEquationAlpha != current.blendEquationAlpha) {
			if (pending.blendEquationColor == pending.blendEquationAlpha)
				Gdx.gl.glBlendEquation(pending.blendEquationColor);
			else
				Gdx.gl.glBlendEquationSeparate(pending.blendEquationColor, pending.blendEquationAlpha);
		}
	}

	IntMap<GLTexture> currentTextureUnits = current.textureUnits;
	for (IntMap.Entry<GLTexture> entry : pending.textureUnits) {
		if (currentTextureUnits.get(entry.key) != entry.value) {
			entry.value.bind(entry.key);
			currentTextureUnits.put(entry.key, entry.value);
		}
	}

}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:75,代碼來源:RenderContextAccumulator.java


注:本文中的com.badlogic.gdx.utils.IntMap.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。