com.badlogic.gdx.utils.Array.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中com.badlogic.gdx.utils.Array.<init>()方法的一些代码示例,展示了Array.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array.<init>()方法的具体详情如下:
包路径:com.badlogic.gdx.utils.Array
类名称:Array
方法名:<init>

Array.<init>介绍

[英]Creates an ordered array with a capacity of 16.
[中]创建容量为16的有序阵列。

代码示例

代码示例来源:origin: stackoverflow.com

var a = [],            // these are the same
  b = new Array(),   // a and b are arrays with length 0

  c = ['foo', 'bar'],           // these are the same
  d = new Array('foo', 'bar'),  // c and d are arrays with 2 strings

  // these are different:
  e = [3]             // e.length == 1, e[0] == 3
  f = new Array(3),   // f.length == 3, f[0] == undefined

;

代码示例来源:origin: stackoverflow.com

function Array() {
  this.is = 'SPARTA';
}

var a = new Array();
var b = [];

alert(a.is);  // => 'SPARTA'
alert(b.is);  // => undefined
a.push('Woa'); // => TypeError: a.push is not a function
b.push('Woa'); // => 1 (OK)

代码示例来源:origin: libgdx/libgdx

@Override
  protected Array<Decal> newObject () {
    return new Array();
  }
};

代码示例来源:origin: libgdx/libgdx

private static void addManagedFrameBuffer (Application app, GLFrameBuffer frameBuffer) {
  Array<GLFrameBuffer> managedResources = buffers.get(app);
  if (managedResources == null) managedResources = new Array<GLFrameBuffer>();
  managedResources.add(frameBuffer);
  buffers.put(app, managedResources);
}

代码示例来源:origin: libgdx/libgdx

/** @param type
 * @return array with all the layers matching type */
public <T extends MapLayer> Array<T> getByType (Class<T> type) {
  return getByType(type, new Array<T>());
}

代码示例来源: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

/** Returns a new array containing the remaining keys. */
public Array<K> toArray () {
  Array array = new Array(true, map.size);
  while (hasNext)
    array.add(next());
  return array;
}

代码示例来源:origin: libgdx/libgdx

/** Returns a new array containing the remaining values. */
public Array<V> toArray () {
  Array array = new Array(true, map.size);
  while (hasNext)
    array.add(next());
  return array;
}

代码示例来源:origin: libgdx/libgdx

public DynamicsInfluencerPanel (FlameMain editor, DynamicsInfluencer influencer) {
  super(editor, influencer, "Dynamics Influencer", 
            "Defines how the particles dynamics (acceleration, angular velocity).");
  velocities = new Array<VelocityWrapper>();
  setValue(value);
  set(influencer);
}

代码示例来源:origin: libgdx/libgdx

/** Returns a new array containing the remaining keys. */
public Array<K> toArray () {
  Array array = new Array(true, map.size);
  while (hasNext)
    array.add(next());
  return array;
}

代码示例来源:origin: libgdx/libgdx

public FileHandle[] list (String url, FileFilter filter) {
  Array<FileHandle> files = new Array<FileHandle>();
  for (String path : texts.keys()) {
    if (isChild(path, url) && filter.accept(new File(path))) {
      files.add(new GwtFileHandle(this, path, FileType.Internal));
    }
  }
  FileHandle[] list = new FileHandle[files.size];
  System.arraycopy(files.items, 0, list, 0, list.length);
  return list;
}

代码示例来源: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 FileHandle[] list (String url, String suffix) {
  Array<FileHandle> files = new Array<FileHandle>();
  for (String path : texts.keys()) {
    if (isChild(path, url) && path.endsWith(suffix)) {
      files.add(new GwtFileHandle(this, path, FileType.Internal));
    }
  }
  FileHandle[] list = new FileHandle[files.size];
  System.arraycopy(files.items, 0, list, 0, list.length);
  return list;
}

代码示例来源:origin: libgdx/libgdx

/** Returns all regions in the atlas as sprites. This method creates a new sprite for each region, so the result should be
 * stored rather than calling this method multiple times.
 * @see #createSprite(String) */
public Array<Sprite> createSprites () {
  Array sprites = new Array(true, regions.size, Sprite.class);
  for (int i = 0, n = regions.size; i < n; i++)
    sprites.add(newSprite(regions.get(i)));
  return sprites;
}

代码示例来源:origin: libgdx/libgdx

private void addManagedShader (Application app, ShaderProgram shaderProgram) {
  Array<ShaderProgram> managedResources = shaders.get(app);
  if (managedResources == null) managedResources = new Array<ShaderProgram>();
  managedResources.add(shaderProgram);
  shaders.put(app, managedResources);
}

代码示例来源:origin: libgdx/libgdx

public TextureAtlas getAtlas(Texture texture){
  Array<TextureAtlas> atlases = assetManager.getAll(TextureAtlas.class, new Array<TextureAtlas>());
  for(TextureAtlas atlas : atlases){
    if(atlas.getTextures().contains(texture))
      return atlas;
  }
  return null;
}

代码示例来源:origin: libgdx/libgdx

@Override
  public void actionPerformed (ActionEvent e) {
    final ParticleEmitter emitter = editor.getEmitter();
    emitter.setImagePaths(new Array<String>(new String[] { ParticleEditor.DEFAULT_PARTICLE }));
    emitter.getSprites().clear();
    updateImageList(emitter.getImagePaths());
  }
});

代码示例来源:origin: libgdx/libgdx

@Override
  public void actionPerformed (ActionEvent e) {
    final ParticleEmitter emitter = editor.getEmitter();
    emitter.setImagePaths(new Array<String>(new String[] { ParticleEditor.DEFAULT_PREMULT_PARTICLE }));
    emitter.getSprites().clear();
    updateImageList(emitter.getImagePaths());
  }
});

代码示例来源:origin: libgdx/libgdx

public static void convert (String input, String output, boolean genMipmaps, boolean packETC1, boolean genAlphaAtlas)
  throws Exception {
  Array<String> opts = new Array<String>(String.class);
  opts.add(input);
  opts.add(output);
  if (genMipmaps) opts.add("-mipmaps");
  if (packETC1 && !genAlphaAtlas) opts.add("-etc1");
  if (packETC1 && genAlphaAtlas) opts.add("-etc1a");
  main(opts.toArray());
}

代码示例来源:origin: libgdx/libgdx

static public Array<String> getViewportNames () {
  Array<String> names = new Array();
  names.add("StretchViewport");
  names.add("FillViewport");
  names.add("FitViewport");
  names.add("ExtendViewport: no max");
  names.add("ExtendViewport: max");
  names.add("ScreenViewport: 1:1");
  names.add("ScreenViewport: 0.75:1");
  names.add("ScalingViewport: none");
  return names;
}

相关文章