本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeBitmapFontData类的典型用法代码示例。如果您正苦于以下问题:Java FreeTypeBitmapFontData类的具体用法?Java FreeTypeBitmapFontData怎么用?Java FreeTypeBitmapFontData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FreeTypeBitmapFontData类属于com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator包,在下文中一共展示了FreeTypeBitmapFontData类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeBitmapFontData; //导入依赖的package包/类
@Override
public void create () {
boolean flip = false;
batch = new SpriteBatch();
if (flip) {
OrthographicCamera cam = new OrthographicCamera();
cam.setToOrtho(flip);
cam.update();
batch.setProjectionMatrix(cam.combined);
}
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), flip);
FileHandle fontFile = Gdx.files.internal("data/arial.ttf");
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 15;
parameter.flip = flip;
parameter.genMipMaps = true;
FreeTypeBitmapFontData fontData = generator.generateData(parameter);
ftFont = generator.generateFont(parameter);
generator.dispose();
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:25,代码来源:FreeTypeTest.java
示例2: generateFiles
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeBitmapFontData; //导入依赖的package包/类
/**
* Convenience method for generating a font, and then writing the fnt and
* png files. Writing a generated font to files allows the possibility of
* only generating the fonts when they are missing, otherwise loading from a
* previously generated file.
*
* @param fontFile
* @param fontSize
* @param destiny
*/
private void generateFiles(String fontName, FileHandle fontFile,
int fontSize, int pageWidth, int pageHeight, FileHandle destiny) {
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);
PixmapPacker packer = new PixmapPacker(pageWidth, pageHeight,
Pixmap.Format.RGBA8888, 2, false);
FreeTypeFontParameter param = new FreeTypeFontParameter();
param.packer = packer;
param.characters = FreeTypeFontGenerator.DEFAULT_CHARS;
param.size = fontSize;
param.flip = false;
FreeTypeFontGenerator.FreeTypeBitmapFontData fontData = generator
.generateData(param);
saveFontToFile(fontData, fontSize, fontName, packer, destiny);
generator.dispose();
packer.dispose();
}
开发者ID:randombot,项目名称:skinpacker,代码行数:30,代码来源:Ttf2FntGenerator.java
示例3: saveFontToFile
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeBitmapFontData; //导入依赖的package包/类
private void saveFontToFile(FreeTypeBitmapFontData data, int fontSize,
String fontName, PixmapPacker packer, FileHandle destiny) {
FileHandle fontFile = Gdx.files.absolute(destiny.file()
.getAbsolutePath() + File.separator + fontName + ".fnt"); // .fnt
// path
BitmapFontWriter.setOutputFormat(BitmapFontWriter.OutputFormat.Text);
String[] pageRefs = BitmapFontWriter.writePixmaps(packer.getPages(),
destiny, fontName); // png dir path
Gdx.app.debug(TAG, String.format(
"Saving font [%s]: fontfile: %s, pixmapDir: %s\n", fontName,
fontFile, destiny));
BitmapFontWriter.writeFont(data, pageRefs, fontFile,
new BitmapFontWriter.FontInfo(fontName, fontSize), 1, 1);
}
开发者ID:randombot,项目名称:skinpacker,代码行数:17,代码来源:Ttf2FntGenerator.java
示例4: loadSync
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeBitmapFontData; //导入依赖的package包/类
@Override
public BitmapFont loadSync (AssetManager manager, String fileName, FileHandle file, FreeTypeFontLoaderParameter parameter) {
if(parameter == null) throw new RuntimeException("FreetypeFontParameter must be set in AssetManager#load to point at a TTF file!");
FreeTypeFontGenerator generator = manager.get(parameter.fontFileName + ".gen", FreeTypeFontGenerator.class);
FreeTypeBitmapFontData data = generator.generateData(parameter.fontParameters);
BitmapFont font = new BitmapFont(data, data.getTextureRegions(), false);
font.setOwnsTexture(true);
return font;
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:10,代码来源:FreetypeFontLoader.java
示例5: loadSync
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeBitmapFontData; //导入依赖的package包/类
@Override
public BitmapFont loadSync( AssetManager manager, String fileName, FileHandle file, BitmapFontParameter parameter ) {
int fontSize = 10;
String scrubbedFileName = fileName;
int qMark = fileName.lastIndexOf( "?" );
if ( qMark != -1 ) {
scrubbedFileName = scrubbedFileName.substring( 0, qMark );
Matcher m = argsPtn.matcher( fileName );
m.region( qMark+1, fileName.length() );
while ( m.lookingAt() ) {
if ( m.group( 1 ).equals( "size" ) ) {
fontSize = Integer.parseInt( m.group( 2 ) );
}
if ( m.group( 3 ).length() > 0 ) break; // Hit the "#" separator.
m.region( m.end(), fileName.length() );
}
}
boolean flip = parameter != null ? parameter.flip : false;
FreeTypeFontGenerator generator = new FreeTypeFontGenerator( file );
FreeTypeBitmapFontData data = generator.generateData( fontSize, FreeTypeFontGenerator.DEFAULT_CHARS, flip );
generator.dispose();
return new BitmapFont( data, data.getTextureRegions(), true );
}
开发者ID:Vhati,项目名称:OverdriveGDX,代码行数:30,代码来源:FreeTypeFontLoader.java
注:本文中的com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeBitmapFontData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论