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


Java Glyph类代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph的典型用法代码示例。如果您正苦于以下问题:Java Glyph类的具体用法?Java Glyph怎么用?Java Glyph使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Glyph类属于com.badlogic.gdx.graphics.g2d.BitmapFont包,在下文中一共展示了Glyph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reset

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
/** Called when a glyph is freed to clear the state of the glyph for possible later reuse. */
static void reset (Glyph glyph) {
	glyph.id = 0;
	glyph.srcX = 0;
	glyph.srcY = 0;
	glyph.width = 0;
	glyph.height = 0;
	glyph.u = 0;
	glyph.v = 0;
	glyph.u2 = 0;
	glyph.v2 = 0;
	glyph.xoffset = 0;
	glyph.yoffset = 0;
	glyph.xadvance = 0;
	glyph.kerning = null;
	glyph.fixedWidth = false;
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:18,代码来源:GlyphUtils.java

示例2: clone

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
/** Copies all contents from the first glyph to the second one. */
static void clone (Glyph from, Glyph to) {
	to.id = from.id;
	to.srcX = from.srcX;
	to.srcY = from.srcY;
	to.width = from.width;
	to.height = from.height;
	to.u = from.u;
	to.v = from.v;
	to.u2 = from.u2;
	to.v2 = from.v2;
	to.xoffset = from.xoffset;
	to.yoffset = from.yoffset;
	to.xadvance = from.xadvance;
	to.kerning = from.kerning; // Keep the same instance, there's no reason to deep clone it
	to.fixedWidth = from.fixedWidth;
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:18,代码来源:GlyphUtils.java

示例3: onApply

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
@Override
protected void onApply (Glyph glyph, int localIndex) {
	// Calculate progress
	float progressModifier = (1f / intensity) * DEFAULT_INTENSITY;
	float normalFrequency = (1f / frequency) * DEFAULT_FREQUENCY;
	float progressOffset = localIndex / normalFrequency;
	float progress = calculateProgress(progressModifier, progressOffset);

	// Calculate offset
	float y = getLineHeight() * distance * Interpolation.sine.apply(-1, 1, progress) * DEFAULT_DISTANCE;

	// Calculate fadeout
	float fadeout = calculateFadeout();
	y *= fadeout;

	// Apply changes
	glyph.yoffset += y;
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:19,代码来源:WaveEffect.java

示例4: onApply

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
@Override
protected void onApply (Glyph glyph, int localIndex) {
	// Calculate progress
	float progressModifier = (1f / intensity) * DEFAULT_INTENSITY;
	float normalFrequency = (1f / frequency) * DEFAULT_FREQUENCY;
	float progressOffset = localIndex / normalFrequency;
	float progress = calculateProgress(progressModifier, -progressOffset, false);

	// Calculate offset
	float interpolation = 0;
	float split = 0.2f;
	if (progress < split) {
		interpolation = Interpolation.pow2Out.apply(0, 1, progress / split);
	} else {
		interpolation = Interpolation.bounceOut.apply(1, 0, (progress - split) / (1f - split));
	}
	float y = getLineHeight() * distance * interpolation * DEFAULT_DISTANCE;

	// Calculate fadeout
	float fadeout = calculateFadeout();
	y *= fadeout;

	// Apply changes
	glyph.yoffset += y;
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:26,代码来源:JumpEffect.java

示例5: addMissingGlyphs

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
/** Adds cached glyphs to the active BitmapFontCache as the char index progresses. */
private void addMissingGlyphs () {
	// Add additional glyphs to layout array, if any
	int glyphLeft = glyphCharIndex - cachedGlyphCharIndex;
	if (glyphLeft < 1) return;

	// Get runs
	GlyphLayout layout = super.getGlyphLayout();
	Array<GlyphRun> runs = layout.runs;

	// Iterate through GlyphRuns to find the next glyph spot
	int glyphCount = 0;
	for (int runIndex = 0; runIndex < glyphRunCapacities.size; runIndex++) {
		int runCapacity = glyphRunCapacities.get(runIndex);
		if ((glyphCount + runCapacity) < cachedGlyphCharIndex) {
			glyphCount += runCapacity;
			continue;
		}

		// Get run and increase glyphCount up to its current size
		Array<Glyph> glyphs = runs.get(runIndex).glyphs;
		glyphCount += glyphs.size;

		// Next glyphs go here
		while (glyphLeft > 0) {

			// Skip run if this one is full
			int runSize = glyphs.size;
			if (runCapacity == runSize) {
				break;
			}

			// Put new glyph to this run
			cachedGlyphCharIndex++;
			glyphCount++;
			glyphLeft--;
			glyphs.add(glyphCache.get(cachedGlyphCharIndex));
		}
	}
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:41,代码来源:TypingLabel.java

示例6: onApply

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
@Override
protected void onApply (Glyph glyph, int localIndex) {
	// Make sure we can hold enough entries for the current index
	if (localIndex >= lastOffsets.size / 2) {
		lastOffsets.setSize(lastOffsets.size + 16);
	}

	// Get last offsets
	float lastX = lastOffsets.get(localIndex * 2);
	float lastY = lastOffsets.get(localIndex * 2 + 1);

	// Calculate new offsets
	float x = getLineHeight() * distance * MathUtils.random(-1, 1) * DEFAULT_DISTANCE;
	float y = getLineHeight() * distance * MathUtils.random(-1, 1) * DEFAULT_DISTANCE;

	// Apply intensity
	float normalIntensity = MathUtils.clamp(intensity * DEFAULT_INTENSITY, 0, 1);
	x = Interpolation.linear.apply(lastX, x, normalIntensity);
	y = Interpolation.linear.apply(lastY, y, normalIntensity);

	// Apply fadeout
	float fadeout = calculateFadeout();
	x *= fadeout;
	y *= fadeout;
	x = Math.round(x);
	y = Math.round(y);

	// Store offsets for the next tick
	lastOffsets.set(localIndex * 2, x);
	lastOffsets.set(localIndex * 2 + 1, y);

	// Apply changes
	glyph.xoffset += x;
	glyph.yoffset += y;
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:36,代码来源:ShakeEffect.java

示例7: getGlyph

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
@Override
public Glyph getGlyph (char ch) {
	Glyph glyph = super.getGlyph(ch);
	if ((glyph == null || glyph == missingGlyph) && generators.size > 0) {
              for (int i = 0; i < generators.size; i++) {
                  FreeTypeFontGenerator generator = generators.get(i);
                  glyph = getGlyph(ch, generator);
                  if (glyph != null && glyph != missingGlyph) break;
              }
	}
	if (glyph == null) {
	    glyph = missingGlyph;
          }
	return glyph;
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:16,代码来源:FreeTypeFontGenerator.java

示例8: setGlyphs

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
/** Ugly code needed because Array uses an unchecked cast from Object[] to T[] */
private static void setGlyphs(Array<Glyph> array, Object[] newGlyphs) {
    array.clear();
    for (Object obj : newGlyphs) {
        array.add((Glyph)obj);
    }
}
 
开发者ID:anonl,项目名称:gdx-styledtext,代码行数:8,代码来源:GdxTextElement.java

示例9: getKerning

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
@Override
public float getKerning(int glyphId) {
    if (glyphCount == 0) {
        return 0f;
    } else if (glyphId != (char)glyphId) {
        return 0f; // libGDX Glyph.getKerning uses char instead of int
    }

    Glyph finalGlyph = getGlyph(glyphLayout, glyphCount - 1);
    int kerning = finalGlyph.getKerning((char)glyphId);
    return scaleXY * kerning;
}
 
开发者ID:anonl,项目名称:gdx-styledtext,代码行数:13,代码来源:GdxTextElement.java

示例10: getGlyph

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
private static Glyph getGlyph(GlyphLayout layout, int index) {
    int offset = 0;
    for (GlyphRun run : layout.runs) {
        if (index < offset) {
            break;
        }
        if (index - offset < run.glyphs.size) {
            return run.glyphs.get(index - offset);
        }
        offset += run.glyphs.size;
    }
    throw new ArrayIndexOutOfBoundsException(index);
}
 
开发者ID:anonl,项目名称:gdx-styledtext,代码行数:14,代码来源:GdxTextElement.java

示例11: requireSequence

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
private void requireSequence (CharSequence seq, int start, int end) {
	if (vertexData.length == 1) {
		// don't scan sequence if we just have one page and markup is disabled
		int newGlyphCount = font.markupEnabled ? countGlyphs(seq, start, end) : end - start;
		require(0, newGlyphCount);
	} else {
		for (int i = 0, n = tmpGlyphCount.length; i < n; i++)
			tmpGlyphCount[i] = 0;

		// determine # of glyphs in each page
		while (start < end) {
			char ch = seq.charAt(start++);
			if (ch == '[' && font.markupEnabled) {
				if (!(start < end && seq.charAt(start) == '[')) { // non escaped '['
					while (start < end && seq.charAt(start) != ']')
						start++;
					start++;
					continue;
				}
				start++;
			}
			Glyph g = font.data.getGlyph(ch);
			if (g == null) continue;
			tmpGlyphCount[g.page]++;
		}
		// require that many for each page
		for (int i = 0, n = tmpGlyphCount.length; i < n; i++)
			require(i, tmpGlyphCount[i]);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:31,代码来源:BitmapFontCache.java

示例12: obtain

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
/** Returns a glyph from this pool. The glyph may be new (from {@link Pool#newObject()}) or reused (previously
 * {@link Pool#free(Object) freed}). */
static Glyph obtain () {
	return pool.obtain();
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:6,代码来源:GlyphUtils.java

示例13: obtainClone

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
/** Returns a glyph from this pool and clones it from the given one. The glyph may be new (from {@link Pool#newObject()}) or
 * reused (previously {@link Pool#free(Object) freed}). */
static Glyph obtainClone (Glyph from) {
	Glyph glyph = pool.obtain();
	clone(from, glyph);
	return glyph;
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:8,代码来源:GlyphUtils.java

示例14: free

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
/** Puts the specified glyph in the pool, making it eligible to be returned by {@link #obtain()}. If the pool already contains
 * {@link #max} free glyphs, the specified glyph is reset but not added to the pool. */
static void free (Glyph glyph) {
	pool.free(glyph);
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:6,代码来源:GlyphUtils.java

示例15: freeAll

import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph; //导入依赖的package包/类
/** Puts the specified glyphs in the pool. Null glyphs within the array are silently ignored.
 * @see #free(Object) */
static void freeAll (Array<Glyph> glyphs) {
	pool.freeAll(glyphs);
}
 
开发者ID:rafaskb,项目名称:typing-label,代码行数:6,代码来源:GlyphUtils.java


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