本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.GlyphLayout类的典型用法代码示例。如果您正苦于以下问题:Java GlyphLayout类的具体用法?Java GlyphLayout怎么用?Java GlyphLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GlyphLayout类属于com.badlogic.gdx.graphics.g2d包,在下文中一共展示了GlyphLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawPlayerNames
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
void drawPlayerNames(){
GlyphLayout layout = Pools.obtain(GlyphLayout.class);
Draw.tscl(0.25f/2);
for(Player player : Vars.control.playerGroup.all()){
if(!player.isLocal){
layout.setText(Core.font, player.name);
Draw.color(0f, 0f, 0f, 0.3f);
Draw.rect("blank", player.x, player.y + 8 - layout.height/2, layout.width + 2, layout.height + 2);
Draw.color();
Draw.tcolor(NetClient.colorArray[player.id % NetClient.colorArray.length]);
Draw.text(player.name, player.x, player.y + 8);
Draw.tcolor();
}
}
Pools.free(layout);
Draw.tscl(Vars.fontscale);
}
示例2: TextActor
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
public TextActor(String string,Color color,float targetwidth,TextAlign align,float scaleXY ,float x ,float y) {
// TODO Auto-generated constructor stub
font = book.base_font;
text_string = string ;
xpos = x;
ypos = y;
width = targetwidth ;
text_color = (color==null?Color.BLACK:color) ;
this.align = align;
scale = scaleXY;
font.getData().setScale(scaleXY);
//font.setColor(Color.BLUE);
best_score_text_layout = new GlyphLayout(
font,
text_string,
text_color,
width,
this.align == TextAlign.align_cinter?Align.center:(this.align==TextAlign.align_right?Align.right:Align.left),
true);
}
示例3: IngameMenu
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
/**
* Initialisierung.
*
* @param game Zugriff auf die Spielinstanz
* @param level Zugriff auf die aktive Levelinstanz
*/
public IngameMenu(SchoolGame game, Level level)
{
this.game = game;
this.level = level;
titleFont = game.getTitleFont();
textFont = game.getDefaultFont();
smallFont = game.getLongTextFont();
selectSound = game.getAudioManager().createSound("menu", "select.wav", true);
changeSound = game.getAudioManager().createSound("menu", "change.wav", true);
batch = new SpriteBatch();
shapeRenderer = new ShapeRenderer();
localeBundle = level.getLocaleBundle();
fontLayout = new GlyphLayout();
projection = new Matrix4();
}
示例4: MenuNewSlot
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
public MenuNewSlot(String label, String detail, SaveData saveData)
{
super(label);
this.saveData = saveData;
this.detail = detail;
setCustomRendering(true);
setHeight(100);
used = saveData.isUsed() ? 1 : 0;
id = saveData.getSlot().ordinal() + 1;
playerName = saveData.getPlayerName();
gender = saveData.isMale() ? "M" : "W";
levelName = saveData.getLevelName();
formatPlaytime(saveData.getPlayTime());
fontLayout = new GlyphLayout();
}
示例5: create
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
/**
* Initialisierung.
*
* @param game zeigt auf das SchoolGame, dass das Spiel verwaltet
*/
@Override
public void create(SchoolGame game) {
Gdx.app.getApplicationLogger().log("INFO", "Menu init...");
this.game = game;
entries = new ArrayList<MenuEntry>();
this.setupMenu();
batch = new SpriteBatch();
font = game.getDefaultFont();
fontLayout = new GlyphLayout();
selectSound = game.getAudioManager().createSound("menu", "select.wav", true);
changeSound = game.getAudioManager().createSound("menu", "change.wav", true);
game.getAudioManager().selectMusic(MUSIC_NAME, 0f);
FileHandle baseFileHandle = Gdx.files.internal("data/I18n/" + getI18nName());
localeBundle = I18NBundle.createBundle(baseFileHandle);
Gdx.app.getApplicationLogger().log("INFO", "Menu finished...");
}
示例6: create
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
/**
* Initialisierung.
*
* @param game zeigt auf das SchoolGame, dass das Spiel verwaltet
*/
@Override
public void create(SchoolGame game) {
this.game = game;
batch = new SpriteBatch();
font = game.getDefaultFont();
fontLayout = new GlyphLayout();
offset -= Gdx.graphics.getHeight() / 2 - 35;
FileHandle credits = Gdx.files.internal("data/misc/credits.txt");
if (credits.exists() && !credits.isDirectory())
{
prepareCredits(credits);
}
}
示例7: create
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
/**
* Initialisierung
*
* @param game zeigt auf das SchoolGame, dass das Spiel verwaltet
*/
@Override
public void create(SchoolGame game) {
this.game = game;
saveData = new SaveData(this.game, this.slot);
batch = new SpriteBatch();
font = game.getDefaultFont();
smallFont = game.getLongTextFont();
fontLayout = new GlyphLayout();
FileHandle baseFileHandle = Gdx.files.internal("data/I18n/GameMenu");
localeBundle = I18NBundle.createBundle(baseFileHandle);
}
示例8: MenuLoadSlot
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
public MenuLoadSlot(String label, String detail, SaveData saveData)
{
super(label);
this.saveData = saveData;
this.detail = detail;
setEnabled(saveData.isUsed());
setCustomRendering(true);
setHeight(100);
used = saveData.isUsed() ? 1 : 0;
id = saveData.getSlot().ordinal() + 1;
playerName = saveData.getPlayerName();
gender = saveData.isMale() ? "M" : "W";
levelName = saveData.getLevelName();
formatPlaytime(saveData.getPlayTime());
fontLayout = new GlyphLayout();
}
示例9: Crafting
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
public Crafting(int x, int y, int wid, int hei) {
this.x = x;
this.y = y;
this.wid = wid;
this.hei = hei;
shapes = new ShapeRenderer();
this.active = true;
fontHandler = new FontHandler();
layoutSave = new GlyphLayout(fontHandler.font32, "SAVE");
widthSave = layoutSave.width;
heightSave = layoutSave.height;
layoutExit = new GlyphLayout(fontHandler.font32, "X");
widthExit = layoutExit.width;
heightExit = layoutExit.height;
}
示例10: MainMenu
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
public MainMenu(JGame game) {
this.game = game;
this.batch = game.batch;
playY = (game.screenY / 2) + 200;
loadY = (game.screenY / 2) + 100;
exitY = (game.screenY / 2);
shapes = new ShapeRenderer();
fontHandler = new FontHandler();
layoutPlay = new GlyphLayout(fontHandler.font90, "PLAY");
widthPlay = layoutPlay.width;
heightPlay = layoutPlay.height;
layoutLoad = new GlyphLayout(fontHandler.font90, "LOAD");
widthLoad = layoutLoad.width;
heightLoad = layoutLoad.height;
layoutExit = new GlyphLayout(fontHandler.font90, "EXIT");
widthExit = layoutExit.width;
heightExit = layoutExit.height;
}
示例11: initialize
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
@Override
protected void initialize() {
super.initialize();
glyphLayout = new GlyphLayout();
buildLabel = createLabel(12 * G.ZOOM, 4 * G.ZOOM + 18 * G.ZOOM, "FFFFFFFF", "Build progress", "000000FF", 4000);
scoreLabel = createLabel(80 * G.ZOOM, 4 * G.ZOOM + 18 * G.ZOOM, "FFFFFFFF", "Score:", "000000FF", 4000);
progressButton = new DynastyEntityBuilder(world)
.with(Tint.class).with(
new Bounds(0, 0, 26*G.ZOOM, 16*G.ZOOM),
new Clickable(),
new Button("btn-turn-up", "btn-turn-hover", "btn-turn-down", new ButtonListener() {
@Override
public void run() {
progressAlgorithmSystem.progress();
}
})
)
.group("progress")
.anim("btn-test-up")
.renderable(920)
.pos(7 * G.ZOOM + AssetSystem.PROGRESS_BAR_BACKGROUND_WIDTH * G.ZOOM, 4 * G.ZOOM)
.scale(G.ZOOM)
.build();
}
示例12: paginateText
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
private List<GlyphLayout> paginateText(final FontSet fontSet, final String text) {
List<GlyphLayout> results = new LinkedList<>();
Queue<String> words = new LinkedList<>();
words.addAll(Arrays.asList(text.split(" ")));
String pageText = null;
GlyphLayout layout = generateGlyphLayout(fontSet, "");
while (!words.isEmpty()) {
pageText = (pageText == null) ? words.peek() : String.join(" ", pageText, words.peek());
GlyphLayout nextLayout = generateGlyphLayout(fontSet, pageText);
if (nextLayout.height < getHeight()) {
layout = nextLayout;
words.remove();
} else {
results.add(layout);
pageText = null;
layout = generateGlyphLayout(fontSet, "");
}
}
results.add(layout);
return results;
}
示例13: show
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
@Override
public void show() {
Map<String, Sprite> loadingSprites = GraphicsLoader.getCommonBackground();
background = loadingSprites.get("background");
logo = loadingSprites.get("logo_faded");
labelFont = FontsHandler.getDefaultBitmapFont((int) (DimensionHandler.getScreenHeight() / 15));
selectTextLayout = new GlyphLayout(labelFont, "Select Trumps");
textX = DimensionHandler.getScreenWidth()/8;
textY = DimensionHandler.getScreenHeight()/6*5;
suits = GraphicsLoader.getSuits();
prepareSuits();
spriteBatch = new SpriteBatch();
stage = new Stage();
stage.clear();
stage.addActor(suits.get(Suit.HEARTS));
stage.addActor(suits.get(Suit.SPADES));
stage.addActor(suits.get(Suit.DIAMONDS));
stage.addActor(suits.get(Suit.CLUBS));
Gdx.input.setInputProcessor(stage);
}
示例14: show
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
@Override
public void show() {
Map<String, Sprite> loadingSprites = GraphicsLoader.getCommonBackground();
background = loadingSprites.get("background");
logo = loadingSprites.get("logo_faded");
labelFont = FontsHandler.getDefaultBitmapFont((int) (DimensionHandler.getScreenHeight() / 15));
selectTextLayout = new GlyphLayout(labelFont, "Select Friendly Player");
textX = DimensionHandler.getScreenWidth()/8;
textY = DimensionHandler.getScreenHeight()/6*5;
playerFont = FontsHandler.getDefaultBitmapFont((int) (DimensionHandler.getScreenHeight() / 20));
style = new Label.LabelStyle(playerFont, Color.WHITE);
setLabels();
spriteBatch = new SpriteBatch();
stage = new Stage();
stage.clear();
stage.addActor(p1Label);
stage.addActor(p2Label);
stage.addActor(p3Label);
Gdx.input.setInputProcessor(stage);
}
示例15: draw
import com.badlogic.gdx.graphics.g2d.GlyphLayout; //导入依赖的package包/类
@Override
public void draw(Batch batch,float parentAlpha){
AssetLoader.font.getData().setScale(getScaleX());
timer+=Gdx.graphics.getDeltaTime();
FPSCount++;
String text="FPS: "+fps;
GlyphLayout layout=new GlyphLayout();
layout.setText(AssetLoader.font, text);
float height=layout.height;
AssetLoader.font.draw(batch, text, 0, height);
if(FPSCount>=60)
{
fps=(int) ((float)FPSCount/timer);
timer=0;
FPSCount=0;
}
}