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


Java FloatArray.get方法代码示例

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


在下文中一共展示了FloatArray.get方法的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;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:23,代码来源:HDRData.java

示例2: ccw

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
/** Returns > 0 if the points are a counterclockwise turn, < 0 if clockwise, and 0 if colinear. */
private float ccw (float p3x, float p3y) {
	FloatArray hull = this.hull;
	int size = hull.size;
	float p1x = hull.get(size - 4);
	float p1y = hull.get(size - 3);
	float p2x = hull.get(size - 2);
	float p2y = hull.peek();
	return (p2x - p1x) * (p3y - p1y) - (p2y - p1y) * (p3x - p1x);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:11,代码来源:ConvexHull.java

示例3: addToCache

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
private void addToCache (GlyphLayout layout, float x, float y) {
//		y += 5f * font.getScaleY();
		// Check if the number of font pages has changed.
		int pageCount = font.regions.size;
		if (pageVertices.length < pageCount) {
			float[][] newPageVertices = new float[pageCount][];
			System.arraycopy(pageVertices, 0, newPageVertices, 0, pageVertices.length);
			pageVertices = newPageVertices;

			int[] newIdx = new int[pageCount];
			System.arraycopy(idx, 0, newIdx, 0, idx.length);
			idx = newIdx;

			IntArray[] newPageGlyphIndices = new IntArray[pageCount];
			int pageGlyphIndicesLength = 0;
			if (pageGlyphIndices != null) {
				pageGlyphIndicesLength = pageGlyphIndices.length;
				System.arraycopy(pageGlyphIndices, 0, newPageGlyphIndices, 0, pageGlyphIndices.length);
			}
			for (int i = pageGlyphIndicesLength; i < pageCount; i++)
				newPageGlyphIndices[i] = new IntArray();
			pageGlyphIndices = newPageGlyphIndices;

			tempGlyphCount = new int[pageCount];
		}

		layouts.add(layout);
		requireGlyphs(layout);
		for (int i = 0, n = layout.runs.size; i < n; i++) {
			GlyphRun run = layout.runs.get(i);
			Array<Glyph> glyphs = run.glyphs;
			FloatArray xAdvances = run.xAdvances;
			float color = run.color.toFloatBits();
			float gx = x + run.x, gy = y + run.y;
			for (int ii = 0, nn = glyphs.size; ii < nn; ii++) {
				Glyph glyph = glyphs.get(ii);
				gx += xAdvances.get(ii);
				addGlyph(glyph, gx, gy, color);
			}
		}

		currentTint = whiteTint; // Cached glyphs have changed, reset the current tint.
	}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:44,代码来源:BitmapFontCache.java

示例4: draw

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
public void draw(Batch batch, float dx, float dy, float visibleGlyphs) {
    if (visibleGlyphs == 0 || glyphLayout.runs.size == 0) {
        return; // Nothing to draw
    }

    applyScale();
    {
        if (visibleGlyphs < 0f || visibleGlyphs >= glyphCount) {
            // Text fully visible
            drawUnderline(batch, glyphLayout, dx, dy);
            drawLayout(batch, glyphLayout, dx, dy);
        } else {
            // Text partially visible
            int visible = (int)visibleGlyphs;

            GlyphRun run = glyphLayout.runs.first();
            Array<Glyph> glyphs = run.glyphs;
            FloatArray xAdvances = run.xAdvances;

            Object[] oldGlyphs = glyphs.items;
            float[] oldXAdvances = xAdvances.items;
            int oldSize = glyphs.size;
            if (isRightToLeft()) {
                int invisible = oldSize - visible;
                for (int n = 0; n < invisible; n++) {
                    dx += xAdvances.get(n);
                }

                setGlyphs(glyphs, Arrays.copyOfRange(oldGlyphs, invisible, oldSize));
                xAdvances.items = Arrays.copyOfRange(oldXAdvances, invisible, xAdvances.size);
            }
            glyphs.size = visible;

            drawUnderline(batch, glyphLayout, dx, dy);
            drawLayout(batch, glyphLayout, dx, dy);

            if (isRightToLeft()) {
                setGlyphs(glyphs, oldGlyphs);
                xAdvances.items = oldXAdvances;
            }
            glyphs.size = oldSize;
        }
    }
    resetScale();
}
 
开发者ID:anonl,项目名称:gdx-styledtext,代码行数:46,代码来源:GdxTextElement.java

示例5: updateDisplayText

import com.badlogic.gdx.utils.FloatArray; //导入方法依赖的package包/类
void updateDisplayText() {
    BitmapFont font = style.font;
    BitmapFontData data = font.getData();
    String text = this.text;
    int textLength = text.length();

    StringBuilder buffer = new StringBuilder();
    for (int i = 0; i < textLength; i++) {
        char c = text.charAt(i);
        buffer.append(data.hasGlyph(c) ? c : ' ');
    }
    String newDisplayText = buffer.toString();

    if (passwordMode && data.hasGlyph(passwordCharacter)) {
        if (passwordBuffer == null)
            passwordBuffer = new StringBuilder(newDisplayText.length());
        if (passwordBuffer.length() > textLength)
            passwordBuffer.setLength(textLength);
        else {
            for (int i = passwordBuffer.length(); i < textLength; i++)
                passwordBuffer.append(passwordCharacter);
        }
        displayText = passwordBuffer;
    } else
        displayText = newDisplayText;

    layout.setText(font, displayText);
    glyphPositions.clear();
    float x = 0;
    if (layout.runs.size > 0) {
        GlyphRun run = layout.runs.first();
        FloatArray xAdvances = run.xAdvances;
        fontOffset = xAdvances.first();
        for (int i = 1, n = xAdvances.size; i < n; i++) {
            glyphPositions.add(x);
            x += xAdvances.get(i);
        }
    } else
        fontOffset = 0;
    glyphPositions.add(x);

    if (selectionStart > newDisplayText.length())
        selectionStart = textLength;
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:45,代码来源:TextField.java


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