本文整理汇总了Java中itdelatrisu.opsu.ui.Fonts.wrap方法的典型用法代码示例。如果您正苦于以下问题:Java Fonts.wrap方法的具体用法?Java Fonts.wrap怎么用?Java Fonts.wrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类itdelatrisu.opsu.ui.Fonts
的用法示例。
在下文中一共展示了Fonts.wrap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: 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]);
}
}
示例3: recalculateDimensions
import itdelatrisu.opsu.ui.Fonts; //导入方法依赖的package包/类
private void recalculateDimensions() {
this.lines = Fonts.wrap(Fonts.SMALLBOLD, message, (int) (width * 0.96f), true);
this.height = (int) (Fonts.SMALLBOLD.getLineHeight() * (lines.size() + 0.5f));
}
示例4: calculatePosition
import itdelatrisu.opsu.ui.Fonts; //导入方法依赖的package包/类
private void calculatePosition() {
this.lines = Fonts.wrap(Fonts.LARGE, message, (int) (displayContainer.width * 0.96f), true);
int textHeight = (int) (Fonts.LARGE.getLineHeight() * (lines.size() + 0.5f));
textY = (displayContainer.height - textHeight) / 2 + (int) (Fonts.LARGE.getLineHeight() / 5f);
barHalfTargetHeight = textHeight / 2;
}