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


Java FloatArray.add方法代码示例

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


在下文中一共展示了FloatArray.add方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readVertices

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
private Vertices readVertices (DataInput input, int vertexCount) throws IOException {
	int verticesLength = vertexCount << 1;
	Vertices vertices = new Vertices();
	if (!input.readBoolean()) {
		vertices.vertices = readFloatArray(input, verticesLength, scale);
		return vertices;
	}
	FloatArray weights = new FloatArray(verticesLength * 3 * 3);
	IntArray bonesArray = new IntArray(verticesLength * 3);
	for (int i = 0; i < vertexCount; i++) {
		int boneCount = input.readInt(true);
		bonesArray.add(boneCount);
		for (int ii = 0; ii < boneCount; ii++) {
			bonesArray.add(input.readInt(true));
			weights.add(input.readFloat() * scale);
			weights.add(input.readFloat() * scale);
			weights.add(input.readFloat());
		}
	}
	vertices.vertices = weights.toArray();
	vertices.bones = bonesArray.toArray();
	return vertices;
}
 
开发者ID:laurencegw,项目名称:jenjin,代码行数:24,代码来源:SkeletonBinary.java

示例2: readVertices

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
private void readVertices (JsonValue map, VertexAttachment attachment, int verticesLength) {
	attachment.setWorldVerticesLength(verticesLength);
	float[] vertices = map.require("vertices").asFloatArray();
	if (verticesLength == vertices.length) {
		if (scale != 1) {
			for (int i = 0, n = vertices.length; i < n; i++)
				vertices[i] *= scale;
		}
		attachment.setVertices(vertices);
		return;
	}
	FloatArray weights = new FloatArray(verticesLength * 3 * 3);
	IntArray bones = new IntArray(verticesLength * 3);
	for (int i = 0, n = vertices.length; i < n;) {
		int boneCount = (int)vertices[i++];
		bones.add(boneCount);
		for (int nn = i + boneCount * 4; i < nn; i += 4) {
			bones.add((int)vertices[i]);
			weights.add(vertices[i + 1] * scale);
			weights.add(vertices[i + 2] * scale);
			weights.add(vertices[i + 3]);
		}
	}
	attachment.setBones(bones.toArray());
	attachment.setVertices(weights.toArray());
}
 
开发者ID:laurencegw,项目名称:jenjin,代码行数:27,代码来源:SkeletonJson.java

示例3: 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

示例4: 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

示例5: calculateTimes

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
/**
 * Calculates the travel time of each segment to allow for 
 * smooth lerping along the path between 0 and 1
 */
private void calculateTimes()
{
	//find total length of the path
	float length = 0, dst = 0;
	for (int i = 1; i < points.size; i++)
	{
		dst = points.get(i).dst(points.get(i-1));
		length += dst;
	}
	
	//calculate percentage that each segment takes of the path's total length
	times = new FloatArray();
	times.add(0);
	float l = 0;
	for (int i = 1; i < points.size; i++)
	{
		dst = points.get(i).dst(points.get(i-1));
		l += dst;
		times.add(l/length);
	}
}
 
开发者ID:nhydock,项目名称:gdx-artemis,代码行数:26,代码来源:PolyPath.java

