當前位置: 首頁>>代碼示例>>Java>>正文


Java Array.get方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.utils.Array.get方法的典型用法代碼示例。如果您正苦於以下問題:Java Array.get方法的具體用法?Java Array.get怎麽用?Java Array.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.utils.Array的用法示例。


在下文中一共展示了Array.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: aabbCompute

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
private void aabbCompute () {
	float minX = Integer.MAX_VALUE, minY = Integer.MAX_VALUE, maxX = Integer.MIN_VALUE, maxY = Integer.MIN_VALUE;
	Array<FloatArray> polygons = this.polygons;
	for (int i = 0, n = polygons.size; i < n; i++) {
		FloatArray polygon = polygons.get(i);
		float[] vertices = polygon.items;
		for (int ii = 0, nn = polygon.size; ii < nn; ii += 2) {
			float x = vertices[ii];
			float y = vertices[ii + 1];
			minX = Math.min(minX, x);
			minY = Math.min(minY, y);
			maxX = Math.max(maxX, x);
			maxY = Math.max(maxY, y);
		}
	}
	this.minX = minX;
	this.minY = minY;
	this.maxX = maxX;
	this.maxY = maxY;
}
 
開發者ID:laurencegw,項目名稱:jenjin,代碼行數:21,代碼來源:SkeletonBounds.java

示例2: updateWorldTransform

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/**
 * Updates the world transform for each bone and applies all constraints.
 * <p>
 * See <a href="http://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
 * Runtimes Guide.
 */
public void updateWorldTransform() {
    // This partial update avoids computing the world transform for constrained bones when 1) the bone is not updated
    // before the constraint, 2) the constraint only needs to access the applied local transform, and 3) the constraint calls
    // updateWorldTransform.
    Array<Bone> updateCacheReset = this.updateCacheReset;
    for (int i = 0, n = updateCacheReset.size; i < n; i++) {
        Bone bone = updateCacheReset.get(i);
        bone.ax = bone.x;
        bone.ay = bone.y;
        bone.arotation = bone.rotation;
        bone.ascaleX = bone.scaleX;
        bone.ascaleY = bone.scaleY;
        bone.ashearX = bone.shearX;
        bone.ashearY = bone.shearY;
        bone.appliedValid = true;
    }
    Array<Updatable> updateCache = this.updateCache;
    for (int i = 0, n = updateCache.size; i < n; i++)
        updateCache.get(i).update();
}
 
開發者ID:laurencegw,項目名稱:jenjin,代碼行數:27,代碼來源:Skeleton.java

示例3: unschedule

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/** Unschedules a callback for a key and a given target.
 If you want to unschedule the 'callbackPerFrame', use unscheduleUpdate.
 */
