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


Java UnicodeFont.loadGlyphs方法代码示例

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


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

示例1: addFont

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void addFont(String key, String file, int size, boolean bold, boolean italic, Effect [] effects) throws SlickException {
	try {
		AssetManager.ASSETS_TO_LOAD++;
		
		UnicodeFont uni = new UnicodeFont(file, size, bold, italic);
		uni.addAsciiGlyphs();
		uni.addGlyphs(400, 600);
		uni.getEffects().add(new ColorEffect(Color.WHITE));
		uni.getEffects().addAll(Arrays.asList(effects));
		uni.loadGlyphs();
		if((fonts != null) && (uni != null)) {
			fonts.put(key, uni);
			
			AssetManager.ASSETS_LOADED++;
			System.out.println(String.format("Font Loaded: %s", key));
		}
	} catch(Exception ex) {
		ex.printStackTrace();
		System.out.printf("ERROR: Font \"%s\" could not be loaded!\n", file);
	}
}
 
开发者ID:packetpirate,项目名称:Generic-Zombie-Shooter-Redux,代码行数:23,代码来源:AssetManager.java

示例2: loadGlyphs

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
/**
 * Adds and loads glyphs for a font.
 * @param font the font to add the glyphs to
 * @param s the string containing the glyphs to load
 */
