当前位置: 首页>>代码示例>>Java>>正文


Java FloatArray.clear方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.FloatArray.clear方法的典型用法代码示例。如果您正苦于以下问题:Java FloatArray.clear方法的具体用法?Java FloatArray.clear怎么用?Java FloatArray.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.FloatArray的用法示例。


在下文中一共展示了FloatArray.clear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:23,代码来源:HDRData.java

示例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);
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:17,代码来源:RavChainLight.java

示例3: intersectSegments

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
/** @param segments the segments
 *  @param polygon if the segments represent a closed polygon
 *  @param intersections the array to store the intersections in */
public static void intersectSegments(float x1, float y1, float x2, float y2, float[] segments, boolean polygon, FloatArray intersections) {
    if(polygon && segments.length < 6)
        throw new IllegalArgumentException("a polygon consists of at least 3 points: " + segments.length);
    else if(segments.length < 4)
        throw new IllegalArgumentException("segments does not contain enough vertices to represent at least one segment: " + segments.length);
    if(segments.length % 2 != 0)
        throw new IllegalArgumentException("malformed segments; the number of vertices is not dividable by 2: " + segments.length);
    intersections.clear();
    Vector2 tmp = Pools.obtain(Vector2.class);
    for(int i = 0, n = segments.length - (polygon ? 0 : 2); i < n; i += 2) {
        float x3 = segments[i], y3 = segments[i + 1], x4 = wrapIndex(i + 2, segments), y4 = wrapIndex(i + 3, segments);
        if(Intersector.intersectSegments(x1, y1, x2, y2, x3, y3, x4, y4, tmp)) {
            intersections.add(tmp.x);
            intersections.add(tmp.y);
        }
    }
    Pools.free(tmp);
}
 
开发者ID:lukz,项目名称:Simple-Isometric-Game,代码行数:22,代码来源:GeometryUtils.java

示例4: 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);
}
 
开发者ID:bitbrain,项目名称:rbcgj-2016,代码行数:17,代码来源:ChainLight.java

示例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;
}
 
开发者ID:bitbrain,项目名称:rbcgj-2016,代码行数:32,代码来源:ChainLight.java

示例6: 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;
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:31,代码来源:RavChainLight.java

示例7: computeGlyphAdvancesAndPositions

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
public void computeGlyphAdvancesAndPositions(CharSequence paramCharSequence, FloatArray paramFloatArray1, FloatArray paramFloatArray2)
{
  paramFloatArray1.clear();
  paramFloatArray2.clear();
  int i = paramCharSequence.length();
  Object localObject1 = null;
  float f5;
  int k;
  Object localObject3;
  if (this.data.scaleX == 1.0F)
  {
    f5 = 0.0F;
    k = 0;
    if (k < i)
    {
      char c2 = paramCharSequence.charAt(k);
      localObject3 = this.data.getGlyph(c2);
      if (localObject3 == null)
        break label277;
      if (localObject1 != null)
        f5 += localObject1.getKerning(c2);
      paramFloatArray1.add(((BitmapFont.Glyph)localObject3).xadvance);
      paramFloatArray2.add(f5);
    }
  }
  for (float f6 = f5 + ((BitmapFont.Glyph)localObject3).xadvance; ; f6 = f5)
  {
    k++;
    f5 = f6;
    localObject1 = localObject3;
    break;
    paramFloatArray1.add(0.0F);
    paramFloatArray2.add(f5);
    return;
    float f1 = this.data.scaleX;
    float f2 = 0.0F;
    int j = 0;
    Object localObject2;
    float f4;
    if (j < i)
    {
      char c1 = paramCharSequence.charAt(j);
      localObject2 = this.data.getGlyph(c1);
      if (localObject2 == null)
        break label266;
      if (localObject1 != null)
        f2 += f1 * localObject1.getKerning(c1);
      f4 = f1 * ((BitmapFont.Glyph)localObject2).xadvance;
      paramFloatArray1.add(f4);
      paramFloatArray2.add(f2);
    }
    for (float f3 = f4 + f2; ; f3 = f2)
    {
      j++;
      f2 = f3;
      localObject1 = localObject2;
      break;
      paramFloatArray1.add(0.0F);
      paramFloatArray2.add(f2);
      return;
      label266: localObject2 = localObject1;
    }
    label277: localObject3 = localObject1;
  }
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:66,代码来源:BitmapFont.java


注:本文中的com.badlogic.gdx.utils.FloatArray.clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。