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


Java LabelStyle类代码示例

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


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

示例1: ScrollInventoryActor

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
public ScrollInventoryActor(Inventory inventory, int slots) {
	defaults().space(4f);

	add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
	row();

	inner = new Table();
	inner.defaults().space(4f);
	for (int i = 0; i < inventory.itemStacks.length; i++) {
		SlotActor slotActor = new SlotActor(inventory, i);
		inner.add(slotActor);

		if ((i + 1) % inventory.width == 0) {
			inner.row();
		}
	}
	inner.pack();

	scrollPane = new ScrollPane(inner);
	scrollPane.setScrollingDisabled(true, false);
	add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
	row();
	pack();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:25,代码来源:ScrollInventoryActor.java

示例2: InventoryActor

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
public InventoryActor(Inventory inventory) {
	defaults().space(4f);

	add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE))).colspan(inventory.width);
	row();

	SlotActor slotActor;
	for (int i = 0; i < inventory.itemStacks.length; i++) {
		slotActor = new SlotActor(inventory, i);
		add(slotActor);

		if ((i + 1) % inventory.width == 0) {
			row();
		}
	}

	pack();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:19,代码来源:InventoryActor.java

示例3: ScrollInventoryActor

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
public ScrollInventoryActor(Inventory inventory, int slots) {
  defaults().space(4f);

  add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
  row();

  inner = new Table();
  inner.defaults().space(4f);
  for (int i = 0; i < inventory.itemStacks.length; i++) {
    SlotActor slotActor = new SlotActor(inventory, i);
    inner.add(slotActor);

    if ((i + 1) % inventory.width == 0) {
      inner.row();
    }
  }
  inner.pack();

  scrollPane = new ScrollPane(inner);
  scrollPane.setScrollingDisabled(true, false);
  add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
  row();
  pack();
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:25,代码来源:ScrollInventoryActor.java

示例4: InventoryActor

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
public InventoryActor(Inventory inventory) {
  defaults().space(4f);

  add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE))).colspan(inventory.width);
  row();

  for (int i = 0; i < inventory.itemStacks.length; i++) {
    SlotActor slotActor = new SlotActor(inventory, i);
    add(slotActor);

    if ((i + 1) % inventory.width == 0) {
      row();
    }
  }

  pack();
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:18,代码来源:InventoryActor.java

示例5: createInfoLabel

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
private void createInfoLabel() {
    infoBackground = new Image();
    TextureRegionDrawable image =
            new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default"));
    infoBackground.setDrawable(image.tint(new Color(0, 0, 0, 0.6f)));
    infoBackground.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getWidth() / 20);
    stage.addActor(infoBackground);

    infoLabel = new Label("", skin);
    FreeTypeFontParameter fontParameter = new FreeTypeFontParameter();
    fontParameter.size = Gdx.graphics.getWidth() / 30;
    LabelStyle style = new LabelStyle();
    style.font = fontGenerator.generateFont(fontParameter);
    style.fontColor = Color.WHITE;
    infoLabel.setStyle(style);
    infoLabel.setWidth(Gdx.graphics.getWidth());
    stage.addActor(infoLabel);
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:19,代码来源:HUD.java