public static void loadGlyphs(UnicodeFont font, String s) {
	if (s == null || s.isEmpty())
		return;

	// get set of added strings
	HashSet<String> set = loadedGlyphs.get(font);
	if (set == null) {
		set = new HashSet<String>();
		loadedGlyphs.put(font, set);
	} else if (set.contains(s))
		return;  // string already in set

	// load glyphs
	font.addGlyphs(s);
	set.add(s);
	try {
		font.loadGlyphs();
	} catch (SlickException e) {
		Log.warn(String.format("Failed to load glyphs for string '%s'.", s), e);
	}
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:27,代码来源:Fonts.java

示例3: UnicodeFontRenderer

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public UnicodeFontRenderer(Font awtFont) {
    super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"),
            Minecraft.getMinecraft().getTextureManager(), false);

    font = new UnicodeFont(awtFont);
    font.addAsciiGlyphs();
    font.getEffects().add(new ColorEffect(Color.WHITE));
    try {
        font.loadGlyphs();
    } catch (SlickException exception) {
        throw new RuntimeException(exception);
    }
    String alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
    FONT_HEIGHT = font.getHeight(alphabet) / 4;
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:17,代码来源:UnicodeFontRenderer.java

示例4: loadFont

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
/**
 * Loads a Unicode font and its ASCII glyphs.
 * @param font the font to load
 * @param effect the font effect
 * @throws SlickException if the glyphs could not be loaded
 */
@SuppressWarnings("unchecked")
private static void loadFont(UnicodeFont font, Effect effect) throws SlickException {
	font.addAsciiGlyphs();
	font.getEffects().add(effect);
	font.loadGlyphs();
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:13,代码来源:Fonts.java

示例5: loadFonts

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") //loads the fonts for the game including different font sizes.
public static void loadFonts() {
	int arrayLength = GameConstants.GAME_FONT.length;
	try {
		for(int i = 0; i < arrayLength; i++) {
			UnicodeFont font = new UnicodeFont(FONT_LOCATION, (int) ((16+10*i)/GameConstants.WINDOW_SCALE), false, false);
			font.addAsciiGlyphs();
			font.getEffects().add(new ColorEffect());
			font.loadGlyphs();
			GameConstants.GAME_FONT[i] = font;
		}
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:thetorine,项目名称:sdd-major,代码行数:16,代码来源:IngameState.java

示例6: loadFonts

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
private static void loadFonts() {
    font = new UnicodeFont(new java.awt.Font("Times New Roman", java.awt.Font.PLAIN, 24));
    font.getEffects().add(new ColorEffect(java.awt.Color.white));
    font.addAsciiGlyphs();
    try { font.loadGlyphs(); }
    catch (SlickException e) {
        e.printStackTrace();
    }
}
 
开发者ID:TimboKZ,项目名称:ActiveVisualiser,代码行数:10,代码来源:Core.java

示例7: init

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void init(GameContainer container, StateBasedGame game) throws SlickException {
	this.game = game;
	Font font = new Font(Font.MONOSPACED, Font.PLAIN, 60);
	ufont = new UnicodeFont(font);
	ufont.addAsciiGlyphs();
	ufont.addGlyphs(32, 127);
	ufont.getEffects().add(new ColorEffect(Color.WHITE));
	ufont.loadGlyphs();
}
 
开发者ID:Jullekungfu,项目名称:SpaceDefence,代码行数:12,代码来源:MainMenu.java

示例8: entered

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
@Override
public void entered() {
    java.awt.Font awtFont = new java.awt.Font("Arial", java.awt.Font.PLAIN, 24);
    font = new UnicodeFont(awtFont);
    font.getEffects().add(new ColorEffect(java.awt.Color.RED));
    font.addAsciiGlyphs();
    font.loadGlyphs();
}
 
开发者ID:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:9,代码来源:MenuState.java

示例9: initFont

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
private void initFont() {
	font = new UnicodeFont(new java.awt.Font ("Vani", Font.BOLD, 12));
	font.getEffects().add(new ColorEffect(java.awt.Color.white));
	font.addNeheGlyphs();
	try {
		font.loadGlyphs();
	} catch (SlickException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Fireblade,项目名称:GameCo,代码行数:11,代码来源:GameCo.java

示例10: loadFont

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
/**
 * Loads a Unicode font and its ASCII glyphs.
 * @param font the font to load
 * @param effect the font effect
 * @param backup the backup font
 * @throws SlickException if the glyphs could not be loaded
 */
@SuppressWarnings("unchecked")
private static void loadFont(UnicodeFont font, Effect effect, UnicodeFont backup) throws SlickException {
	font.addBackupFont(backup);
	font.addAsciiGlyphs();
	font.getEffects().add(effect);
	font.loadGlyphs();
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:15,代码来源:Fonts.java

示例11: DamageRenderer

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
public DamageRenderer(Font font) throws SlickException {
	Font f = font.deriveFont(Font.BOLD, 10);
	uf = new UnicodeFont(f);
	uf.getEffects().add(new ColorEffect(java.awt.Color.white));
	uf.addAsciiGlyphs();
	uf.loadGlyphs();
}
 
开发者ID:oberien,项目名称:Oberien,代码行数:8,代码来源:DamageRenderer.java

示例12: MainHUD

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
public MainHUD(Font font, int width) throws SlickException {
	Font f = font.deriveFont(Font.BOLD, 20);
	uf = new UnicodeFont(f);
	uf.getEffects().add(new ColorEffect(java.awt.Color.white));
	uf.addAsciiGlyphs();
	uf.loadGlyphs();
	hudWidth = (int) (width*0.4f);
	hudPosX = (int) (width/2 - width*0.2f);
}
 
开发者ID:oberien,项目名称:Oberien,代码行数:10,代码来源:MainHUD.java

示例13: SimpleFont

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") //nothing we can do about this warning because it is a problem of Slick2D
public SimpleFont(Font font, Color color) throws SlickException {
	ufont = new UnicodeFont(font);
	ufont.getEffects().add(new ColorEffect(color));
	ufont.addAsciiGlyphs();
	ufont.loadGlyphs();
}
 
开发者ID:mtzstngl,项目名称:Spacerun,代码行数:8,代码来源:SimpleFont.java

示例14: init

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
static public void init(){
	font = new UnicodeFont(new Font("Times New Roman", Font.BOLD, 14));
	font.addAsciiGlyphs();
	font.addGlyphs(400, 600);
	font.getEffects().add(new ColorEffect(java.awt.Color.WHITE)); // FIXME ?
	try {
		font.loadGlyphs();
	} catch (SlickException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Mathgoat,项目名称:square-loot,代码行数:12,代码来源:OverlayManager.java

示例15: init

import org.newdawn.slick.UnicodeFont; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void init(GameContainer gc, StateBasedGame sbg)
		throws SlickException {
	
	errorImage = Main.loadImage("res/error2.png");
	
	lastMouseX = gc.getInput().getAbsoluteMouseX();
	lastMouseY = gc.getInput().getAbsoluteMouseY();
	
	gc.setMouseCursor(Main.CURSOR_IMAGES.getSprite(1, 0), 16, 16);
	
	FONT = new UnicodeFont("res/Anonymous_Pro.ttf", 12, false, false);

	FONT.addAsciiGlyphs();
	FONT.getEffects().add(new ColorEffect());
	FONT.loadGlyphs();
	
	coin = Main.loadImage("res/coin.png");

	EditorKeyListener listener = new EditorKeyListener(this);
	gc.getInput().addKeyListener(listener);
	
	tiles = new SpriteSheet(Main.loadImage("res/tiles.png"), 32, 32);
	
	play = new MouseOverArea(gc, Main.USEFUL_BUTTONS.getSprite(0, 1), 4, gc.getHeight() - 40);
		play.setMouseDownImage(Main.USEFUL_BUTTONS.getSprite(1, 1));
	stop = new MouseOverArea(gc, Main.USEFUL_BUTTONS.getSprite(0, 2), 44, gc.getHeight() - 40);
		stop.setMouseDownImage(Main.USEFUL_BUTTONS.getSprite(1, 2));
	help = new MouseOverArea(gc, Main.BIG_BUTTON.getSprite(0, 0), 84, gc.getHeight() - 40);
		help.setMouseDownImage(Main.BIG_BUTTON.getSprite(0, 1));
	failed = new MouseOverArea(gc, Main.USEFUL_BUTTONS.getSprite(0, 3), gc.getWidth() / 2 - 16, gc.getHeight() / 2 + 40);
		failed.setMouseDownImage(Main.USEFUL_BUTTONS.getSprite(1, 3));
	pause = new MouseOverArea(gc, Main.USEFUL_BUTTONS.getSprite(0, 0), 8, 8);
		pause.setMouseDownImage(Main.USEFUL_BUTTONS.getSprite(1, 0));
		
	menu = new MouseOverArea(gc, Main.BIG_BUTTON.getSprite(0, 0), gc.getWidth() / 2 - 64, gc.getHeight() / 2 + 16);
		menu.setMouseDownImage(Main.BIG_BUTTON.getSprite(0, 1));
		
	SpriteSheet sheet = new SpriteSheet(Main.loadImage("res/tweet.png"), 128, 32);
	
	tweet = new MouseOverArea(gc, sheet.getSprite(0, 0), gc.getWidth() / 2 - 64, gc.getHeight() / 2 + 56);
		tweet.setMouseDownImage(sheet.getSprite(0, 1));
	scores = new MouseOverArea(gc, Main.BIG_BUTTON.getSprite(0, 0), gc.getWidth() / 2 - 64, gc.getHeight() / 2 + 96);
		scores.setMouseDownImage(Main.BIG_BUTTON.getSprite(0, 1));

	coins = 0;
	
	arrow = Main.loadImage("res/arrow.png");
	
}
 
开发者ID:CyboticCatfish,项目名称:code404,代码行数:52,代码来源:Game.java


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