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

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

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

Array.peek介绍

[英]Returns the last item.
[中]返回最后一项。

代码示例

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

public static Rectangle peekScissors () {
  return scissors.peek();
}

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

public static Rectangle peekScissors () {
  return scissors.peek();
}

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

private void endRow () {
  Array<Cell> cells = this.cells;
  int rowColumns = 0;
  for (int i = cells.size - 1; i >= 0; i--) {
    Cell cell = cells.get(i);
    if (cell.endRow) break;
    rowColumns += cell.colspan;
  }
  columns = Math.max(columns, rowColumns);
  rows++;
  cells.peek().endRow = true;
}

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

private void endRow () {
  Array<Cell> cells = this.cells;
  int rowColumns = 0;
  for (int i = cells.size - 1; i >= 0; i--) {
    Cell cell = cells.get(i);
    if (cell.endRow) break;
    rowColumns += cell.colspan;
  }
  columns = Math.max(columns, rowColumns);
  rows++;
  cells.peek().endRow = true;
}

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

protected void close () {
  root = elements.pop();
  current = elements.size > 0 ? elements.peek() : null;
}

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

protected void close () {
  root = elements.pop();
  current = elements.size > 0 ? elements.peek() : null;
}

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

public JsonWriter pop () throws IOException {
  if (named) throw new IllegalStateException("Expected an object, array, or value since a name was set.");
  stack.pop().close();
  current = stack.size == 0 ? null : stack.peek();
  return this;
}

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

public JsonWriter pop () throws IOException {
  if (named) throw new IllegalStateException("Expected an object, array, or value since a name was set.");
  stack.pop().close();
  current = stack.size == 0 ? null : stack.peek();
  return this;
}

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

/** Adjusts the xadvance of the last glyph to use its width instead of xadvance. */
private void adjustLastGlyph (BitmapFontData fontData, GlyphRun run) {
  Glyph last = run.glyphs.peek();
  if (last.fixedWidth) return;
  float width = (last.width + last.xoffset) * fontData.scaleX - fontData.padRight;
  run.width += width - run.xAdvances.peek(); // Can cause the run width to be > targetWidth, but the problem is minimal.
  run.xAdvances.set(run.xAdvances.size - 1, width);
}

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

/** Adjusts the xadvance of the last glyph to use its width instead of xadvance. */
private void adjustLastGlyph (BitmapFontData fontData, GlyphRun run) {
  Glyph last = run.glyphs.peek();
  if (last.fixedWidth) return;
  float width = (last.width + last.xoffset) * fontData.scaleX - fontData.padRight;
  run.width += width - run.xAdvances.peek(); // Can cause the run width to be > targetWidth, but the problem is minimal.
  run.xAdvances.set(run.xAdvances.size - 1, width);
}

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

protected void pop () {
  root = elements.pop();
  if (current.size > 0) lastChild.pop();
  current = elements.size > 0 ? elements.peek() : null;
}

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

protected void pop () {
  root = elements.pop();
  if (current.size > 0) lastChild.pop();
  current = elements.size > 0 ? elements.peek() : null;
}

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

protected UBJsonWriter pop (boolean silent) throws IOException {
  if (named) throw new IllegalStateException("Expected an object, array, or value since a name was set.");
  if (silent)
    stack.pop();
  else
    stack.pop().close();
  current = stack.size == 0 ? null : stack.peek();
  return this;
}

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

protected UBJsonWriter pop (boolean silent) throws IOException {
  if (named) throw new IllegalStateException("Expected an object, array, or value since a name was set.");
  if (silent)
    stack.pop();
  else
    stack.pop().close();
  current = stack.size == 0 ? null : stack.peek();
  return this;
}

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

/** Pops the current scissor rectangle from the stack and sets the new scissor area to the new top of stack rectangle. In case
 * no more rectangles are on the stack, {@link GL20#GL_SCISSOR_TEST} is disabled.
 * <p>
 * Any drawing should be flushed before popping scissors. */
public static Rectangle popScissors () {
  Rectangle old = scissors.pop();
  if (scissors.size == 0)
    Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST);
  else {
    Rectangle scissor = scissors.peek();
    HdpiUtils.glScissor((int)scissor.x, (int)scissor.y, (int)scissor.width, (int)scissor.height);
  }
  return old;
}

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

/** Pops the current scissor rectangle from the stack and sets the new scissor area to the new top of stack rectangle. In case
 * no more rectangles are on the stack, {@link GL20#GL_SCISSOR_TEST} is disabled.
 * <p>
 * Any drawing should be flushed before popping scissors. */
public static Rectangle popScissors () {
  Rectangle old = scissors.pop();
  if (scissors.size == 0)
    Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST);
  else {
    Rectangle scissor = scissors.peek();
    HdpiUtils.glScissor((int)scissor.x, (int)scissor.y, (int)scissor.width, (int)scissor.height);
  }
  return old;
}

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

/** @return the current viewport in OpenGL ES window coordinates based on the currently applied scissor */
  public static Rectangle getViewport () {
    if (scissors.size == 0) {
      viewport.set(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      return viewport;
    } else {
      Rectangle scissor = scissors.peek();
      viewport.set(scissor);
      return viewport;
    }
  }
}

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

/** @return the current viewport in OpenGL ES window coordinates based on the currently applied scissor */
  public static Rectangle getViewport () {
    if (scissors.size == 0) {
      viewport.set(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      return viewport;
    } else {
      Rectangle scissor = scissors.peek();
      viewport.set(scissor);
      return viewport;
    }
  }
}

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

/** Indicates that subsequent cells should be added to a new row and returns the cell values that will be used as the defaults
 * for all cells in the new row. */
public Cell row () {
  if (cells.size > 0) {
    if (!implicitEndRow) {
      if (cells.peek().endRow) return rowDefaults; // Row was already ended.
      endRow();
    }
    invalidate();
  }
  implicitEndRow = false;
  if (rowDefaults != null) cellPool.free(rowDefaults);
  rowDefaults = obtainCell();
  rowDefaults.clear();
  return rowDefaults;
}

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

/** Indicates that subsequent cells should be added to a new row and returns the cell values that will be used as the defaults
 * for all cells in the new row. */
public Cell row () {
  if (cells.size > 0) {
    if (!implicitEndRow) {
      if (cells.peek().endRow) return rowDefaults; // Row was already ended.
      endRow();
    }
    invalidate();
  }
  implicitEndRow = false;
  if (rowDefaults != null) cellPool.free(rowDefaults);
  rowDefaults = obtainCell();
  rowDefaults.clear();
  return rowDefaults;
}

相关文章