/** Creates empty tileset */ public TiledMapTileSet () { tiles = new IntMap<TiledMapTile>(); properties = new MapProperties(); }
/** Creates empty tileset */ public TiledMapTileSet () { tiles = new IntMap<TiledMapTile>(); properties = new MapProperties(); }
/** 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; 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; }
/** 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; 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; }
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); } }
sourceToSoundId = new IntMap<Long>();
sourceToSoundId = new IntMap<Long>();
sourceToSoundId = new IntMap<Long>();
sourceToSoundId = new IntMap<Long>();
/** * A fresh filtered color center. * * @param filterEffect * The filter to use. */ public SquidColorCenter(/*Nullable*/IFilter<Color> filterEffect) { cache = new IntMap<>(256); filter = filterEffect; }
/** Creates empty tileset */ public TiledMapTileSet () { tiles = new IntMap<TiledMapTile>(); properties = new MapProperties(); }
/** * Constructs a new SColorFactory with an empty cache. * <br> * Implementation note: SColorFactory initially used static methods and was not intended to * be constructed by users, but for compatibility with Android (where static instances may * linger into another run of an application), it was reworked to require an object to be * constructed and for that object to contain the cache, rather than a static instance. Code * written for earlier versions of SquidLib may use static methods on SColorFactory; most * code written in SquidLib 3.0.0 beta 2 and newer prefers the IColorCenter implementations * such as SquidColorCenter when SColor features such as color names aren't required. Since * beta 4, SquidColorCenter implements most of SColorFactory's API, and also supports an * IFilter for automatic changes to requested colors. */ public SColorFactory() { valueLookup = new IntMap<>(); rng = new GWTRNG(); colorBag = new IntMap<>(); palettes = new ObjectMap<>(); floor = 1; }
public GdxKeyRepeatSystem(@Nonnull final GdxInputSystem gdxInputSystem) { input = gdxInputSystem.getInput(); this.gdxInputSystem = gdxInputSystem; keyRepeatTimer = new Timer(); keyRepeatTasks = new IntMap<Timer.Task>(); repeatingKeys = new IntArray(); keyRepeatRates = new IntFloatMap(); keyRepeatStartDelays = new IntFloatMap(); currentRepeatingKeyTask = null; currentRepeatingGdxKeyCode = 0; currentRepeatingKeyIndex = 0; }
public GdxKeyRepeatSystem(@Nonnull final GdxInputSystem gdxInputSystem) { input = gdxInputSystem.getInput(); this.gdxInputSystem = gdxInputSystem; keyRepeatTimer = new Timer(); keyRepeatTasks = new IntMap<Timer.Task>(); repeatingKeys = new IntArray(); keyRepeatRates = new IntFloatMap(); keyRepeatStartDelays = new IntFloatMap(); currentRepeatingKeyTask = null; currentRepeatingGdxKeyCode = 0; currentRepeatingKeyIndex = 0; }
private IntMap<IntArray> getDefault(){ IntMap<IntArray> keyboard = new IntMap<IntArray>(); keyboard.put(InputAction.PRESS_LEFT, new IntArray(new int[] { Input.Keys.LEFT })); keyboard.put(InputAction.PRESS_RIGHT, new IntArray(new int[] { Input.Keys.RIGHT })); keyboard.put(InputAction.PRESS_UP, new IntArray(new int[] { Input.Keys.UP })); keyboard.put(InputAction.PRESS_DOWN, new IntArray(new int[] { Input.Keys.DOWN })); return keyboard; } }
/** 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; 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; }
sourceToSoundId = new IntMap<Long>();
@Override public void create() { sounds = new IntMap<Sound>(); sounds.put(Keys.NUM_1, Gdx.audio.newSound(Gdx.files.internal("data/sfx/sfx_01.wav"))); sounds.put(Keys.NUM_2, Gdx.audio.newSound(Gdx.files.internal("data/sfx/sfx_02.wav"))); sounds.put(Keys.NUM_3, Gdx.audio.newSound(Gdx.files.internal("data/sfx/sfx_03.mp3"))); sounds.put(Keys.NUM_4, Gdx.audio.newSound(Gdx.files.internal("data/sfx/sfx_04.wav"))); sounds.put(Keys.NUM_5, Gdx.audio.newSound(Gdx.files.internal("data/sfx/sfx_05.mp3"))); sounds.put(Keys.NUM_6, Gdx.audio.newSound(Gdx.files.internal("data/sfx/sfx_06.mp3"))); sounds.put(Keys.NUM_7, Gdx.audio.newSound(Gdx.files.internal("data/sfx/sfx_07.wav"))); Gdx.input.setInputProcessor(this); Gdx.app.log("SoundEffectSample", "Instructions"); Gdx.app.log("SoundEffectSample", "- Press keys 1-0 to play sounds"); Gdx.app.log("SoundEffectSample", "- Press s to stop all sounds"); Gdx.app.log("SoundEffectSample", "- Press p to pause all sounds"); Gdx.app.log("SoundEffectSample", "- Press r to resume all soud"); }