當前位置: 首頁>>代碼示例>>Java>>正文


Java GlyphLayout類代碼示例

本文整理匯總了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);
  }
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:19,代碼來源:Renderer.java

示例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);
	
}
 
開發者ID:omar6597,項目名稱:alquran-alkarem,代碼行數:22,代碼來源:TextActor.java

示例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();
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:28,代碼來源:IngameMenu.java

示例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();
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:22,代碼來源:NewGameMenu.java

示例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...");
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:29,代碼來源:MenuState.java

示例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);
    }
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:24,代碼來源:Credits.java

示例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);
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:21,代碼來源:CreateGameSlot.java

示例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();
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:23,代碼來源:LoadGameMenu.java

示例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;

}
 
開發者ID:MusicDev33,項目名稱:JGame,代碼行數:19,代碼來源:Crafting.java

示例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;

}
 
開發者ID:MusicDev33,項目名稱:JGame,代碼行數:24,代碼來源:MainMenu.java

示例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();

}
 
開發者ID:DaanVanYperen,項目名稱:odb-dynasty,代碼行數:27,代碼來源:ProgressRenderSystem.java

示例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;
}
 
開發者ID:JayStGelais,項目名稱:jrpg-engine,代碼行數:25,代碼來源:TextArea.java

示例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);
}
 
開發者ID:janithjeewantha,項目名稱:OmiClub,代碼行數:23,代碼來源:TrumpSelectScreen.java

示例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);
}
 
開發者ID:janithjeewantha,項目名稱:OmiClub,代碼行數:24,代碼來源:PlayerSelector.java

示例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;
	}
}
 
開發者ID:stdio2016,項目名稱:ShapeClear,代碼行數:21,代碼來源:FPSCounter.java


注:本文中的com.badlogic.gdx.graphics.g2d.GlyphLayout類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。