当前位置: 首页>>代码示例>>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;未经允许,请勿转载。