示例6: stylePropertyChanged

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
@Override
public void stylePropertyChanged(StyleProperty styleProperty,
        Actor styleActor) {
    if (styleProperty.type == Drawable.class) {
        dialogFactory.showDialogDrawables(styleProperty);
    } else if (styleProperty.type == Color.class) {
        dialogFactory.showDialogColors(styleProperty);
    } else if (styleProperty.type == BitmapFont.class) {
        dialogFactory.showDialogFonts(styleProperty);
    } else if (styleProperty.type == Float.TYPE) {
        main.getUndoableManager().addUndoable(new UndoableManager.DoubleUndoable(main, styleProperty, ((Spinner) styleActor).getValue()), false);
    } else if (styleProperty.type == ScrollPaneStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    } else if (styleProperty.type == LabelStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    } else if (styleProperty.type == ListStyle.class) {
        main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
    }
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:20,代码来源:MainListener.java

示例7: showTooltip

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
public void showTooltip(Actor actor) {
    Vector2 v = new Vector2();
    actor.localToStageCoordinates(v);
    if (tooltip == null) {
        LabelStyle style = new LabelStyle();
        style.font = tooltipStyle.font;
        style.background = tooltipStyle.background;
        style.fontColor = tooltipStyle.fontColor;
        tooltip = new Label(tooltips.get(actor), style);
        tooltip.setStyle(style);
        tooltip.pack();
        tooltip.setPosition(v.x + 7.5f, v.y - tooltip.getPrefHeight() - 15);

        tooltip.setOriginY(tooltip.getPrefHeight());
        tooltip.setColor(1, 1, 1, 0);
        tooltip.setScale(1, 0);
        tooltip.addAction(parallel(fadeIn(0.15f), scaleTo(1, 1, 0.15f)));
    } else {
        tooltip.setText(tooltips.get(actor));
        tooltip.pack();
        tooltip.setPosition(v.x + 7.5f, v.y - tooltip.getPrefHeight() - 15);
    }
    stage.addActor(tooltip);
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:25,代码来源:Tooltips.java

示例8: addLine

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
/**
 * Adds a new line of text to the tooltip.
 * 
 * This will create a new label, add it as new row
 * to the tooltip and then return it.
 * 
 * The created label will use the supplied style.
 * 
 * If the supplied text is empty or null, this will return null;
 * 
 * @param newText
 * @return
 */
public Label addLine(CharSequence newText, LabelStyle style) {
	if (newText == null || newText.length() < 1) {
		return null;
	}
	Label label = newLabel(newText, style);
	Cell<?> cell = add(label).prefWidth(this.style.width).fill().align(Align.left).padLeft(this.style.padLeft).padRight(this.style.padRight).padTop(getRows() == 0 ? this.style.padTop : 0).padBottom(this.style.padBottom);
	row();
	if (getRows() > 1) {
		getCells().get(getRows()-2).padBottom(0);
	}
	pack();
	cell.width(label.getGlyphLayout().width);
	invalidateHierarchy();
	this.pack();
	return label;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:30,代码来源:CompositeTooltip.java

示例9: init

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
public void init(){
	stage = new Stage(new ScreenViewport());
	Gdx.input.setInputProcessor(stage);
	
	mainTable = new Table();
	mainTable.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	
	stage.addActor(mainTable);
	
	font = new BitmapFont(Gdx.files.internal("font2.fnt"));
	
	blueTextButtonStyle = new TextButtonStyle();
	blueTextButtonStyle.up = TextureUtils.createDrawable(new Color(52f / 255f, 73f / 255f, 94f / 255f, 1.0f), 300, 75);
	blueTextButtonStyle.down = TextureUtils.createDrawable(new Color(44f / 255f, 62f / 255f, 80f / 255f, 1.0f), 300, 75);
	blueTextButtonStyle.over = TextureUtils.createDrawable(new Color(60f / 255f, 84f / 255f, 108f / 255f, 1.0f), 300, 75);
	blueTextButtonStyle.font = font;
	blueTextButtonStyle.fontColor = Color.BLACK;
	
	labelStyle = new LabelStyle();
	labelStyle.background = blueTextButtonStyle.up;
	labelStyle.font = font;
	labelStyle.fontColor = Color.WHITE;
}
 
开发者ID:Portals,项目名称:DropTheCube-LD32,代码行数:24,代码来源:BasicGUI.java

示例10: show

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
@Override
public void show() {
	//��ʼ
	float width = 800;
       float height = 480; 
   	//��̨
       stage = new Stage(width, height,true);  
       //��Դ
       AssetManager manager = HjGame.getManager();
       HjGame.load(manager);
       //����
       bitmapFont = new BitmapFont();
       style = new LabelStyle(bitmapFont, bitmapFont.getColor()); 
       loadLabel=new Label("loading... 0%", style);
       loadLabel.setPosition(width/2-loadLabel.getWidth()/2, height/3);
       Image imageBg = new Image(new Texture(Gdx.files.internal("data/loading.png")));  
       imageBg.setPosition(width/2-imageBg.getWidth()/2, height/2-imageBg.getHeight()/2);
       stage.addActor(imageBg); 
       stage.addActor(loadLabel);
       
      
       Gdx.input.setInputProcessor(stage);
}
 
开发者ID:younfor,项目名称:network-poker,代码行数:24,代码来源:LoadScreen.java

示例11: addTimer

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
/**
 * Ajoute un timer à l'interface.
 *
 * @param aTimer Le Timer à utiliser
 */
public void addTimer(final Timer aTimer) {
    LabelStyle timerStyle = new LabelStyle();
    timerStyle.font = skin.getFont("timer");
    timerStyle.background = skin.getDrawable("frame_left");
    skin.add("timer", timerStyle);

    aTimer.addObserver(this);
    timerColorAction = new ColorAction();
    timerColorAction.setEndColor(Color.WHITE);
    timerColorAction.setDuration(0.5f);
    timerLabel = new Label(aTimer.toString(), skin, "timer");

    timerContainer.setActor(timerLabel);
    timerContainer.height(48);
}
 
开发者ID:naomiHauret,项目名称:OdysseeDesMaths,代码行数:21,代码来源:MiniGameUI.java

示例12: addItems

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
/**
 * Ajoute des items actifs à l'interface.
 */
public void addItems() {
    skin.add("itemCounter", new LabelStyle(skin.getFont("itemCounter"), null));

    activeItems = new HashMap<Sprite, Integer>();
    itemsGroup = new Table();
    itemsGroup.addAction(new Action() {
        @Override
        public boolean act(float delta) {
            itemsGroup.clearChildren();

            for (Map.Entry<Sprite, Integer> entry : activeItems.entrySet()) {
                itemImage = new Image(entry.getKey());
                itemsGroup.add(itemImage).padRight(Gdx.graphics.getWidth() / 50);
                itemCounter = new Label(entry.getValue().toString(), skin, "itemCounter");
                itemsGroup.add(itemCounter).padRight(Gdx.graphics.getWidth() / 15);
            }

            return false;
        }
    });

    itemsContainer.setActor(itemsGroup);
}
 
开发者ID:naomiHauret,项目名称:OdysseeDesMaths,代码行数:27,代码来源:MiniGameUI.java

示例13: MenuPrincipal

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
public MenuPrincipal(OdysseeDesMaths jeu) {
    this.jeu = jeu;

    this.currentState = State.NORMAL;
    this.viewport = new StretchViewport(WIDTH, HEIGHT);
    this.stage = new Stage(viewport);
    this.tableau = new Table();
    this.skin = new Skin();
    this.skin.addRegions(Assets.getManager().get(Assets.UI_MAIN, TextureAtlas.class));
    this.skin.addRegions(Assets.getManager().get(Assets.UI_ORANGE, TextureAtlas.class));
    this.skin.add("background", Assets.getManager().get(Assets.MAIN_MENU_BACKGROUND, Texture.class));

    //propriétés relatives à la police
    this.ftfp = new FreeTypeFontParameter();
    this.menuFont = new BitmapFont();
    this.fontButton = new BitmapFont();

    this.playButtonStyle = new TextButtonStyle();
    this.gameTitleStyle = new LabelStyle();
    this.audioButtons = new AudioButtons();

    this.createUI();
}
 
开发者ID:naomiHauret,项目名称:OdysseeDesMaths,代码行数:24,代码来源:MenuPrincipal.java

示例14: addOption

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
/**
 * adds an option to the menu page. Each menu page must have at least one option.
 * An option can either be enabled or disabled.
 * <br><br>
 * If it is disabled then it will be ignored for the {@link GameMenu#increaseSelection()} and {@link GameMenu#decreaseSelection()} calls and for the
 * {@link #getInitialOptionIndex()} method.
 * 
 * @param label 		text of the option
 * @param enabled		<b>true</b> to enable the option. <b>false</b> to disable the option and to
 * 						exclude it from the increase-/decreaseSelection() and getInitialOptioinIndex() calls 
 * @param style 		LabelStyle of the option taken from the skin
 * @param padTop		top padding of the option
 * @param padRight		right padding of the option
 * @param padBottom		bottom padding of the option
 * @param padLeft		left padding of the option
 */
public void addOption(String label, boolean enabled, LabelStyle style, int padTop, int padRight, int padBottom, int padLeft) {
	if (options == null) {
		// no options defined yet
		// --> initialize options and optionEnabled arrays
		options = new Array<Label>();
		optionEnabled = new Array<Boolean>();
	}

	// create a new label with the specified text and style
	Label lbl = null;
	if (style == null) {
		lbl = new Label(label, skin.get("default", LabelStyle.class));
	} else {
		lbl = new Label(label, style);
	}
	// add the new label to the options and optionEnabled arrays
	options.add(lbl);
	optionEnabled.add(enabled);
	// add the new option to the table instance with the specified padding
	// and also make a call to the row() method to finish one row of the table.
	// This means that only one label is displayed per row
	table.add(lbl).pad(padTop, padLeft, padBottom, padRight).row();
}
 
开发者ID:Quillraven,项目名称:Protoman-vs-Megaman,代码行数:40,代码来源:GameMenuPage.java

示例15: initialize

import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle; //导入依赖的package包/类
@Override
public void initialize() {
	currentMode = Integer.parseInt(GameUtils.getCfgPreferenceValue(GameConstants.PREFERENCE_KEY_WIDTH));

	availableResolutions43 = new TreeMap<Integer, Integer>();
	availableResolutions43.put(currentMode, Integer.parseInt(GameUtils.getCfgPreferenceValue(GameConstants.PREFERENCE_KEY_HEIGHT)));

	DisplayMode[] displayModes = Gdx.graphics.getDisplayModes();
	// store all remaining 4:3 resolutions
	final double aspect43 = 4.0 / 3.0;
	for (DisplayMode mode : displayModes) {
		// get current game resolution mode
		double aspect = 1.0 * mode.width / mode.height;
		if (aspect == aspect43 && !availableResolutions43.containsKey(mode.width)) {
			availableResolutions43.put(mode.width, mode.height);
		}
	}

	boolean fullscreen = Boolean.parseBoolean(GameUtils.getCfgPreferenceValue(GameConstants.PREFERENCE_KEY_FULLSCREEN));
	addOption(GameUtils.getLocalizedLabel("MainMenu.option.settings.video.fullscreen"), true, MegamanConstants.MENU_OFFSET_TOP, 0, 0, 0);
	addOption("" + fullscreen, false, skin.get("menu_suboption", LabelStyle.class), 0, 0, MegamanConstants.MENU_PADDING_BETWEEN_OPTIONS / 2, 0);
	addOption(GameUtils.getLocalizedLabel("MainMenu.option.settings.video.windowSize"), !fullscreen, !fullscreen ? skin.get("default", LabelStyle.class) : skin.get("menu_option_disabled", LabelStyle.class), 0, 0, 0, 0);
	addOption("" + currentMode + " x " + availableResolutions43.get(currentMode), false, skin.get("menu_suboption", LabelStyle.class), 0, 0, MegamanConstants.MENU_PADDING_BETWEEN_OPTIONS / 2, 0);
	addOption(GameUtils.getLocalizedLabel("MainMenu.option.back"), true, 0, 0, 0, 0);
}
 
开发者ID:Quillraven,项目名称:Protoman-vs-Megaman,代码行数:26,代码来源:VideoMenuPage.java


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