示例6: read

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
@Override
public FloatArray read(Kryo kryo, Input input, Class<FloatArray> type) {
    int length = input.readVarInt(true);
    boolean ordered = input.readBoolean();
    FloatArray array = new FloatArray(ordered, length);
    for (int i = 0; i < length; i++) {
        array.add(input.readFloat());
    }
    return array;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:11,代码来源:FloatArraySerializer.java

示例7: resize

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
/**
 * Resizes list to exact size, filling with given value when expanding.
 */
public static void resize(FloatArray list, int size, float value) {
	while (list.size < size) {
		list.add(value);
	}
	
	while (list.size > size) {
		list.removeIndex(list.size - 1);
	}
}
 
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:13,代码来源:MiscUtil.java

示例8: generateNewPoints

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
private void generateNewPoints(int numPoints) {
	int pad = 200;//distance away from edge of screen
	points = new FloatArray();
	for (int i = 0; i < numPoints*2; i+=2) {
		float x = MathUtils.random(pad, Gdx.graphics.getWidth()-pad);
		float y = MathUtils.random(pad, Gdx.graphics.getHeight()-pad);
		points.add(x);
		points.add(y);
	}
	//create cells out of points
	calculateDelaunay();
}
 
开发者ID:0XDE57,项目名称:SpaceProject,代码行数:13,代码来源:TestVoronoiScreen.java

示例9: toArray

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
/** Returns a new array containing the remaining keys. */
public FloatArray toArray () {
	FloatArray array = new FloatArray(true, map.size);
	while (hasNext)
		array.add(next());
	return array;
}
 
开发者ID:0x0ade,项目名称:shadow-engine,代码行数:8,代码来源:FloatMap.java

示例10: getRoomCenterPoints

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
private float[] getRoomCenterPoints(Array<GameCell> cells) {

        Gdx.app.log("GraphGenerator", "      --> Getting rooms center points");

        int cellCount = cells.size;
        FloatArray points = new FloatArray(cellCount);
        Vector2 cellCenter = new Vector2();

        for (int i = 0; i < cellCount; i++) {
            GameCell cell = cells.get(i);

            if (!(cell instanceof GameRoom)) continue;

            cell.getCenter(cellCenter);

            points.add(cellCenter.x);
            points.add(cellCenter.y);
        }

        points.shrink();
        return points.items;
    }
 
开发者ID:LeonardBesson,项目名称:DunGen,代码行数:23,代码来源:GraphGenerator.java

示例11: create

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
public void create() {
	final PlayerResource resource = getMainController().getPlayerResource();

	setSound(SOUND_CLEAR, "course_clear.wav", SoundType.SOUND,false);
	setSound(SOUND_FAIL, "course_fail.wav", SoundType.SOUND, false);
	setSound(SOUND_CLOSE, "course_close.wav", SoundType.SOUND, false);

	loadSkin(SkinType.COURSE_RESULT);

       for(int i = resource.getCourseGauge().size();i < resource.getCourseBMSModels().length;i++) {
       	FloatArray list = new FloatArray();
           for(int l = 0;l < (resource.getCourseBMSModels()[i].getLastNoteTime() + 500) / 500;l++) {
               list.add(0f);
           }
           resource.getCourseGauge().add(list);
       }

	property = ResultKeyProperty.get(resource.getBMSModel().getMode());
	if(property == null) {
		property = ResultKeyProperty.BEAT_7K;
	}

	updateScoreDatabase();

	// リプレイの自動保存
	if(resource.getAutoplay() == 0){
		for(int i=0;i<replay;i++){
			/*
			 * コンフィグ値:0=保存しない 1=スコア更新時 2=スコアが自己ベスト以上 3=BP更新時 4=BPが自己ベスト以下
			 * 5=COMBO更新時 6=COMBOが自己ベスト以上 7=ランプ更新時 8=ランプが自己ベスト以上 9=何か更新した時 10=毎回
			 */
			switch(resource.getConfig().getAutoSaveReplay()[i]){
			case 0:
				break;
			case 1:
				if(newscore.getExscore() > oldexscore)
					saveReplayData(i);
				break;
			case 2:
				if(newscore.getExscore() >= oldexscore)
					saveReplayData(i);
				break;
			case 3:
				if(newscore.getMinbp() < oldmisscount || oldclear == NoPlay.id)
					saveReplayData(i);
				break;
			case 4:
				if(newscore.getMinbp() <= oldmisscount || oldclear == NoPlay.id)
					saveReplayData(i);
				break;
			case 5:
				if(newscore.getCombo() > oldcombo)
					saveReplayData(i);
				break;
			case 6:
				if(newscore.getCombo() >= oldcombo)
					saveReplayData(i);
				break;
			case 7:
				if(newscore.getClear() > oldclear)
					saveReplayData(i);
				break;
			case 8:
				if(newscore.getClear() >= oldclear)
					saveReplayData(i);
				break;
			case 9:
				if(newscore.getClear() > oldclear || newscore.getCombo() > oldcombo||
					newscore.getMinbp() < oldmisscount || newscore.getExscore() > oldexscore)
					saveReplayData(i);
				break;
			case 10:
					saveReplayData(i);
				break;
			}
		}
	}
}
 
开发者ID:exch-bms2,项目名称:beatoraja,代码行数:79,代码来源:CourseResult.java

示例12: getVertexData

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
public void getVertexData(FloatArray vert) {
	boolean zDir = dir == Direction.WEST || dir == Direction.EAST;
	boolean yDir = dir == Direction.UP || dir == Direction.DOWN;
	
	float tx = (float) Math.ceil(zDir ? sizeX : yDir ? sizeX : sizeZ);
	float ty = (float) Math.ceil(yDir ? sizeZ : sizeY);
	
	float b = Color.toFloatBits(1f, 1f, 1f, 1f);
	
	vert.add(tl.x + pos.x);
	vert.add(tl.y + pos.y);
	vert.add(tl.z + pos.z);
	vert.add(n.x);
	vert.add(n.y);
	vert.add(n.z);
	vert.add(b);
	vert.add(tex.x);
	vert.add(tex.y);
	vert.add(tx);
	vert.add(ty);
	
	vert.add(tr.x + pos.x);
	vert.add(tr.y + pos.y);
	vert.add(tr.z + pos.z);
	vert.add(n.x);
	vert.add(n.y);
	vert.add(n.z);
	vert.add(b);
	vert.add(tex.x + texWidth);
	vert.add(tex.y);
	vert.add(tx);
	vert.add(ty);
	
	vert.add(br.x + pos.x);
	vert.add(br.y + pos.y);
	vert.add(br.z + pos.z);
	vert.add(n.x);
	vert.add(n.y);
	vert.add(n.z);
	vert.add(b);
	vert.add(tex.x + texWidth);
	vert.add(tex.y + texHeight);
	vert.add(tx);
	vert.add(ty);
	
	vert.add(bl.x + pos.x);
	vert.add(bl.y + pos.y);
	vert.add(bl.z + pos.z);
	vert.add(n.x);
	vert.add(n.y);
	vert.add(n.z);
	vert.add(b);
	vert.add(tex.x);
	vert.add(tex.y + texHeight);
	vert.add(tx);
	vert.add(ty);
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:58,代码来源:TextureFace.java

示例13: 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.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。