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


Java Fonts.loadGlyphs方法代码示例

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


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

示例1: loadGlyphs

import itdelatrisu.opsu.ui.Fonts; //导入方法依赖的package包/类
/**
 * Loads glyphs necessary for rendering the player name.
 */
public void loadGlyphs() {
	if (playerName != null) {
		Fonts.loadGlyphs(Fonts.LARGE, playerName);
		Fonts.loadGlyphs(Fonts.MEDIUM, playerName);
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:10,代码来源:ScoreData.java

示例2: keyPressed

import itdelatrisu.opsu.ui.Fonts; //导入方法依赖的package包/类
@Override
public void keyPressed(int key, char c) {
	if (!active)
		return;

	consumeEvent();

	// esc: close overlay or clear text
	if (key == Input.KEY_ESCAPE) {
		if (state == State.CREATE_USER && !textField.getText().isEmpty()) {
			textField.setText("");
			newUser.setName("");
		} else
			listener.close(false);
		return;
	}

	if (UI.globalKeyPressed(key))
		return;

	// key entry
	if (state == State.CREATE_USER) {
		// enter: create user
		if (key == Input.KEY_ENTER) {
			createNewUser();
			return;
		}

		textField.setFocus(true);
		textField.keyPressed(key, c);
		textField.setFocus(false);
		newUser.setName(textField.getText());
		if (c > 255 && Character.isLetterOrDigit(c)) {
			Fonts.loadGlyphs(Fonts.LARGE, c);
			Fonts.loadGlyphs(Fonts.MEDIUM, c);
		}
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:39,代码来源:UserSelectOverlay.java

示例3: drawResult

import itdelatrisu.opsu.ui.Fonts; //导入方法依赖的package包/类
/**
 * Draws the download result as a rectangular button.
 * @param g the graphics context
 * @param position the index (to offset the button from the topmost button)
 * @param hover true if the mouse is hovering over this button
 * @param focus true if the button is focused
 * @param previewing true if the beatmap is currently being previewed
 */
public void drawResult(Graphics g, float position, boolean hover, boolean focus, boolean previewing) {
	float textX = buttonBaseX + buttonWidth * 0.001f;
	float edgeX = buttonBaseX + buttonWidth * 0.985f;
	float y = buttonBaseY + position;
	float marginY = buttonHeight * 0.04f;
	Download dl = DownloadList.get().getDownload(beatmapSetID);

	// rectangle outline
	g.setColor((focus) ? Colors.BLACK_BG_FOCUS : (hover) ? Colors.BLACK_BG_HOVER : Colors.BLACK_BG_NORMAL);
	g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight);

	// map is already loaded
	if (BeatmapSetList.get().containsBeatmapSetID(beatmapSetID)) {
		g.setColor(Colors.BLUE_BUTTON);
		g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight);
	}

	// download progress
	if (dl != null) {
		float progress = dl.getProgress();
		if (progress > 0f) {
			g.setColor(Colors.GREEN);
			g.fillRect(buttonBaseX, y, buttonWidth * progress / 100f, buttonHeight);
		}
	}

	// preview button
	Image img = (previewing) ? GameImage.MUSIC_PAUSE.getImage() : GameImage.MUSIC_PLAY.getImage();
	img.drawCentered(textX + img.getWidth() / 2, y + buttonHeight / 2f);
	textX += img.getWidth() + buttonWidth * 0.001f;

	// text
	// TODO: if the title/artist line is too long, shorten it (e.g. add "...") instead of just clipping
	if (OPTION_SHOW_UNICODE.state) {
		Fonts.loadGlyphs(Fonts.BOLD, getTitle());
		Fonts.loadGlyphs(Fonts.BOLD, getArtist());
	}
	// TODO can't set clip again or else old clip will be cleared
	//g.setClip((int) textX, (int) (y + marginY), (int) (edgeX - textX - Fonts.DEFAULT.getWidth(creator)), Fonts.BOLD.getLineHeight());
	Fonts.BOLD.drawString(
			textX, y + marginY,
			String.format("%s - %s%s", getArtist(), getTitle(),
					(dl != null) ? String.format(" [%s]", dl.getStatus().getName()) : ""), Color.white);
	//g.clearClip();
	Fonts.DEFAULT.drawString(
			textX, y + marginY + Fonts.BOLD.getLineHeight(),
			String.format("Last updated: %s", date), Color.white);
	Fonts.DEFAULT.drawString(
			edgeX - Fonts.DEFAULT.getWidth(creator), y + marginY,
			creator, Color.white);
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:60,代码来源:DownloadNode.java

示例4: drawResult

import itdelatrisu.opsu.ui.Fonts; //导入方法依赖的package包/类
/**
 * Draws the download result as a rectangular button.
 * @param g the graphics context
 * @param position the index (to offset the button from the topmost button)
 * @param hover true if the mouse is hovering over this button
 * @param focus true if the button is focused
 * @param previewing true if the beatmap is currently being previewed
 */
public void drawResult(Graphics g, float position, boolean hover, boolean focus, boolean previewing) {
	float textX = buttonBaseX + buttonWidth * 0.001f;
	float edgeX = buttonBaseX + buttonWidth * 0.985f;
	float y = buttonBaseY + position;
	float marginY = buttonHeight * 0.04f;
	Download dl = DownloadList.get().getDownload(beatmapSetID);

	// rectangle outline
	g.setColor((focus) ? Colors.BLACK_BG_FOCUS : (hover) ? Colors.BLACK_BG_HOVER : Colors.BLACK_BG_NORMAL);
	g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight);

	// map is already loaded
	if (BeatmapSetList.get().containsBeatmapSetID(beatmapSetID)) {
		g.setColor(Colors.BLUE_BUTTON);
		g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight);
	}

	// download progress
	if (dl != null) {
		float progress = dl.getProgress();
		if (progress > 0f) {
			g.setColor(Colors.GREEN);
			g.fillRect(buttonBaseX, y, buttonWidth * progress / 100f, buttonHeight);
		}
	}

	// preview button
	Image img = (previewing) ? GameImage.MUSIC_PAUSE.getImage() : GameImage.MUSIC_PLAY.getImage();
	img.drawCentered(textX + img.getWidth() / 2, y + buttonHeight / 2f);
	textX += img.getWidth() + buttonWidth * 0.001f;

	// text
	// TODO: if the title/artist line is too long, shorten it (e.g. add "...") instead of just clipping
	if (Options.useUnicodeMetadata()) {  // load glyphs
		Fonts.loadGlyphs(Fonts.BOLD, getTitle());
		Fonts.loadGlyphs(Fonts.BOLD, getArtist());
	}
	// TODO can't set clip again or else old clip will be cleared
	//g.setClip((int) textX, (int) (y + marginY), (int) (edgeX - textX - Fonts.DEFAULT.getWidth(creator)), Fonts.BOLD.getLineHeight());
	Fonts.BOLD.drawString(
			textX, y + marginY,
			String.format("%s - %s%s", getArtist(), getTitle(),
					(dl != null) ? String.format(" [%s]", dl.getStatus().getName()) : ""), Color.white);
	//g.clearClip();
	Fonts.DEFAULT.drawString(
			textX, y + marginY + Fonts.BOLD.getLineHeight(),
			String.format("Last updated: %s", date), Color.white);
	Fonts.DEFAULT.drawString(
			edgeX - Fonts.DEFAULT.getWidth(creator), y + marginY,
			creator, Color.white);
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:60,代码来源:DownloadNode.java

示例5: setUser

import itdelatrisu.opsu.ui.Fonts; //导入方法依赖的package包/类
/** Sets the user. */
public void setUser(User user) {
	this.user = user;
	Fonts.loadGlyphs(Fonts.MEDIUM, user.getName());
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:6,代码来源:UserButton.java

示例6: keyPressed

import itdelatrisu.opsu.ui.Fonts; //导入方法依赖的package包/类
@Override
public void keyPressed(int key, char c) {
	// block input during beatmap importing
	if (importThread != null && !(key == Input.KEY_ESCAPE || key == Input.KEY_F12))
		return;

	if (UI.globalKeyPressed(key))
		return;

	switch (key) {
	case Input.KEY_ESCAPE:
		if (importThread != null) {
			// beatmap importing: stop parsing beatmaps by sending interrupt to BeatmapParser
			importThread.interrupt();
		} else if (!search.getText().isEmpty()) {
			// clear search text
			search.setText("");
			pageDir = Page.RESET;
			resetSearchTimer();
		} else {
			// return to main menu
			SoundController.playSound(SoundEffect.MENUBACK);
			((MainMenu) game.getState(Opsu.STATE_MAINMENU)).reset();
			game.enterState(Opsu.STATE_MAINMENU, new EasedFadeOutTransition(), new FadeInTransition());
		}
		break;
	case Input.KEY_ENTER:
		if (!search.getText().isEmpty()) {
			pageDir = Page.RESET;
			resetSearchTimer();
		}
		break;
	case Input.KEY_F5:
		SoundController.playSound(SoundEffect.MENUCLICK);
		lastQuery = null;
		pageDir = Page.CURRENT;
		if (searchQuery != null)
			searchQuery.interrupt();
		resetSearchTimer();
		break;
	default:
		// wait for user to finish typing
		if (Character.isLetterOrDigit(c) || key == Input.KEY_BACK || key == Input.KEY_SPACE) {
			// load glyphs
			if (c > 255)
				Fonts.loadGlyphs(searchFont, c);

			// reset search timer
			searchTimer = 0;
			pageDir = Page.RESET;
		}
		break;
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:55,代码来源:DownloadsMenu.java


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