Example usage for com.badlogic.gdx.utils IntMap IntMap

List of usage examples for com.badlogic.gdx.utils IntMap IntMap

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils IntMap IntMap.

Prototype

public IntMap(IntMap<? extends V> map) 

Source Link

Document

Creates a new map identical to the specified map.

Usage

From source file:com.kotcrab.vis.editor.serializer.cloner.IntMapCloner.java

License:Apache License

@Override
protected IntMap cloneObject(IntMap original, IDeepCloner cloner, Map<Object, Object> clones) {
    IntMap map = new IntMap(original.size);

    for (Object object : original.entries()) {
        Entry entry = (Entry) object;//from  w  w w  .  jav a2  s  .c o m
        map.put(entry.key, cloner.deepClone(entry.value, clones));
    }

    return map;
}

From source file:com.kotcrab.vis.editor.serializer.json.IntMapJsonSerializer.java

License:Apache License

@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));
    }//from  ww w. j a va2  s .c o m

    return intMap;
}

From source file:com.mangecailloux.pebble.entity.EntitiesManager.java

License:Apache License

protected EntitiesManager(EntityWorld _world) {
    // reset the global counter as static data can be retained between application instances
    Entity.globalCounter = 0;//from   w ww . jav  a2  s  . c  o  m

    logger = new Logger("EntityManager");
    world = _world;
    entities = new Array<Entity>(false, 8);
    obervers = new Array<IEntityObserver>(false, 4);

    entitiesByHandle = new IntMap<Entity>(8);
    currentHandle = 0;
}

From source file:com.ore.infinium.systems.TileRenderer.java

License:Open Source License

public TileRenderer(OrthographicCamera camera, World world, float interval) {
    super(interval);
    elapsed = interval;//from  w  w w .  j a  va  2s  .com

    m_camera = camera;
    m_world = world;
    m_batch = new SpriteBatch(5000);

    m_blockAtlas = new TextureAtlas(Gdx.files.internal("packed/blocks.atlas"));
    m_tilesAtlas = new TextureAtlas(Gdx.files.internal("packed/tiles.atlas"));
    for (TextureRegion region : m_tilesAtlas.getRegions()) {
        region.flip(false, true);
    }

    //dirt 16 and beyond are transition things.
    final int dirtMax = 25;
    dirtBlockMeshes = new IntMap<>(dirtMax);
    for (int i = 0; i <= dirtMax; ++i) {
        String formatted = String.format("dirt-%02d", i);
        dirtBlockMeshes.put(i, formatted);
    }

    //18+ are transition helpers
    final int grassMax = 20;
    grassBlockMeshes = new IntMap<>(grassMax);
    for (int i = 0; i <= grassMax; ++i) {
        String formatted = String.format("grass-%02d", i);
        grassBlockMeshes.put(i, formatted);
    }

    final int stoneMax = 30;
    stoneBlockMeshes = new IntMap<>(stoneMax);
    for (int i = 0; i <= stoneMax; ++i) {
        String formatted = String.format("stone-%02d", i);
        stoneBlockMeshes.put(i, formatted);
    }
}

From source file:com.ridiculousRPG.ui.StandardMenuService.java

License:Apache License

public void initTransient() {
    stateHandlerMap = new IntMap<MenuStateHandler>(16);
}

From source file:com.ridiculousRPG.util.IntSet.java

License:Apache License

private void readObject(ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
    s.defaultReadObject();// w w w.java  2  s  . c  o m

    // Read in size
    int size = s.readInt();
    map = new IntMap<Object>((size * 4) / 3);

    // Read in all elements in the proper order.
    for (int i = 0; i < size; i++)
        map.put(s.readInt(), DUMMY);
}