本文整理了Java中com.badlogic.gdx.utils.Array.get()
方法的一些代码示例,展示了Array.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array.get()
方法的具体详情如下:
包路径:com.badlogic.gdx.utils.Array
类名称:Array
方法名:get
暂无
代码示例来源:origin: libgdx/libgdx
/** Get multiple attributes at once. Example: material.get(out, ColorAttribute.Diffuse | ColorAttribute.Specular |
* TextureAttribute.Diffuse); */
public final Array<Attribute> get (final Array<Attribute> out, final long type) {
for (int i = 0; i < attributes.size; i++)
if ((attributes.get(i).type & type) != 0) out.add(attributes.get(i));
return out;
}
代码示例来源:origin: libgdx/libgdx
/** Get multiple attributes at once. Example: material.get(out, ColorAttribute.Diffuse | ColorAttribute.Specular |
* TextureAttribute.Diffuse); */
public final Array<Attribute> get (final Array<Attribute> out, final long type) {
for (int i = 0; i < attributes.size; i++)
if ((attributes.get(i).type & type) != 0) out.add(attributes.get(i));
return out;
}
代码示例来源:origin: libgdx/libgdx
/** @param name the name of the children
* @return the children with the given name or an empty {@link Array} */
public Array<Element> getChildrenByName (String name) {
Array<Element> result = new Array<Element>();
if (children == null) return result;
for (int i = 0; i < children.size; i++) {
Element child = children.get(i);
if (child.name.equals(name)) result.add(child);
}
return result;
}
代码示例来源:origin: libgdx/libgdx
static boolean findExpandedObjects (Array<Node> nodes, Array objects) {
boolean expanded = false;
for (int i = 0, n = nodes.size; i < n; i++) {
Node node = nodes.get(i);
if (node.expanded && !findExpandedObjects(node.children, objects)) objects.add(node.object);
}
return expanded;
}
代码示例来源:origin: libgdx/libgdx
/** @param name the name of the children
* @return the children with the given name or an empty {@link Array} */
public Array<Element> getChildrenByName (String name) {
Array<Element> result = new Array<Element>();
if (children == null) return result;
for (int i = 0; i < children.size; i++) {
Element child = children.get(i);
if (child.name.equals(name)) result.add(child);
}
return result;
}
代码示例来源:origin: libgdx/libgdx
private void getChildrenByNameRecursively (String name, Array<Element> result) {
if (children == null) return;
for (int i = 0; i < children.size; i++) {
Element child = children.get(i);
if (child.name.equals(name)) result.add(child);
child.getChildrenByNameRecursively(name, result);
}
}
代码示例来源:origin: libgdx/libgdx
static boolean findExpandedObjects (Array<Node> nodes, Array objects) {
boolean expanded = false;
for (int i = 0, n = nodes.size; i < n; i++) {
Node node = nodes.get(i);
if (node.expanded && !findExpandedObjects(node.children, objects)) objects.add(node.object);
}
return expanded;
}
代码示例来源:origin: libgdx/libgdx
private void getChildrenByNameRecursively (String name, Array<Element> result) {
if (children == null) return;
for (int i = 0; i < children.size; i++) {
Element child = children.get(i);
if (child.name.equals(name)) result.add(child);
child.getChildrenByNameRecursively(name, result);
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void onObjectVisible (btCollisionObject object) {
visibleEntities.add(world.entities.get(object.getUserValue()));
}
代码示例来源:origin: libgdx/libgdx
public boolean executeRunnables () {
synchronized (runnables) {
for (int i = runnables.size - 1; i >= 0; i--)
executedRunnables.add(runnables.get(i));
runnables.clear();
}
if (executedRunnables.size == 0) return false;
for (int i = executedRunnables.size - 1; i >= 0; i--)
executedRunnables.removeIndex(i).run();
return true;
}
代码示例来源:origin: libgdx/libgdx
/** Returns all regions with the specified name, ordered by smallest to largest {@link AtlasRegion#index index}. This method
* uses string comparison to find the regions, so the result should be cached rather than calling this method multiple times. */
public Array<AtlasRegion> findRegions (String name) {
Array<AtlasRegion> matched = new Array(AtlasRegion.class);
for (int i = 0, n = regions.size; i < n; i++) {
AtlasRegion region = regions.get(i);
if (region.name.equals(name)) matched.add(new AtlasRegion(region));
}
return matched;
}
代码示例来源:origin: libgdx/libgdx
public boolean executeRunnables () {
synchronized (runnables) {
for (int i = runnables.size - 1; i >= 0; i--)
executedRunnables.add(runnables.get(i));
runnables.clear();
}
if (executedRunnables.size == 0) return false;
do
executedRunnables.pop().run();
while (executedRunnables.size > 0);
return true;
}
代码示例来源:origin: libgdx/libgdx
public boolean executeRunnables () {
synchronized (runnables) {
for (int i = runnables.size - 1; i >= 0; i--)
executedRunnables.add(runnables.get(i));
runnables.clear();
}
if (executedRunnables.size == 0) return false;
do
executedRunnables.pop().run();
while (executedRunnables.size > 0);
return true;
}
代码示例来源:origin: libgdx/libgdx
/** Returns all regions with the specified name as sprites, ordered by smallest to largest {@link AtlasRegion#index index}. This
* method uses string comparison to find the regions and constructs new sprites, so the result should be cached rather than
* calling this method multiple times.
* @see #createSprite(String) */
public Array<Sprite> createSprites (String name) {
Array<Sprite> matched = new Array(Sprite.class);
for (int i = 0, n = regions.size; i < n; i++) {
AtlasRegion region = regions.get(i);
if (region.name.equals(name)) matched.add(newSprite(region));
}
return matched;
}
代码示例来源:origin: libgdx/libgdx
private void copyNodes (Array<Node> nodes, final Array<String> nodeIds) {
for (int i = 0, n = nodes.size; i < n; ++i) {
final Node node = nodes.get(i);
for (final String nodeId : nodeIds) {
if (nodeId.equals(node.id)) {
this.nodes.add(node.copy());
break;
}
}
}
invalidate();
}
代码示例来源:origin: libgdx/libgdx
public boolean executeRunnables () {
synchronized (runnables) {
for (int i = runnables.size - 1; i >= 0; i--)
executedRunnables.add(runnables.get(i));
runnables.clear();
}
if (executedRunnables.size == 0) return false;
for (int i = executedRunnables.size - 1; i >= 0; i--)
executedRunnables.removeIndex(i).run();
return true;
}
代码示例来源:origin: libgdx/libgdx
private void copyNodes (Array<Node> nodes, final String... nodeIds) {
for (int i = 0, n = nodes.size; i < n; ++i) {
final Node node = nodes.get(i);
for (final String nodeId : nodeIds) {
if (nodeId.equals(node.id)) {
this.nodes.add(node.copy());
break;
}
}
}
invalidate();
}
代码示例来源:origin: libgdx/libgdx
/** Returns all regions with the specified name, ordered by smallest to largest {@link AtlasRegion#index index}. This method
* uses string comparison to find the regions, so the result should be cached rather than calling this method multiple times. */
public Array<AtlasRegion> findRegions (String name) {
Array<AtlasRegion> matched = new Array(AtlasRegion.class);
for (int i = 0, n = regions.size; i < n; i++) {
AtlasRegion region = regions.get(i);
if (region.name.equals(name)) matched.add(new AtlasRegion(region));
}
return matched;
}
代码示例来源:origin: libgdx/libgdx
/** Returns all regions with the specified name as sprites, ordered by smallest to largest {@link AtlasRegion#index index}. This
* method uses string comparison to find the regions and constructs new sprites, so the result should be cached rather than
* calling this method multiple times.
* @see #createSprite(String) */
public Array<Sprite> createSprites (String name) {
Array<Sprite> matched = new Array(Sprite.class);
for (int i = 0, n = regions.size; i < n; i++) {
AtlasRegion region = regions.get(i);
if (region.name.equals(name)) matched.add(newSprite(region));
}
return matched;
}
代码示例来源:origin: libgdx/libgdx
private void copyNodes (Array<Node> nodes, final String... nodeIds) {
for (int i = 0, n = nodes.size; i < n; ++i) {
final Node node = nodes.get(i);
for (final String nodeId : nodeIds) {
if (nodeId.equals(node.id)) {
this.nodes.add(node.copy());
break;
}
}
}
invalidate();
}
内容来源于网络,如有侵权,请联系作者删除!