本文整理汇总了Java中com.badlogic.gdx.utils.IntMap.Entry方法的典型用法代码示例。如果您正苦于以下问题:Java IntMap.Entry方法的具体用法?Java IntMap.Entry怎么用?Java IntMap.Entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.IntMap
的用法示例。
在下文中一共展示了IntMap.Entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
@Override
protected void update(float delta) {
if (!paused && !isLoading) {
/*for (IntMap.Entry<Entity> entry : entities.entries()) {
entry.value.tick(delta);
if (entry.value.isDead) {
entry.value.destroy();
}
}*/
Iterator<IntMap.Entry<Entity>> iterator = entities.entries().iterator();
while (iterator.hasNext()) {
IntMap.Entry<Entity> entry = iterator.next();
entry.value.tick(delta);
if (entry.value.isDead) {
iterator.remove();
}
}
enemies.tick(delta, this);
collisionWorld.performDiscreteCollisionDetection();
camHandler.update(delta);
}
}
示例2: write
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
public void write (Kryo kryo, Output output, IntMap map) {
int length = map.size;
output.writeVarInt(length, true);
output.writeBoolean(false); // whether type is written (in case future version of IntMap supports type awareness)
Serializer valueSerializer = null;
if (valueGenericType != null) {
if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
valueGenericType = null;
}
for (Iterator iter = map.iterator(); iter.hasNext();) {
IntMap.Entry entry = (IntMap.Entry)iter.next();
output.writeInt(entry.key);
if (valueSerializer != null) {
kryo.writeObjectOrNull(output, entry.value, valueSerializer);
} else
kryo.writeClassAndObject(output, entry.value);
}
}
示例3: processTouch
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
@Override
public void processTouch(IntMap<Int2> touch) {
int deltaX, deltaY;
for(IntMap.Entry entry:touch.entries()) {
Int2 value = (Int2)entry.value;
Int2 xy = InputHandler.getXY(entry.key);
deltaX = value.x-xy.x;
deltaY = value.y-xy.y;
if(value.x < InputHandler.vWidth/2) {
player.axisInput(-deltaX/100f,deltaY/100f);
} else {
if(player.setRot(deltaX,deltaY)) {
value.x = xy.x;
value.y = xy.y;
player.jumpCount();
}
}
}
}
示例4: disposeShader
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
boolean disposeShader(ShaderProgram shaderProgram){
if (shaderProgram == null)
return false;
for (IntMap.Entry<UniqueShader> entry : blurPassShaderPrograms.entries()){
UniqueShader uniqueShader = entry.value;
if (uniqueShader.shaderProgram == shaderProgram){
uniqueShader.refCount--;
if (uniqueShader.refCount < 1){
shaderProgram.dispose();
blurPassShaderPrograms.remove(entry.key);
return true;
} else {
return false;
}
}
}
//not found!
shaderProgram.dispose();
return true;
}
示例5: DefaultMusicSystem
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
public DefaultMusicSystem(Level level) {
this.level = level;
for (IntMap.Entry<Music> entry : Musics.playing) {
if (entry.key < 1 || entry.key > 3) {
Musics.set(entry.key, null);
}
}
musics = new Music[] {
Musics.set(1, "main_1"),
Musics.set(2, "main_2"),
Musics.set(-2, "main_night_2"),
Musics.set(3, "main_3")
};
musics[0].setVolume(1f);
for (int i = 1; i < musics.length; i++) {
musics[i].setVolume(0f);
}
for (int i = 1; i < musics.length; i++) {
musics[i].setPosition(musics[i-1].getPosition());
}
for (int i = 0; i < musics.length; i++) {
musics[i].play();
}
}
示例6: 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;
}
示例7: touchDragged
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
for (IntMap.Entry<Touch> entry : pointers) {
entry.value.update(screenX, screenY);
}
eventTouch.dispatch(null);
return true;
}
示例8: assignComponents
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
@Override
public void assignComponents(GameEntity gameEntity) {
ParticleTypesComponent particleC = gameEntity.addComponent(ParticleTypesComponent.class);
for(IntMap.Entry<ParticleType> entry : particleTypes){
particleC.particleTypes.put(entry.key, entry.value);
}
}
示例9: rebuildQuickUseButtons
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
private void rebuildQuickUseButtons() {
GameCharacter leader = group.getGroupLeader(true);
if (leader != null) {
quickUseListener.setUser(leader);
Inventory inventory = leader.getInventory();
IntMap<InventoryItem> quickUseItems = inventory.getBag(BagType.QUICKUSE);
if (lastQuickUseItems.equals(quickUseItems)) {
return;
}
lastQuickUseItems.clear();
lastQuickUseItems.putAll(quickUseItems);
quickUseButtons.clearChildren();
for (IntMap.Entry<InventoryItem> item : quickUseItems) {
QuickUseButton button = new QuickUseButton(
style.quickSlotStyle, item.key, inventory,
BagType.QUICKUSE);
button.addListener(quickUseListener);
quickUseButtons.add(button).fill().width(style.quickSlotWidth).height(style.quickSlotHeight).pad(style.toolGap/2);
if (style.inRows) {
quickUseButtons.row();
}
}
} else {
quickUseButtons.clearChildren();
}
}
示例10: touchDragged
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
for (IntMap.Entry<NoosaInputProcessor.Touch> entry : pointers) {
entry.value.update(screenX, screenY);
}
eventTouch.dispatch(null);
return true;
}
示例11: getVertices
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
private void getVertices() {
IntMap<TextureFace> faces = new IntMap<TextureFace>();
IntMap<TextureFace> transpFaces = new IntMap<TextureFace>();
int i = 0;
for (int x = 0; x < SIZE; x++) {
for (int y = 0; y < SIZE; y++) {
for (int z = 0; z < SIZE; z++, i++) {
byte voxel = voxels[i];
if (voxel == 0) continue;
Voxel v = Voxel.getForId(voxel);
if (island.isSurrounded(x + pos.x, y + pos.y, z + pos.z, v.isOpaque())) continue;
for (Direction d : Direction.values()) {
byte w = island.get(x + d.dir.x + pos.x, y + d.dir.y + pos.y, z + d.dir.z + pos.z);
Voxel ww = Voxel.getForId(w);
if (w == 0 || (ww == null || !ww.isOpaque()) && w != voxel) {
TextureFace face = new TextureFace(d, new Vector3(x + pos.x, y + pos.y, z + pos.z), Voxel.getForId(voxel).getTextureUV(x, y, z, d));
if (v.isOpaque()) faces.put(face.hashCode(), face);
else transpFaces.put(face.hashCode(), face);
}
}
}
}
}
Mesher.generateGreedyMesh((int) pos.x, (int) pos.y, (int) pos.z, faces);
Mesher.generateGreedyMesh((int) pos.x, (int) pos.y, (int) pos.z, transpFaces);
for (IntMap.Entry<TextureFace> f : faces)
f.value.getVertexData(opaqueMeshData);
IntArray transpKeys = transpFaces.keys().toArray();
transpKeys.sort();
for (int index : transpKeys.toArray())
transpFaces.get(index).getVertexData(transpMeshData);
}
示例12: write
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
@Override
public void write (Json json, IntMap object, Class knownType) {
json.writeObjectStart();
for (IntMap.Entry entry : (IntMap.Entries<?>) object.entries()) {
json.writeValue(String.valueOf(entry.key), entry.value, null);
}
json.writeObjectEnd();
}
示例13: serialize
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
@Override
public JsonElement serialize (IntMap<T> intMap, Type typeOfSrc, JsonSerializationContext context) {
JsonArray jsonArray = new JsonArray();
for (IntMap.Entry<T> entry : intMap.entries()) {
JsonObject jsonObject = new JsonObject();
jsonObject.add(String.valueOf(entry.key), context.serialize(entry.value, entry.value.getClass()));
GsonUtils.appendClassProperty(jsonObject, entry.value, context);
jsonArray.add(jsonObject);
}
return jsonArray;
}
示例14: getEntry
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
protected IntMap.Entry<Entity> getEntry() {
for(IntMap.Entry<Entity> entry: entities.entries())
if(entry.equals(this))
return entry;
return null;
}
示例15: renderForCamera
import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
@Override
public void renderForCamera(Camera renderCamera) {
spriteBatch.setProjectionMatrix(renderCamera.combined);
if (isLoading) {
if (assets.update() && (externalAssets == null || externalAssets.update()))
doneLoading();
else {
float progress;
if (externalAssets == null)
progress = assets.getProgress();
else
progress = 0.5f * assets.getProgress() + 0.5f * externalAssets.getProgress();
spriteBatch.begin();
spriteBatch.draw(background, 0, 0, viewport.getWorldWidth(), viewport.getWorldHeight());
spriteBatch.draw(loading, viewport.getWorldWidth() / 2 - 200, viewport.getWorldHeight() / 4 - 50, 400, 100, 0, 0.5f, 1, 1);
spriteBatch.draw(loading, viewport.getWorldWidth() / 2 - 200 + 400f * progress, viewport.getWorldHeight() / 4 - 50, 400 - progress * 400f, 100, progress, 0, 1, 0.5f);
Color color = new Color(game.getFonts().get("moonhouse64").getColor());
game.getFonts().get("moonhouse64").setColor(Color.BLACK);
game.getFonts().get("moonhouse64").draw(spriteBatch, "Loading...", viewport.getWorldWidth() / 2 - 170, viewport.getWorldHeight() / 4 + 30);
game.getFonts().get("moonhouse64").setColor(color);
spriteBatch.end();
return;
}
}
modelBatch.begin(renderCamera);
shapeRenderer.setProjectionMatrix(renderCamera.combined);
for (IntMap.Entry<Entity> entry : entities.entries())
entry.value.render(Gdx.graphics.getDeltaTime(), modelBatch, shapeRenderer, environment);
modelBatch.render(planet, environment);
modelBatch.end();
if (game.preferences.isDebug()) {
debugDrawer.begin(renderCamera);
collisionWorld.debugDrawWorld();
debugDrawer.end();
}
matrix4.set(renderCamera.combined);
matrix4.setToOrtho2D(0, 0, viewport.getWorldWidth(), viewport.getWorldHeight());
spriteBatch.setProjectionMatrix(matrix4); spriteBatch.begin();
//TDWorld.getFonts().get("moonhouse32").draw(spriteBatch, "Size:" + entities.size(), 0, 20);
//TDWorld.getFonts().get("moonhouse64").draw(spriteBatch, "Num:" + collisionWorld.getNumCollisionObjects(), 0, 40);
game.getFonts().get("moonhouse64").draw(spriteBatch, "$" + money.$, 0, viewport.getWorldHeight() - 30);
game.getFonts().get("moonhouse64").draw(spriteBatch, Gdx.graphics.getFramesPerSecond() + " FPS", 0, viewport.getWorldHeight() - 80);
game.getFonts().get("moonhouse64").draw(spriteBatch, entities.size + " Entities", 0, viewport.getWorldHeight() - 130);
spriteBatch.end();
}