List of usage examples for com.badlogic.gdx.utils IntMap IntMap
public IntMap()
From source file:com.cmein.tilemap.utils.TileSetLayout.java
License:Apache License
/** * Constructs a Tile Set layout. The tile set image contained in the baseDir should be the original tile set images before * being processed by {@link TiledMapPacker} (the ones actually read by Tiled). * @param tileSet the tile set to process * @param baseDir the directory in which the tile set image is stored * *//*from w w w . j av a 2 s . c om*/ TileSetLayout(TileSet tileSet, FileHandle baseDir) throws IOException { this.tileSet = tileSet; image = ImageIO.read(baseDir.child(tileSet.imageName).read()); imageTilePositions = new IntMap<Vector2>(); // fill the tile regions int x, y, tile = 0; numRows = 0; numCols = 0; for (y = tileSet.margin; y < image.getHeight() - tileSet.margin; y += tileSet.tileHeight + tileSet.spacing) { for (x = tileSet.margin; x < image.getWidth() - tileSet.margin; x += tileSet.tileWidth + tileSet.spacing) { if (y == tileSet.margin) numCols++; imageTilePositions.put(tile, new Vector2(x, y)); tile++; } numRows++; } numTiles = numRows * numCols; }
From source file:com.dragome.gdx.graphics.webgl.DragomeGL20.java
License:Apache License
private int allocateUniformLocationId(final int program, final WebGLUniformLocation location) { IntMap<WebGLUniformLocation> progUniforms = uniforms.get(program); if (progUniforms == null) { progUniforms = new IntMap<WebGLUniformLocation>(); uniforms.put(program, progUniforms); }// w w w. j a v a 2 s . c om // FIXME Check if uniform already stored. final int id = nextUniformId++; progUniforms.put(id, location); return id; }
From source file:com.forerunnergames.peril.client.input.GdxKeyRepeatSystem.java
License:Open Source License
public GdxKeyRepeatSystem(final Input input, final KeyRepeatListener listener) { Arguments.checkIsNotNull(input, "input"); Arguments.checkIsNotNull(listener, "listener"); this.input = input; this.listener = listener; keyRepeatTimer = new Timer(); keyRepeatTasks = new IntMap<>(); repeatingKeys = new IntArray(); keyRepeatRates = new IntFloatMap(); keyRepeatStartDelays = new IntFloatMap(); currentRepeatingKeyTask = null;//from w w w .j a v a 2 s . c o m currentRepeatingGdxKeyCode = 0; currentRepeatingKeyIndex = 0; }
From source file:com.kotcrab.vis.runtime.scene.IntMapJsonSerializer.java
License:Apache License
@Override public IntMap read(Json json, JsonValue jsonData, Class type) { IntMap intMap = new IntMap(); for (JsonValue entry = jsonData.child; entry != null; entry = entry.next) { intMap.put(Integer.parseInt(entry.name), json.readValue(entry.name, null, jsonData)); }/*from w w w .ja v a 2 s . c o m*/ return intMap; }
From source file:com.sertaogames.cactus2d.misc.TileSetLayout.java
License:Apache License
/** Constructs a Tile Set layout. The tile set image contained in the baseDir should be the original tile set images before * being processed by {@link TiledMapPacker} (the ones actually read by Tiled). * @param tileSet the tile set to process * @param baseDir the directory in which the tile set image is stored */ protected TileSetLayout(TileSet tileSet, FileHandle baseDir) throws IOException { super(tileSet); image = ImageIO.read(baseDir.child(tileSet.imageName).read()); imageTilePositions = new IntMap<Vector2>(); // fill the tile regions int x, y, tile = 0; numRows = 0;/*w w w .j a v a 2s . c o m*/ numCols = 0; for (y = tileSet.margin; y < image.getHeight() - tileSet.margin; y += tileSet.tileHeight + tileSet.spacing) { for (x = tileSet.margin; x < image.getWidth() - tileSet.margin; x += tileSet.tileWidth + tileSet.spacing) { if (y == tileSet.margin) numCols++; imageTilePositions.put(tile, new Vector2(x, y)); tile++; } numRows++; } numTiles = numRows * numCols; }
From source file:com.thetruthbeyond.gui.objects.Clickable.java
License:Open Source License
@Override public void addEmitter(Emitter emitter) { if (emitters == null) emitters = new IntMap<>(); emitters.put(emitter.getId(), emitter); }
From source file:com.thetruthbeyond.gui.objects.Clickable.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public <T extends Emitter> T getEmitter(int emitterID) { if (emitters == null) emitters = new IntMap<>(); return (T) emitters.get(emitterID, null); }
From source file:com.weimingtom.iteye.simplerpg.tiled.TileSetLayout.java
License:Apache License
/** Constructs a Tile Set layout. The tile set image contained in the baseDir should be the original tile set images before * being processed by {@link TiledMapPacker} (the ones actually read by Tiled). * @param tileSet the tile set to process * @param baseDir the directory in which the tile set image is stored */ protected TileSetLayout(TileSet tileSet, FileHandle baseDir) throws IOException { super(tileSet); image = ImageIO.read(baseDir.child(tileSet.imageName).read()); imageTilePositions = new IntMap<Vector2>(); // fill the tile regions int x, y, tile = 0; numRows = 0;//from w ww . ja v a 2 s .c o m numCols = 0; int stopWidth = image.getWidth() - tileSet.tileWidth; int stopHeight = image.getHeight() - tileSet.tileHeight; for (y = tileSet.margin; y <= stopHeight; y += tileSet.tileHeight + tileSet.spacing) { for (x = tileSet.margin; x <= stopWidth; x += tileSet.tileWidth + tileSet.spacing) { if (y == tileSet.margin) numCols++; imageTilePositions.put(tile, new Vector2(x, y)); tile++; } numRows++; } numTiles = numRows * numCols; }
From source file:de.bitowl.advent.game2.TileSetLayout.java
License:Apache License
/** Constructs a Tile Set layout. The tile set image contained in the baseDir should be the original tile set images before * being processed by {@link TiledMapPacker} (the ones actually read by Tiled). * @param tileset the tile set to process * @param baseDir the directory in which the tile set image is stored */ protected TileSetLayout(int firstgid, TiledMapTileSet tileset, FileHandle baseDir) throws IOException { int tileWidth = tileset.getProperties().get("tilewidth", Integer.class); int tileHeight = tileset.getProperties().get("tileheight", Integer.class); int margin = tileset.getProperties().get("margin", Integer.class); int spacing = tileset.getProperties().get("spacing", Integer.class); this.firstgid = firstgid; image = ImageIO.read(baseDir.child(tileset.getProperties().get("imagesource", String.class)).read()); imageTilePositions = new IntMap<Vector2>(); // fill the tile regions int x, y, tile = 0; numRows = 0;//from ww w. ja v a 2s . co m numCols = 0; int stopWidth = image.getWidth() - tileWidth; int stopHeight = image.getHeight() - tileHeight; for (y = margin; y <= stopHeight; y += tileHeight + spacing) { for (x = margin; x <= stopWidth; x += tileWidth + spacing) { if (y == margin) numCols++; imageTilePositions.put(tile, new Vector2(x, y)); tile++; } numRows++; } numTiles = numRows * numCols; }
From source file:io.piotrjastrzebski.sfg.events.EventLoop.java
License:Open Source License
public EventLoop() { listenerMap = new IntMap<Array<EventListener>>(); eventQueueCurrent = new Array<Event>(); eventQueueNext = new Array<Event>(); eventPool = new EventPool(); }