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


Java IntMap类代码示例

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


IntMap类属于com.badlogic.gdx.utils包,在下文中一共展示了IntMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Basic

import com.badlogic.gdx.utils.IntMap; //导入依赖的package包/类
public Basic(Matrix4 transform, double speeed, int hp, int health, int range, float coolDown, EnumSet<Types> types, EnumSet<Effects> effects, ModelInstance instance, btCollisionWorld world, IntMap<Entity> entities, List<Vector3> path, Map<String, Sound> sounds) {
    super(transform, speeed, hp, health, range, coolDown, types, effects, instance, new btCompoundShape(), world, entities, ATTACK_ANIMATION, ATTACK_OFFSET, path, sounds);
    ((btCompoundShape)shape).addChildShape(new Matrix4(new Vector3(0, 30, 0), new Quaternion().setEulerAngles(0, 0, 0), new Vector3(1, 1, 1)), new btBoxShape(new Vector3(75, 30, 90)));
    //System.out.println(getModelInstance().getAnimation("Spider_Armature|walk_ani_vor").id);
    listener = new AnimationController.AnimationListener() {
        @Override
        public void onEnd(AnimationController.AnimationDesc animationDesc) {

        }

        @Override
        public void onLoop(AnimationController.AnimationDesc animationDesc) {

        }
    };
    //animation.setAnimation("Spider_Armature|walk_ani_vor");
    //animation.animate("Spider_Armature|walk_ani_vor", -1);
    //animation.action("Spider_Armature|walk_ani_vor", 0, 1000, -1, 1, listener, 0);
    //animation.animate("Spider_Armature|Attack", 0, 1000, 1, 1, listener, 0);
    //animation.queue("Spider_Armature|walk_ani_vor", 0, 1000, -1, 1, listener, 0);
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:22,代码来源:Basic.java

示例2: tick

import com.badlogic.gdx.utils.IntMap; //导入依赖的package包/类
public void tick(float delta, GameScreen screen) {
    if (!started && screen.isPaused()) {
        started = true;
        prevTime = System.currentTimeMillis();
    }
    if (spawns != null && enemyIndex < spawns.size() && System.currentTimeMillis() > prevTime + spawns.get(enemyIndex).getDelay()) {
        prevTime = System.currentTimeMillis();
        String name = spawns.get(enemyIndex).getName();
        ModelInstance instance;
        try {
            Class<?> c = enemyClasses.get(name);
            Constructor constructor = c.getConstructor(Matrix4.class, Map.class, btCollisionWorld.class, IntMap.class, List.class, Map.class);
            enemies.add((Enemy) constructor.newInstance(new Matrix4().setToTranslation(pos), models, world, entity, path, sounds));
        } catch (Exception e) {
            Gdx.app.log("EnemySpawner spawn enemy", e.toString());
        }
        enemyIndex++;
    }
    //for (Enemy enemy : enemies)
    //   enemy.tick(delta, path);
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:22,代码来源:EnemySpawner.java

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

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

示例5: SystemInputHandler

import com.badlogic.gdx.utils.IntMap; //导入依赖的package包/类
public SystemInputHandler(InputProxy inputProxy, InputMultiplexer inputMultiplexer, Array<NhgInput> systemInputArray) {
    this.inputProxy = inputProxy;

    vec0 = new Vector2();

    keyboardButtonInputs = new IntMap<>();
    mouseButtonInputs = new IntMap<>();
    touchInputs = new IntMap<>();

    activeKeyboardButtonInputs = new Array<>();
    activeMouseButtonInputs = new Array<>();
    activeTouchInputs = new Array<>();

    mapSystemInput(systemInputArray);
    handleSystemInput(inputMultiplexer);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:17,代码来源:SystemInputHandler.java

示例6: copyAllItemsTo

import com.badlogic.gdx.utils.IntMap; //导入依赖的package包/类
/**
 * Copies all items from this inventory into the destination inventory
 */
public void copyAllItemsTo(Inventory destinationInventory) {
	for (BagType bag : BagType.values()) {
		IntMap<InventoryItem> sourceBag = getBag(bag);
		for (Entry<InventoryItem> slot : sourceBag.entries()) {
			InventoryItem item = slot.value;
			if (item != null) {
				InventoryItem newCopy = item.createNewInstance();
				if (item.getStackSize() > 1) {
					for (int i = 1; i < item.getStackSize(); ++i) {
						newCopy.addToStack(newCopy.createNewInstance());
					}
				}
				destinationInventory.addToBag(bag, newCopy, slot.key);
			}
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:21,代码来源:Inventory.java

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

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

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

示例10: gatherControllers

import com.badlogic.gdx.utils.IntMap; //导入依赖的package包/类
private void gatherControllers(boolean sendEvent) {
	// gather all joysticks and gamepads, remove any disconnected ones
	IntMap<AndroidController> removedControllers = new IntMap<AndroidController>();
	removedControllers.putAll(controllerMap);
	
	for(int deviceId: InputDevice.getDeviceIds()) {
		InputDevice device = InputDevice.getDevice(deviceId);
		AndroidController controller = controllerMap.get(deviceId);
		if(controller != null) {
			removedControllers.remove(deviceId);
		} else {
			addController(deviceId, sendEvent);
		}
	}
	
	for(Entry<AndroidController> entry: removedControllers.entries()) {
		removeController(entry.key);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:20,代码来源:AndroidControllers.java

示例11: getNeighbors

import com.badlogic.gdx.utils.IntMap; //导入依赖的package包/类
private Iterable<Entity> getNeighbors(Entity empire) {
  IntMap<Entity> neighbors = new IntMap<>();

  // collect entities we have relations with
  for (Entity e : relations.get(empire).relations.keySet())
    neighbors.put(e.getId(), e);

  // collect entities we share influence with
  for (MapPosition p : influences.get(empire).influencedTiles)
    for (Entry inf : map.getInfluenceAt(p))
      if (inf.key != empire.getId() && !neighbors.containsKey(inf.key)
      // may be pending insertion into world if just revolted
          && world.getEntityManager().isActive(inf.key))
        neighbors.put(inf.key, world.getEntity(inf.key));

  return neighbors.values();
}
 
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:18,代码来源:DiscoverySystem.java

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

示例13: deserialize

import com.badlogic.gdx.utils.IntMap; //导入依赖的package包/类
@Override
public IntMap<T> deserialize (JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
	JsonArray jsonArray = json.getAsJsonArray();

	IntMap<T> intMap = new IntMap<>(jsonArray.size());

	for (JsonElement element : jsonArray) {
		JsonObject object = element.getAsJsonObject();
		Entry<String, JsonElement> entry = object.entrySet().iterator().next();
		int mapKey = Integer.parseInt(entry.getKey());
		Class<?> mapObjectClass = GsonUtils.readClassProperty(object, context);
		intMap.put(mapKey, context.deserialize(entry.getValue(), mapObjectClass));
	}

	return intMap;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:17,代码来源:IntMapJsonSerializer.java

示例14: filterCollisionSensors

import com.badlogic.gdx.utils.IntMap; //导入依赖的package包/类
private Array<CollisionSensor> filterCollisionSensors(Entity entity) {
    Array<CollisionSensor> collisionSensors = new Array<CollisionSensor>();
    CollisionSensorComponent collisionSensorComponent = entity.getComponent(CollisionSensorComponent.class);
    if (collisionSensorComponent != null) {
        IntMap.Values<ObjectSet<CollisionSensor>> values = collisionSensorComponent.sensors.values();
        while (values.hasNext()) {
            for (CollisionSensor sensor : values.next()) {
                if (sensor.targetTag != null) {
                    collisionSensors.add(sensor);
                }
            }
        }
    }
    return collisionSensors;

}
 
开发者ID:Rubentxu,项目名称:GDX-Logic-Bricks,代码行数:17,代码来源:CollisionSensorSystem.java

示例15: entityAdded

import com.badlogic.gdx.utils.IntMap; //导入依赖的package包/类
@Override
public void entityAdded(Entity entity) {
    Log.debug(tag, "EntityAdded add RaySensors");
    RigidBodiesComponents rigidBodiesComponent = entity.getComponent(RigidBodiesComponents.class);
    RaySensorComponent raySensorComponent = entity.getComponent(RaySensorComponent.class);
    if (raySensorComponent != null) {
        IntMap.Values<ObjectSet<RaySensor>> values = raySensorComponent.sensors.values();
        while (values.hasNext()) {
            for (RaySensor sensor : values.next()) {
                if (sensor.attachedRigidBody == null)
                    sensor.attachedRigidBody = rigidBodiesComponent.rigidBodies.first();

            }
        }
    }

}
 
开发者ID:Rubentxu,项目名称:GDX-Logic-Bricks,代码行数:18,代码来源:RaySensorSystem.java


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