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


Java Fonts类代码示例

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


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

示例1: onMouseReleased

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
@Override
public boolean onMouseReleased(int button, int x, int y) {
	if (x > 10 || index >= optionsMap.length || optionsMap[index] == null) {
		return false;
	}
	int lh = Fonts.SMALL.getLineHeight();
	int ypos = 50 + lh / 4;
	for (Object o : optionsMap[index].entrySet()) {
		if (y >= ypos && y <= ypos + 10) {
			optionsMap[index].remove(((Map.Entry<Option, String>) o).getKey());
			if (optionsMap[index].size() == 0) {
				optionsMap[index] = null;
			}
			reloadSBsettingsToIndex(index);
			return true;
		}
		ypos += lh;
	}
	return true;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:21,代码来源:StoryboardOverlay.java

示例2: calculatePositions

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
private void calculatePositions() {
	// if width is 0, attempting to wrap it will result in infinite loop
	Notification.width = Math.max(50, (int) (displayContainer.width * 0.1703125f));
	Notification.baseLine = (int) (displayContainer.height * 0.9645f);
	Notification.paddingY = (int) (displayContainer.height * 0.0144f);
	Notification.finalX = displayContainer.width - Notification.width - (int) (displayContainer.width * 0.01);
	Notification.fontPaddingX = (int) (Notification.width * 0.02f);
	Notification.fontPaddingY = (int) (Fonts.SMALLBOLD.getLineHeight() / 4f);
	Notification.lineHeight = Fonts.SMALLBOLD.getLineHeight();
	if (bubbles.isEmpty()) {
		return;
	}
	finishAddAnimation();
	int y = Notification.baseLine;
	for (Notification bubble : bubbles) {
		bubble.recalculateDimensions();
		y -= bubble.height;
		bubble.baseY = bubble.y = y;
		y -= Notification.paddingY;
	}
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:22,代码来源:BubNotifState.java

示例3: initGL

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
private void initGL() throws Exception {
	GL.initDisplay(width, height);
	GL.enterOrtho(width, height);

	graphics = new Graphics(width, height);
	graphics.setAntiAlias(false);

	if (input == null) {
		input = new Input(height);
		input.enableKeyRepeat();
		input.addListener(new GlobalInputListener());
		input.addMouseListener(bubNotifState);
	}
	input.addListener(state);

	sout("GL ready");

	GameImage.init(width, height);
	Fonts.init();

	ResolutionChangedListener.EVENT.make().onResolutionChanged(width, height);
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:23,代码来源:DisplayContainer.java

示例4: render

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
@Override
public void render(Graphics g) {
	// score multiplier (TODO: fade in color changes)
	float mult = GameMod.getScoreMultiplier();
	String multString = String.format("Score Multiplier: %.2fx", mult);
	Color multColor = (mult == 1f) ? Color.white : (mult > 1f) ? Color.green : Color.red;
	float multY = Fonts.LARGE.getLineHeight() * 2 + displayContainer.height * 0.06f;
	Fonts.LARGE.drawString(
			(displayContainer.width - Fonts.LARGE.getWidth(multString)) / 2f,
			multY, multString, multColor);

	// category text
	for (GameMod.Category category : GameMod.Category.values()) {
		Fonts.LARGE.drawString(category.getX(),
				category.getY() - Fonts.LARGE.getLineHeight() / 2f,
				category.getName(), category.getColor());
	}

	// buttons
	for (GameMod mod : GameMod.values())
		mod.draw();

	super.render(g);
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:25,代码来源:ButtonMenu.java

示例5: enter

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
/**
 * Processes a state enter request.
 */
public void enter() {
	float center = displayContainer.width / 2f;
	float centerOffsetX = displayContainer.width * OFFSET_WIDTH_RATIO;
	centerOffset = new AnimatedValue(700, centerOffsetX, 0, AnimationEquation.OUT_BOUNCE);
	for (int i = 0; i < buttons.length; i++) {
		menuButtons[i].setX(center + ((i % 2 == 0) ? centerOffsetX : centerOffsetX * -1));
		menuButtons[i].resetHover();
	}

	// create title string list
	actualTitle = new ArrayList<>();
	String[] title = getTitle();
	int maxLineWidth = (int) (displayContainer.width * 0.96f);
	for (String aTitle : title) {
		// wrap text if too long
		if (Fonts.LARGE.getWidth(aTitle) > maxLineWidth) {
			List<String> list = Fonts.wrap(Fonts.LARGE, aTitle, maxLineWidth, false);
			actualTitle.addAll(list);
		} else {
			actualTitle.add(aTitle);
		}
	}
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:27,代码来源:ButtonMenu.java

示例6: draw

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
/**
 * Draws the title and buttons to the graphics context.
 * @param container the game container
 * @param game the game
 * @param g the graphics context
 */
public void draw(GameContainer container, StateBasedGame game, Graphics g) {
	// draw title
	if (actualTitle != null) {
		float marginX = container.getWidth() * 0.015f, marginY = container.getHeight() * 0.01f;
		int lineHeight = Fonts.LARGE.getLineHeight();
		for (int i = 0, size = actualTitle.size(); i < size; i++)
			Fonts.LARGE.drawString(marginX, marginY + (i * lineHeight), actualTitle.get(i), Color.white);
	}

	// draw buttons
	for (int i = 0; i < buttons.length; i++)
		menuButtons[i].draw(buttons[i].getColor());

	UI.draw(g);
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:22,代码来源:ButtonMenu.java

示例7: enter

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
/**
 * Processes a state enter request.
 * @param container the game container
 * @param game the game
 */
public void enter(GameContainer container, StateBasedGame game) {
	float center = container.getWidth() / 2f;
	float centerOffsetX = container.getWidth() * OFFSET_WIDTH_RATIO;
	centerOffset = new AnimatedValue(700, centerOffsetX, 0, AnimationEquation.OUT_BOUNCE);
	for (int i = 0; i < buttons.length; i++) {
		menuButtons[i].setX(center + ((i % 2 == 0) ? centerOffsetX : centerOffsetX * -1));
		menuButtons[i].resetHover();
	}

	// create title string list
	actualTitle = new ArrayList<String>();
	String[] title = getTitle(container, game);
	int maxLineWidth = (int) (container.getWidth() * 0.96f);
	for (int i = 0; i < title.length; i++) {
		// wrap text if too long
		if (Fonts.LARGE.getWidth(title[i]) > maxLineWidth) {
			List<String> list = Fonts.wrap(Fonts.LARGE, title[i], maxLineWidth, false);
			actualTitle.addAll(list);
		} else
			actualTitle.add(title[i]);
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:28,代码来源:ButtonMenu.java

示例8: render

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
@Override
public void render(Graphics g) {
	g.setColor(Color.red);
	int y = 200;
	for (StoryboardMover mover : movers) {
		mover.render(g);
		String text = mover.toString();
		Fonts.SMALL.drawString(screenWidth - Fonts.SMALL.getWidth(text) - 30, y, text);
		int dif = y;
		y += Fonts.SMALL.getLineHeight() * 1.1f;
		dif = y - dif;
		RenderUtils.fillCenteredRect(g, screenWidth - 20, y - dif / 2, 5);
	}
	movablePointCollectionRenderer.render(g);
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:16,代码来源:StoryboardMoveImpl.java

示例9: revalidate

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
@Override
public void revalidate() {
	super.revalidate();

	btnAddLinear = new SimpleButton(displayContainer.width - 205, 50, 200, 25, Fonts.SMALL, "add linear", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
	btnAddQuadratic = new SimpleButton(displayContainer.width - 205, 80, 200, 25, Fonts.SMALL, "add quadratic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
	btnAddCubic = new SimpleButton(displayContainer.width - 205, 110, 200, 25, Fonts.SMALL, "add cubic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
	btnAnimLin = new SimpleButton(displayContainer.width - 250, 50, 40, 25, Fonts.SMALL, "lin", Color.blue, Color.white, Color.white, Color.orange);
	btnAnimMid = new SimpleButton(displayContainer.width - 250, 80, 40, 25, Fonts.SMALL, "mid", Color.blue, Color.white, Color.white, Color.orange);
	btnAnimCub = new SimpleButton(displayContainer.width - 250, 110, 40, 25, Fonts.SMALL, "cub", Color.blue, Color.white, Color.white, Color.orange);
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:12,代码来源:MoveStoryboard.java

示例10: toggle

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
@Override
public void toggle () {
	super.toggle();
	if (!state) {
		return;
	}
	try {
		Fonts.LARGE.loadGlyphs();
		Fonts.MEDIUM.loadGlyphs();
		Fonts.DEFAULT.loadGlyphs();
	} catch (SlickException e) {
		Log.warn("Failed to load glyphs.", e);
	}
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:15,代码来源:Options.java

示例11: onRender

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
@Override
public void onRender(Graphics g) {
	if (!OPTION_DANCE_ENABLE_SB.state || hide) {
		return;
	}
	int lh = Fonts.SMALL.getLineHeight();
	Fonts.SMALL.drawString(10, displayContainer.height - 50 + lh, "save position: ctrl+s, load position: ctrl+l", Color.cyan);
	Fonts.SMALL.drawString(10, displayContainer.height - 50, "speed: C " + (speed / 10f) + " V", Color.cyan);
	Fonts.SMALL.drawString(10, displayContainer.height - 50 - lh, "Menu: N", Color.cyan);
	Fonts.SMALL.drawString(10, displayContainer.height - 50 - lh * 2, "HIDE: H", Color.cyan);
	Fonts.SMALL.drawString(10, displayContainer.height - 50 - lh * 3, "obj: J " + index + " K", Color.cyan);
	g.setColor(Color.red);
	if (index < optionsMap.length && optionsMap[index] != null) {
		int i = 0;
		for (Object o : optionsMap[index].entrySet()) {
			Map.Entry<Option, String> option = (Map.Entry<Option, String>) o;
			Fonts.SMALL.drawString(10, 50 + i * lh, option.getKey().name, Color.cyan);
			Fonts.SMALL.drawString(displayContainer.width / 5, 50 + i * lh, option.getKey().getValueString(), Color.cyan);
			g.fillRect(0, 50 + i * lh + lh / 4, 10, 10);
			i++;
		}
	}
	if (gameObjects.length > 0) {
		int start = gameObjects[0].getTime();
		int end = gameObjects[gameObjects.length - 1].getEndTime();
		float curtime = (float) (MusicController.getPosition() - start) / (end - start);
		g.fillRect(curtime * displayContainer.width, displayContainer.height - 10f, 10f, 10f);
	}
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:30,代码来源:StoryboardOverlay.java

示例12: drawText

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
/**
 * @return x position where the next block can be drawn (right aligned)
 */
private int drawText(Graphics g, Color color, String text, int x, int y) {
	int width = Fonts.SMALL.getWidth(text) + 10;
	g.setColor(color);
	g.fillRoundRect(x - width, y, width, singleHeight + 6, 5, 25);
	Fonts.SMALL.drawString(x - width + 3, y + 3, text, Color.black);
	return x - width - 6;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:11,代码来源:FpsRenderState.java

示例13: render

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
public void render(Graphics g) {
	if (timeShown >= TOTAL_TIME) {
		return;
	}
	timeShown += displayContainer.renderDelta;
	processAnimations();
	g.setColor(bgcol);
	g.fillRect(0, displayContainer.height / 2 - barHalfHeight, displayContainer.width, barHalfHeight * 2);
	int y = textY;
	for (String line : lines) {
		Fonts.LARGE.drawString((displayContainer.width - Fonts.LARGE.getWidth(line)) / 2, y, line, textCol);
		y += Fonts.LARGE.getLineHeight();
	}
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:15,代码来源:BarNotificationState.java

示例14: init

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
/**
 * Initializes the base coordinates for drawing.
 * @param containerWidth the container width
 * @param topY the top y coordinate
 */
public static void init(int containerWidth, float topY) {
	ScoreData.containerWidth = containerWidth;
	baseX = containerWidth * 0.01f;
	baseY = topY;
	buttonWidth = containerWidth * 0.4f;
	float gradeHeight = GameImage.MENU_BUTTON_BG.getImage().getHeight() * 0.45f;
	buttonHeight = Math.max(gradeHeight, Fonts.DEFAULT.getLineHeight() * 3.03f);
	buttonOffset = buttonHeight + gradeHeight / 10f;
	buttonAreaHeight = (SongMenu.MAX_SCORE_BUTTONS - 1) * buttonOffset + buttonHeight;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:16,代码来源:ScoreData.java

示例15: revalidate

import itdelatrisu.opsu.ui.Fonts; //导入依赖的package包/类
/**
 * Initializes the menu state.
 */
public void revalidate(Image button, Image buttonL, Image buttonR) {
	float center = displayContainer.width / 2;
	float baseY = getBaseY();
	float offsetY = button.getHeight() * 1.25f;

	menuButtons = new MenuButton[buttons.length];
	for (int i = 0; i < buttons.length; i++) {
		MenuButton b = new MenuButton(button, buttonL, buttonR, center, baseY + (i * offsetY));
		b.setText(String.format("%d. %s", i + 1, buttons[i].getText()), Fonts.XLARGE, Color.white);
		b.setHoverFade();
		menuButtons[i] = b;
	}
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:17,代码来源:ButtonMenu.java


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