com.badlogic.gdx.utils.IntMap Java Examples
The following examples show how to use
com.badlogic.gdx.utils.IntMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RandomInputModuleWrapper.java From talos with Apache License 2.0 | 6 votes |
protected void removeSlot(int slot, boolean isInput) { IntMap<Slot> list = module.getInputSlots(); if(!isInput) { list = module.getOutputSlots(); } //remove this slot from module for(int i = slot; i >= 0; i++) { // don't do this kids if(list.get(i+1) == null) { list.remove(i); break; } list.put(i,list.get(i+1)); list.get(i).setIndex(i); } module.slotCount--; loadSlots(); }
Example #2
Source File: InputModuleWrapper.java From talos with Apache License 2.0 | 6 votes |
@Override protected void configureSlots() { map = new IntMap<>(); map.put(ScopePayload.EMITTER_ALPHA, "Emitter.alpha - Duration"); map.put(ScopePayload.PARTICLE_ALPHA, "Particle.alpha - Lifetime"); map.put(ScopePayload.EMITTER_ALPHA_AT_P_INIT, "Duration at particle init"); map.put(ScopePayload.SECONDARY_SEED, "Primary Seed"); map.put(ScopePayload.PARTICLE_SEED, "Secondary Seed"); map.put(ScopePayload.PARTICLE_POSITION, "Particle position"); map.put(ScopePayload.TOTAL_TIME, "Global Time"); selectBox = addSelectBox(map.values()); addOutputSlot("output", 0); selectBox.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { String selectedString = selectBox.getSelected(); int key = map.findKey(selectedString, false, 0); module.setInput(key); } }); }
Example #3
Source File: AndroidControllers.java From gdx-controllerutils with Apache License 2.0 | 6 votes |
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); } }
Example #4
Source File: MainState.java From beatoraja with GNU General Public License v3.0 | 6 votes |
public void setSkin(Skin skin) { if (this.skin != null) { this.skin.dispose(); } this.skin = skin; if (skin != null) { for (IntMap.Entry<Offset> e : skin.getOffset().entries()) { SkinOffset offset = main.getOffset(e.key); if(offset == null || e.value == null) { continue; } offset.x = e.value.x; offset.y = e.value.y; offset.w = e.value.w; offset.h = e.value.h; offset.r = e.value.r; offset.a = e.value.a; } } }
Example #5
Source File: DesktopInputProcessor.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@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; }
Example #6
Source File: Entity.java From gdx-proto with Apache License 2.0 | 5 votes |
public static void init() { list = new Array<>(); destroyQueue = new Array<>(); idMap = new IntMap<>(); usedIDs = new Array<>(); DynamicEntity.list = new Array<>(); EntityModel.list = new Array<>(); }
Example #7
Source File: InputMap.java From seventh with GNU General Public License v2.0 | 5 votes |
/** * */ public InputMap(ControllerInput controllerInput) { this.controllerInput = controllerInput; this.actions = new HashMap<String, InputMap.Action>(); this.keymap = new IntMap<String>(); this.buttonmap = new IntMap<String>(); this.controllermap = new IntMap<String>(); this.povButtons = new String[PovDirection.values().length]; this.scroller = new String[2]; }
Example #8
Source File: KeyMapper.java From riiablo with Apache License 2.0 | 5 votes |
@Override @NonNull public Iterator<MappedKey> iterator() { IntMap.Values<ObjectSet<MappedKey>> entries = KEYS.values(); ObjectSet<MappedKey> uniqueEntries = new ObjectSet<>(); for (ObjectSet<MappedKey> entry : entries) { uniqueEntries.addAll(entry); } return uniqueEntries.iterator(); }
Example #9
Source File: Animation.java From riiablo with Apache License 2.0 | 5 votes |
public boolean addAnimationListener(int frame, AnimationListener l) { Validate.isTrue(l != null, "l cannot be null"); if (animationListeners == EMPTY_MAP) animationListeners = new IntMap<>(1); Array<AnimationListener> listeners = animationListeners.get(frame); if (listeners == null) animationListeners.put(frame, listeners = new Array<>(1)); listeners.add(l); return true; }
Example #10
Source File: LR2SkinCSVLoader.java From beatoraja with GNU General Public License v3.0 | 5 votes |
protected S loadSkin(S skin, Path f, MainState state, SkinHeader header, IntIntMap option, ObjectMap<String, Object> property) throws IOException { this.skin = skin; this.state = state; for (String key : property.keys()) { if (property.get(key) != null) { if (property.get(key) instanceof Integer) { op.put((Integer) property.get(key), 1); } if (property.get(key) instanceof String) { for (CustomFile file : header.getCustomFiles()) { if (file.name.equals(key)) { filemap.put(file.path, (String) property.get(key)); break; } } } } } IntMap<SkinConfig.Offset> offset = new IntMap<>(); for (CustomOffset of : header.getCustomOffsets()) { final Object o = property.get(of.name); if(o instanceof Offset) { offset.put(of.id, (Offset)o); } } skin.setOffset(offset); op.putAll(option); this.loadSkin0(skin, f, state, op); return skin; }
Example #11
Source File: RandomInputModuleWrapper.java From talos with Apache License 2.0 | 5 votes |
private void loadSlots() { if(module != null) { leftWrapper.clearChildren(); IntMap<Slot> list = module.getInputSlots(); int tmpCount = list.size; module.slotCount = 0; for (int i = 0; i < tmpCount; i++) { module.slotCount++; addNewInputSlot(); } invalidateHierarchy(); pack(); } }
Example #12
Source File: Map.java From riiablo with Apache License 2.0 | 4 votes |
void putCell(int layer, int tx, int ty, DS1.Cell cell) { if (specials == EMPTY_INT_CELL_MAP) specials = new IntMap<>(); specials.put(tileHashCode(layer, tx, ty), cell); }
Example #13
Source File: Map.java From riiablo with Apache License 2.0 | 4 votes |
void copyWalls(Zone zone, int layer, int tx, int ty) { final int startTx = tx; final int startTy = ty; for (int l = 0; l < ds1.numWalls; l++, layer++, ty = startTy) { if (zone.tiles[layer] == null) zone.tiles[layer] = Zone.obtainTileArray(zone.tilesX * zone.tilesY); for (int y = 0; y < ds1.height; y++, ty++, tx = startTx) { int ptr = l + (y * ds1.wallLine); for (int x = 0; x < ds1.width; x++, tx++, ptr += ds1.numWalls) { DS1.Cell cell = ds1.walls[ptr]; if (Orientation.isSpecial(cell.orientation)) { //DT1.Tile tile = zone.tiles[layer][zone.tileIndex(tx, ty)] = zone.dt1s.get(cell); if (ID.POPPADS.contains(cell.id)) { if (popPads == null) popPads = new IntMap<>(); PopPad popPad = popPads.get(cell.id); if (popPad == null) popPads.put(cell.id, new PopPad(cell.id, x * DT1.Tile.SUBTILE_SIZE, y * DT1.Tile.SUBTILE_SIZE)); else popPad.setEnd( x * DT1.Tile.SUBTILE_SIZE + DT1.Tile.SUBTILE_SIZE + preset.PopPad, y * DT1.Tile.SUBTILE_SIZE + DT1.Tile.SUBTILE_SIZE + preset.PopPad); zone.putCell(layer, tx, ty, cell); } else if (ID.WARPS.contains(cell.id) && cell.subIndex != 1) { //zone.addWarp(cell.id, tx, ty); zone.putCell(layer, tx, ty, cell); } } if ((cell.value & DS1.Cell.FLOOR_UNWALK_MASK) == 0) { continue; } if ((cell.value & DS1.Cell.HIDDEN_MASK) != 0) { // This seems like all the special tiles, null usually means marker tile (start pos), // non null usually means stuff like side of river, used for ?weather? ?rain drops? if (!Orientation.isSpecial(cell.orientation)) { // prints all of the debug tiles on side of river (any maybe elsewhere) //DT1.Tile tile = dt1s.get(cell); //System.out.println(x + ", " + y + " " + tile); or(zone, tx, ty, DT1.Tile.FLAG_BLOCK_WALK); } else { zone.putCell(layer, tx, ty, cell); } continue; } if (Orientation.isFloor(cell.orientation)) { continue; } // This tracks the blue river tiles that might be left for debugging // since they also appear in the ds1 editor this is based from, // I'll leave them in for now //if (cell.orientation == 1 && cell.mainIndex == 5 && cell.subIndex == 0) { // System.out.println("found it! " + String.format("%08x", cell.value)); //} DT1.Tile tile = zone.tiles[layer][zone.tileIndex(tx, ty)] = zone.dt1s.get(cell); or(zone, tx, ty, tile); // Special case, because LEFT_NORTH_CORNER_WALL don't seem to exist, but they contain // collision data for RIGHT_NORTH_CORNER_WALL, ORing the data just in case some // RIGHT_NORTH_CORNER_WALL actually does anything if (cell.orientation == Orientation.RIGHT_NORTH_CORNER_WALL) { DT1.Tile sibling = zone.dt1s.get(Orientation.LEFT_NORTH_CORNER_WALL, cell.mainIndex, cell.subIndex); or(zone, tx, ty, sibling); } } } } }
Example #14
Source File: PropertyList.java From riiablo with Apache License 2.0 | 4 votes |
public void deepCopy(PropertyList src) { for (IntMap.Entry<Stat> entry : src.props.entries()) { props.put(entry.key, entry.value.copy()); } }
Example #15
Source File: ModuleWrapper.java From talos with Apache License 2.0 | 4 votes |
protected VisSelectBox addSelectBox(IntMap.Values<String> values) { return addSelectBox(values.toArray()); }
Example #16
Source File: TalosProject.java From talos with Apache License 2.0 | 4 votes |
public void loadProject (String data) { TalosMain.Instance().UIStage().PreviewWidget().getGLProfiler().reset(); cleanData(); projectSerializer.prereadhack(data); projectData = projectSerializer.read(data); readMetaData = projectData.metaData; ParticleEmitterWrapper firstEmitter = null; for(EmitterData emitterData: projectData.getEmitters()) { IntMap<ModuleWrapper> map = new IntMap<>(); ParticleEmitterWrapper emitterWrapper = createNewEmitter(emitterData.name, emitterData.sortPosition); TalosMain.Instance().NodeStage().moduleBoardWidget.loadEmitterToBoard(emitterWrapper, emitterData); final ParticleEmitterDescriptor graph = emitterWrapper.getGraph(); for (ModuleWrapper module : emitterData.modules) { map.put(module.getId(), module); graph.addModule(module.getModule()); module.getModule().setModuleGraph(graph); } // time to load groups here for(GroupData group: emitterData.groups) { ObjectSet<ModuleWrapper> childWrappers = new ObjectSet<>(); for(Integer id: group.modules) { if(map.get(id) != null) { childWrappers.add(map.get(id)); } } ModuleWrapperGroup moduleWrapperGroup = TalosMain.Instance().NodeStage().moduleBoardWidget.createGroupForWrappers(childWrappers); Color clr = new Color(); Color.abgr8888ToColor(clr, group.color); moduleWrapperGroup.setData(group.text, clr); } } sortEmitters(); if(activeWrappers.size > 0) { firstEmitter = activeWrappers.first(); } if(firstEmitter != null) { TalosMain.Instance().TalosProject().setCurrentEmitterWrapper(firstEmitter); TalosMain.Instance().NodeStage().moduleBoardWidget.setCurrentEmitter(firstEmitter); } TalosMain.Instance().UIStage().setEmitters(activeWrappers); TalosMain.Instance().NodeStage().getStage().setKeyboardFocus(null); }
Example #17
Source File: AbstractModule.java From talos with Apache License 2.0 | 4 votes |
public IntMap<Slot> getOutputSlots() { return outputSlots; }
Example #18
Source File: MessageDispatcher.java From gdx-ai with Apache License 2.0 | 4 votes |
/** Creates a {@code MessageDispatcher} */ public MessageDispatcher () { this.queue = new PriorityQueue<Telegram>(); this.msgListeners = new IntMap<Array<Telegraph>>(); this.msgProviders = new IntMap<Array<TelegramProvider>>(); }
Example #19
Source File: AbstractModule.java From talos with Apache License 2.0 | 4 votes |
public IntMap<Slot> getInputSlots() { return inputSlots; }