本文整理汇总了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;
}
示例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;
}
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
}
}