本文整理汇总了Java中com.badlogic.gdx.utils.FloatArray.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java FloatArray.addAll方法的具体用法?Java FloatArray.addAll怎么用?Java FloatArray.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.FloatArray
的用法示例。
在下文中一共展示了FloatArray.addAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFlatPixelArray
import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
public float[] getFlatPixelArray() {
FloatArray floats = new FloatArray();
flatPixelArray = new float[width * height * 3];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
float r = pixels[y][x][0];
float g = pixels[y][x][1];
float b = pixels[y][x][2];
floats.addAll(r, g, b);
}
}
for (int i = 0; i < floats.size; i++) {
flatPixelArray[i] = floats.get(i);
}
floats.clear();
return flatPixelArray;
}
示例2: debugRender
import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
/** Draws a polygon, using ray start and end points as vertices */
public void debugRender (PolygonShapeRenderer shapeRenderer) {
shapeRenderer.setColor(Color.BLUE);
FloatArray vertices = Pools.obtain(FloatArray.class);
vertices.clear();
for (int i = 0; i < rayNum; i++) {
vertices.addAll(mx[i], my[i]);
}
for (int i = rayNum - 1; i > -1; i--) {
vertices.addAll(startX[i], startY[i]);
}
vertices.add(vertices.get(0));
vertices.add(vertices.get(1));
shapeRenderer.polyline(vertices.shrink());
Pools.free(vertices);
}
示例3: debugRender
import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
/**
* Draws a polygon, using ray start and end points as vertices
*/
public void debugRender(ShapeRenderer shapeRenderer) {
shapeRenderer.setColor(Color.YELLOW);
FloatArray vertices = Pools.obtain(FloatArray.class);
vertices.clear();
for (int i = 0; i < rayNum; i++) {
vertices.addAll(mx[i], my[i]);
}
for (int i = rayNum - 1; i > -1; i--) {
vertices.addAll(startX[i], startY[i]);
}
shapeRenderer.polygon(vertices.shrink());
Pools.free(vertices);
}
示例4: contains
import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
@Override
public boolean contains(float x, float y) {
// fast fail
if (!this.chainLightBounds.contains(x, y))
return false;
// actual check
FloatArray vertices = Pools.obtain(FloatArray.class);
vertices.clear();
for (int i = 0; i < rayNum; i++) {
vertices.addAll(mx[i], my[i]);
}
for (int i = rayNum - 1; i > -1; i--) {
vertices.addAll(startX[i], startY[i]);
}
int intersects = 0;
for (int i = 0; i < vertices.size; i += 2) {
float x1 = vertices.items[i];
float y1 = vertices.items[i + 1];
float x2 = vertices.items[(i + 2) % vertices.size];
float y2 = vertices.items[(i + 3) % vertices.size];
if (((y1 <= y && y < y2) || (y2 <= y && y < y1)) &&
x < ((x2 - x1) / (y2 - y1) * (y - y1) + x1))
intersects++;
}
boolean result = (intersects & 1) == 1;
Pools.free(vertices);
return result;
}
示例5: contains
import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
@Override
public boolean contains (float x, float y) {
// fast fail
if (!this.chainLightBounds.contains(x, y))
return false;
// actual check
FloatArray vertices = Pools.obtain(FloatArray.class);
vertices.clear();
for (int i = 0; i < rayNum; i++) {
vertices.addAll(mx[i], my[i]);
}
for (int i = rayNum - 1; i > -1; i--) {
vertices.addAll(startX[i], startY[i]);
}
int intersects = 0;
for (int i = 0; i < vertices.size; i += 2) {
float x1 = vertices.items[i];
float y1 = vertices.items[i + 1];
float x2 = vertices.items[(i + 2) % vertices.size];
float y2 = vertices.items[(i + 3) % vertices.size];
if (((y1 <= y && y < y2) || (y2 <= y && y < y1)) && x < ((x2 - x1) / (y2 - y1) * (y - y1) + x1))
intersects++;
}
boolean result = (intersects & 1) == 1;
Pools.free(vertices);
return result;
}