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

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

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

Array.contains介绍

[英]Returns if this array contains value.
[中]如果此数组包含值,则返回。

代码示例

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

public static boolean isUnsafeByteBuffer (ByteBuffer buffer) {
  synchronized (unsafeBuffers) {
    return unsafeBuffers.contains(buffer, true);
  }
}

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

public static boolean isUnsafeByteBuffer (ByteBuffer buffer) {
  synchronized (unsafeBuffers) {
    return unsafeBuffers.contains(buffer, true);
  }
}

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

@Override
public boolean supportsExtension (String extension) {
  return extensions.contains(extension, false);
}

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

private static boolean supportsFBO () {
  // FBO is in core since OpenGL 3.0, see https://www.opengl.org/wiki/Framebuffer_Object
  return glVersion.isVersionEqualToOrHigher(3, 0) || extensions.contains("GL_EXT_framebuffer_object", false)
    || extensions.contains("GL_ARB_framebuffer_object", false);
}

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

private static boolean supportsFBO () {
  // FBO is in core since OpenGL 3.0, see https://www.opengl.org/wiki/Framebuffer_Object
  return glVersion.isVersionEqualToOrHigher(3, 0) || extensions.contains("GL_EXT_framebuffer_object", false)
    || extensions.contains("GL_ARB_framebuffer_object", false);
}

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

/** Adds a {@link Disposable} to be managed and disposed by this Model. Can be used to keep track of manually loaded textures
 * for {@link ModelInstance}.
 * @param disposable the Disposable */
public void manageDisposable (Disposable disposable) {
  if (!disposables.contains(disposable, true)) disposables.add(disposable);
}

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

/** @return whether the supported OpenGL (not ES) version is compatible with OpenGL ES 2.x. */
private static boolean fullCompatibleWithGLES2 () {
  // OpenGL ES 2.0 is compatible with OpenGL 4.1 core
  // see https://www.opengl.org/registry/specs/ARB/ES2_compatibility.txt
  return glVersion.isVersionEqualToOrHigher(4, 1) || extensions.contains("GL_ARB_ES2_compatibility", false);
}

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

/** Adds a {@link Disposable} to be managed and disposed by this Model. Can be used to keep track of manually loaded textures
 * for {@link ModelInstance}.
 * @param disposable the Disposable */
public void manageDisposable (Disposable disposable) {
  if (!disposables.contains(disposable, true)) disposables.add(disposable);
}

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

/** @return whether the supported OpenGL (not ES) version is compatible with OpenGL ES 2.x. */
private static boolean fullCompatibleWithGLES2 () {
  // OpenGL ES 2.0 is compatible with OpenGL 4.1 core
  // see https://www.opengl.org/registry/specs/ARB/ES2_compatibility.txt
  return glVersion.isVersionEqualToOrHigher(4, 1) || extensions.contains("GL_ARB_ES2_compatibility", false);
}

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

public void setRandomPos () {
  float max = 100;
  this.pos.x = -max + MathUtils.random(max * 2);
  this.pos.y = -max + MathUtils.random(max * 2);
  float xShift = 100;
  if (player.contains(this, true)) {
    this.pos.x -= xShift;
  } else if (enemy.contains(this, true)) {
    this.pos.x += xShift;
  } else {
    throw new RuntimeException("unhandled");
  }
}

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

/** Starts the timer if it was stopped. */
public void start () {
  synchronized (threadLock) {
    TimerThread thread = thread();
    Array<Timer> instances = thread.instances;
    if (instances.contains(this, true)) return;
    instances.add(this);
    threadLock.notifyAll();
  }
}

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

/** Starts the timer if it was stopped. */
public void start () {
  synchronized (threadLock) {
    TimerThread thread = thread();
    Array<Timer> instances = thread.instances;
    if (instances.contains(this, true)) return;
    instances.add(this);
    threadLock.notifyAll();
  }
}

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

private static void rebuildReferences (final Model model, final Node node) {
  for (final NodePart mpm : node.parts) {
    if (!model.materials.contains(mpm.material, true)) model.materials.add(mpm.material);
    if (!model.meshParts.contains(mpm.meshPart, true)) {
      model.meshParts.add(mpm.meshPart);
      if (!model.meshes.contains(mpm.meshPart.mesh, true)) model.meshes.add(mpm.meshPart.mesh);
      model.manageDisposable(mpm.meshPart.mesh);
    }
  }
  for (final Node child : node.getChildren())
    rebuildReferences(model, child);
}

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

private static void rebuildReferences (final Model model, final Node node) {
  for (final NodePart mpm : node.parts) {
    if (!model.materials.contains(mpm.material, true)) model.materials.add(mpm.material);
    if (!model.meshParts.contains(mpm.meshPart, true)) {
      model.meshParts.add(mpm.meshPart);
      if (!model.meshes.contains(mpm.meshPart.mesh, true)) model.meshes.add(mpm.meshPart.mesh);
      model.manageDisposable(mpm.meshPart.mesh);
    }
  }
  for (final Node child : node.getChildren())
    rebuildReferences(model, child);
}

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

public void addConstructor (final String name, final Constructor<T> constructor) {
  constructors.put(name, constructor);
  if (constructor.model != null && !models.contains(constructor.model, true)) models.add(constructor.model);
}

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

/** Sets the selection to only the passed item, if it is a possible choice, else selects the first item. */
public void setSelected (T item) {
  if (items.contains(item, false))
    selection.set(item);
  else if (items.size > 0)
    selection.set(items.first());
  else
    selection.clear();
}

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

/** Sets the selection to only the passed item, if it is a possible choice, else selects the first item. */
public void setSelected (T item) {
  if (items.contains(item, false))
    selection.set(item);
  else if (items.size > 0)
    selection.set(items.first());
  else
    selection.clear();
}

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

@Override
  public float addSingleResult (btManifoldPoint cp, btCollisionObjectWrapper colObj0Wrap, int partId0, int index0,
    btCollisionObjectWrapper colObj1Wrap, int partId1, int index1) {
    btCollisionObject other = colObj0Wrap.getCollisionObject() == projectile.body ? colObj1Wrap.getCollisionObject()
      : colObj0Wrap.getCollisionObject();
    if (other != null && other.userData != null && other.userData instanceof BulletEntity) {
      BulletEntity ent = (BulletEntity)other.userData;
      if (ent != ground && !hits.contains(ent, true)) hits.add((BulletEntity)other.userData);
    }
    return 0f;
  }
}

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

/** Sets the selection to only the passed item, if it is a possible choice.
 * @param item May be null. */
public void setSelected (T item) {
  if (items.contains(item, false))
    selection.set(item);
  else if (selection.getRequired() && items.size > 0)
    selection.set(items.first());
  else
    selection.clear();
}

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

/** Sets the selection to only the passed item, if it is a possible choice.
 * @param item May be null. */
public void setSelected (T item) {
  if (items.contains(item, false))
    selection.set(item);
  else if (selection.getRequired() && items.size > 0)
    selection.set(items.first());
  else
    selection.clear();
}

相关文章