当前位置: 首页>>代码示例>>Java>>正文


Java IntMap.Entry方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.IntMap.Entry方法的典型用法代码示例。如果您正苦于以下问题:Java IntMap.Entry方法的具体用法?Java IntMap.Entry怎么用?Java IntMap.Entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.IntMap的用法示例。

在下文中一共展示了IntMap.Entry方法的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
    }
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:26,代码来源:GameScreen.java


示例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);
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:20,代码来源:IntMapSerializer.java


示例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();
			}
		}
	}
}
 
开发者ID:Zaneris,项目名称:DigBlock,代码行数:20,代码来源:World.java


示例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;
}
 
开发者ID:CypherCove,项目名称:LWPTools,代码行数:23,代码来源:GaussianBlurShaderProvider.java


示例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();
    }
}
 
开发者ID:0x0ade,项目名称:shadow-engine,代码行数:25,代码来源:DefaultMusicSystem.java


示例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;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:28,代码来源:RenderContextAccumulator.java


示例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;
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:9,代码来源:DesktopInputProcessor.java


示例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);
    }

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:9,代码来源:ParticleData.java


示例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();
	}
	
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:32,代码来源:CharacterToolbar.java


示例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;
}
 
开发者ID:skynet67,项目名称:pixel-dungeon-rebirth,代码行数:9,代码来源:DesktopInputProcessor.java


示例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);
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:40,代码来源:Chunk.java


示例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();
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:11,代码来源:IntMapJsonSerializer.java


示例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;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:14,代码来源:IntMapJsonSerializer.java


示例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;
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:7,代码来源:Entity.java


示例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();

}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:51,代码来源:GameScreen.java


示例16: 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


示例17: tick

import com.badlogic.gdx.utils.IntMap; //导入方法依赖的package包/类
@Override
public void tick(float delta) {
	if (playerln == Byte.MIN_VALUE) {
		for (IntMap.Entry<Layer> entry : layer.level.layers.entries()) {
			int ln = entry.key;
			Layer ll = entry.value;

			if (ll.entities.contains(layer.level.player, true)) {
				playerln = ln;
				break;
			}
		}
	}

	layer.level.fillLayer(playerln + layerid);
	layer = layer.level.layers.get(playerln + layerid);

	TouchPoint tp = Input.touches.get(id);
	if (tp != null && tp.touchmode == TouchMode.Cursor) {
		pos.set(calcPos(tp.pos));
		oldpos = tp.pos;
		
		button = tp.button;
		
		switch (tp.button) {
		case -1: amb(tp, true); break;
		case 0: lmb(tp, true); break;
		case 1: rmb(tp, true); break;
		case 2: mmb(tp, true); break;
		}
		
		render = true;
	} else {
		downtick = 0;
		switch (button) {
		case -1: amb(tp, false); break;
		case 0: lmb(tp, false); break;
		case 1: rmb(tp, false); break;
		case 2: mmb(tp, false); break;
		}
	}
	if (tp == null && id != -1) {
		layer.level.cursors.removeValue(this, true);
	}
	if (oldpos != null && id == -1) {
		pos.set(calcPos(oldpos));
	}
	scroll(0);
}
 
开发者ID:0x0ade,项目名称:shadow-engine,代码行数:50,代码来源:Cursor.java



注:本文中的com.badlogic.gdx.utils.IntMap.Entry方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。