public void unschedule(Object target, final String key) {
	struct_TargetUpdaterEntry e = _hashForTimers.get(target);
	if(e == null) {
		CCLog.engine(TAG, "unschedule() not found updater");
		return;
	}
	
	Array<TimerUpdater> timers = e.timers;
	if(timers == null) {
		return;
	}
	
	for(int i = timers.size - 1; i >= 0; --i) {
		TimerUpdater curr = timers.get(i);
		if(curr.key.equals(key)) {
			curr.removeSelf();		//延後移除,否則timers可能改變導致出錯
		}
	}
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:23,代碼來源:Scheduler.java

示例4: isScheduled

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/** Checks whether a callback associated with 'key' and 'target' is scheduled.
 @since v3.0.0
 */
public boolean isScheduled(final String key, Object target) {
	struct_TargetUpdaterEntry e = _hashForTimers.get(target);
	if(e != null) {
		Array<TimerUpdater> timers = e.timers;
    	if(timers != null) {
    		for(int i = timers.size - 1; i >= 0; --i) {
    			TimerUpdater t = timers.get(i);
    			if(key.equals(t.key)) {
    				return t.isAttached();
    			}
    		}
    	}
	}
	return false;
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:19,代碼來源:Scheduler.java

示例5: TiledObjectTypes

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
public TiledObjectTypes(String file) {
	xml_reader = new XmlReader();
	try {
		root = xml_reader.parse(Gdx.files.internal(file));
	} catch (IOException e) {
		e.printStackTrace();
	}
	types = new ObjectMap<String, TiledObjectTypes.TiledObjectType>();
	
	if(root == null)
		throw new GdxRuntimeException(String.format("Unable to parse file %s. make sure it is the correct path.", file));
	Array<Element> types = root.getChildrenByName("objecttype");
	for (Element element : types) {
		TiledObjectType tot = new TiledObjectType(element.get("name"));
		Array<Element> properties  = element.getChildrenByName("property");
		for (int i = 0; i < properties.size; i++) {
			Element element2 = properties.get(i);
			TypeProperty property = new TypeProperty(element2.get("name"), element2.get("type"), element2.hasAttribute("default")?element2.get("default"):"");
			tot.addProperty(property);
		}
		this.types.put(tot.name, tot);
	}
	
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:25,代碼來源:TiledObjectTypes.java

示例6: findPathConstraint

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/**
 * Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
 * than to call it multiple times.
 *
 * @return May be null.
 */
public PathConstraint findPathConstraint(String constraintName) {
    if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
    Array<PathConstraint> pathConstraints = this.pathConstraints;
    for (int i = 0, n = pathConstraints.size; i < n; i++) {
        PathConstraint constraint = pathConstraints.get(i);
        if (constraint.data.name.equals(constraintName)) return constraint;
    }
    return null;
}
 
開發者ID:laurencegw,項目名稱:jenjin,代碼行數:16,代碼來源:Skeleton.java

示例7: findPathConstraint

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
 * than to call it multiple times.
 * @return May be null. */
public PathConstraintData findPathConstraint (String constraintName) {
	if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
	Array<PathConstraintData> pathConstraints = this.pathConstraints;
	for (int i = 0, n = pathConstraints.size; i < n; i++) {
		PathConstraintData constraint = pathConstraints.get(i);
		if (constraint.name.equals(constraintName)) return constraint;
	}
	return null;
}
 
開發者ID:laurencegw,項目名稱:jenjin,代碼行數:13,代碼來源:SkeletonData.java

示例8: findBone

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
 * multiple times.
 * @return May be null. */
public BoneData findBone (String boneName) {
	if (boneName == null) throw new IllegalArgumentException("boneName cannot be null.");
	Array<BoneData> bones = this.bones;
	for (int i = 0, n = bones.size; i < n; i++) {
		BoneData bone = bones.get(i);
		if (bone.name.equals(boneName)) return bone;
	}
	return null;
}
 
開發者ID:laurencegw,項目名稱:jenjin,代碼行數:13,代碼來源:SkeletonData.java

示例9: findSlot

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
 * multiple times.
 * @return May be null. */
public SlotData findSlot (String slotName) {
	if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
	Array<SlotData> slots = this.slots;
	for (int i = 0, n = slots.size; i < n; i++) {
		SlotData slot = slots.get(i);
		if (slot.name.equals(slotName)) return slot;
	}
	return null;
}
 
開發者ID:laurencegw,項目名稱:jenjin,代碼行數:13,代碼來源:SkeletonData.java

示例10: findAnimation

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
 * call it multiple times.
 * @return May be null. */
public Animation findAnimation (String animationName) {
	if (animationName == null) throw new IllegalArgumentException("animationName cannot be null.");
	Array<Animation> animations = this.animations;
	for (int i = 0, n = animations.size; i < n; i++) {
		Animation animation = animations.get(i);
		if (animation.name.equals(animationName)) return animation;
	}
	return null;
}
 
開發者ID:laurencegw,項目名稱:jenjin,代碼行數:13,代碼來源:SkeletonData.java

示例11: getNameForButton

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
public String getNameForButton(int button) {
    Array<Controller> controllers = Controllers.getControllers();
    if (controllers.size > 0) {
        Controller controller = controllers.get(0);
        if (KeyboardInputProcessor.isXbox360Controller(controller.getName())) {
            switch(button) {
                case XBOX_360_A:
                    return "A";
                case XBOX_360_B:
                    return "B";
                case XBOX_360_X:
                    return "X";
                case XBOX_360_Y:
                    return "Y";
                case XBOX_360_LEFT_SHOULDER:
                    return "LSHLDR";
                case XBOX_360_RIGHT_SHOULDER:
                    return "RSHLDR";
                case XBOX_360_BACK:
                    return "BACK";
                case XBOX_360_START:
                    return "START";
            }
        } else if (controller.getName().equals(RETRO_USB_NAME)) {
            switch(button) {
                case RETRO_USB_A:
                    return "A";
                case RETRO_USB_B:
                    return "B";
                case RETRO_USB_SELECT:
                    return "SELECT";
                case RETRO_USB_START:
                    return "START";
            }
        }
    }
    return Integer.toString(button);
}
 
開發者ID:gradualgames,項目名稱:ggvm,代碼行數:39,代碼來源:KeyboardInputProcessor.java

示例12: addTiles

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/**
 * returns true if there is a solid collision
 * @param tiles
 * @param tcc
 * @return
 */
private boolean addTiles(Array<MapTile> tiles,TileCollisionController tcc) {
	boolean solid_collision = false;
	for (int j = 0; j < tiles.size; j++) {
		MapTile mt = tiles.get(j);
		int type = mt.getType();
		if(tcc.solidAgainst(type)||(type == TileCollisionController.VOID && tcc.collidesWithVoid())) {
			solid_collision = true;
		}
		tcc.addCollision(type,mt);
	}
	return solid_collision;
	
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:20,代碼來源:TileCollisionSystem.java

示例13: findBone

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
/**
 * Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
 * multiple times.
 *
 * @return May be null.
 */
public Bone findBone(String boneName) {
    if (boneName == null) throw new IllegalArgumentException("boneName cannot be null.");
    Array<Bone> bones = this.bones;
    for (int i = 0, n = bones.size; i < n; i++) {
        Bone bone = bones.get(i);
        if (bone.data.name.equals(boneName)) return bone;
    }
    return null;
}
 
開發者ID:laurencegw,項目名稱:jenjin,代碼行數:16,代碼來源:Skeleton.java

示例14: sortReset

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
private void sortReset(Array<Bone> bones) {
    for (int i = 0, n = bones.size; i < n; i++) {
        Bone bone = bones.get(i);
        if (bone.sorted) sortReset(bone.children);
        bone.sorted = false;
    }
}
 
開發者ID:laurencegw,項目名稱:jenjin,代碼行數:8,代碼來源:Skeleton.java

示例15: getTileChecks

import com.badlogic.gdx.utils.Array; //導入方法依賴的package包/類
private static TileTouchCheck[] getTileChecks(TextureAtlas atlas) {
	Texture texture = atlas.getTextures().first();
	if (!texture.getTextureData().isPrepared())
		texture.getTextureData().prepare();
	Pixmap pixelMap = texture.getTextureData().consumePixmap();
	
	Array<AtlasRegion> tileMaps = atlas.getRegions(); // hopefully, they are in order.
	TileTouchCheck[] checks = new TileTouchCheck[tileMaps.size];
	for(int i = 0; i < checks.length; i++) {
		checks[i] = new TileTouchCheck(pixelMap, tileMaps.get(i));
	}
	
	return checks;
}
 
開發者ID:chrisj42,項目名稱:miniventure,代碼行數:15,代碼來源:TileTouchCheck.java


注:本文中的com.badlogic.gdx.utils.Array.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。