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


Java ImageButton.ImageButtonStyle方法代码示例

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


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

示例1: drawdefenders

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
private void drawdefenders(){
    defenders = new DrawDefenders();
    groupBtnDefender = new Group();
    Button btn1 = new Button(new ImageButton.ImageButtonStyle());
    btn1.setName("btn1");
    btn1.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f);
    btn1.setPosition(Gdx.graphics.getWidth() * 0.025f, Gdx.graphics.getHeight() / 2.3f - Gdx.graphics.getHeight() * 0.14f);
    groupBtnDefender.addActor(btn1);
    Button btn2 = new Button(new ImageButton.ImageButtonStyle());
    btn2.setName("btn2");
    btn2.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f);
    btn2.setPosition(Gdx.graphics.getWidth() * 0.025f, Gdx.graphics.getHeight() / 2.3f);
    groupBtnDefender.addActor(btn2);
    Button btn3 = new Button(new ImageButton.ImageButtonStyle());
    btn3.setName("btn3");
    btn3.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f);
    btn3.setPosition(Gdx.graphics.getWidth() * 0.025f, Gdx.graphics.getHeight() / 2.3f + Gdx.graphics.getHeight() * 0.14f);
    groupBtnDefender.addActor(btn3);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:20,代码来源:ScreenCombat.java

示例2: drawAttachers

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
private void drawAttachers(){
    attachers = new DrawAttachers();
    Button btn1 = new Button(new ImageButton.ImageButtonStyle());
    btn1.setName("btn4");
    btn1.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f);
    btn1.setPosition(Gdx.graphics.getWidth() - btn1.getWidth() * 1.13f, Gdx.graphics.getHeight() / 2.3f - Gdx.graphics.getHeight() * 0.14f);
    groupBtnDefender.addActor(btn1);
    Button btn2 = new Button(new ImageButton.ImageButtonStyle());
    btn2.setName("btn5");
    btn2.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f);
    btn2.setPosition(Gdx.graphics.getWidth() - btn2.getWidth() * 1.13f, Gdx.graphics.getHeight() / 2.3f);
    groupBtnDefender.addActor(btn2);
    Button btn3 = new Button(new ImageButton.ImageButtonStyle());
    btn3.setName("btn6");
    btn3.setSize(Gdx.graphics.getWidth() * 0.18f, Gdx.graphics.getWidth() * 0.2f);
    btn3.setPosition(Gdx.graphics.getWidth() - btn3.getWidth() * 1.13f, Gdx.graphics.getHeight() / 2.3f + Gdx.graphics.getHeight() * 0.14f);
    groupBtnDefender.addActor(btn3);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:19,代码来源:ScreenCombat.java

示例3: shouldParseSingleButtonWithImages

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldParseSingleButtonWithImages() throws Exception {
    FileHandle defaultFont = Gdx.files.internal("share/MLFZS.ttf");

    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("single-button/MainScene.json"), null, null, defaultFont, null);

    Group group = editor.createGroup();
    Actor actor = group.findActor("Button_1");

    assertThat(actor, not(nullValue()));
    assertThat(actor, instanceOf(ImageButton.class));
    ImageButton imageButton = (ImageButton) actor;
    assertThat(imageButton.getScaleX(), is(1.7958f));
    assertThat(imageButton.getScaleY(), is(1.8041f));
    ImageButton.ImageButtonStyle style = imageButton.getStyle();
    assertThat(style.imageDisabled, instanceOf(NinePatchDrawable.class));
    assertThat(style.up, instanceOf(NinePatchDrawable.class));
    assertThat(style.down, instanceOf(NinePatchDrawable.class));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:22,代码来源:CCButtonTest.java

示例4: ItemBox

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
public ItemBox(ItemStack stack, int inventoryX, int inventoryY, String extra) {
	this.stack = stack;
	this.inventoryX = inventoryX;
	this.inventoryY = inventoryY;
	this.extra = extra;

	btnGroup = CachePool.getGroup();
	btnGroup.setBounds(0, 0, 60, 60);

	style = new ImageButton.ImageButtonStyle();
	style.up = inventoryBoxDrawable;
	btn = new ImageButton(style);
	btn.setBounds(0, 0, 60, 60);
	btn.setName(extra);
	btnGroup.addActor(btn);

	setupBox();
	add(btnGroup);
}
 
开发者ID:jmrapp1,项目名称:TerraLegion,代码行数:20,代码来源:ItemBox.java

示例5: GameSpeedController

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
public GameSpeedController(TextureAtlas buttonAtlas) {
	btnPauseStyle = new ImageButton.ImageButtonStyle();
	btnPauseStyle.up = new TextureRegionDrawable(buttonAtlas.findRegion("pause-up"));
	btnPauseStyle.down = new TextureRegionDrawable(buttonAtlas.findRegion("pause-down"));

	btnPlayStyle = new ImageButton.ImageButtonStyle();
	btnPlayStyle.up = new TextureRegionDrawable(buttonAtlas.findRegion("play-up"));
	btnPlayStyle.down = new TextureRegionDrawable(buttonAtlas.findRegion("play-down"));

	btnSlowStyle = new ImageButton.ImageButtonStyle();
	btnSlowStyle.up = new TextureRegionDrawable(buttonAtlas.findRegion("slow-up"));
	btnSlowStyle.down = new TextureRegionDrawable(buttonAtlas.findRegion("slow-down"));

	imageButton = new ImageButton(btnPauseStyle);

	add(imageButton);

	imageButton.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			setGameSpeed();
			event.cancel();
		}
	});
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:26,代码来源:GameSpeedController.java

示例6: ControllerButton

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
/**
 * Button for the controller overlay.
 * @param key The key that it will trigger.
 * @param flipX Flip image horizontally.
 * @param flipY Flip image vertically.
 * @param rotate Rotate 90 degrees.
 */
public ControllerButton(int key, boolean flipX, boolean flipY, boolean rotate) {
    this.key = key;
    ImageButton.ImageButtonStyle style = new ImageButton.ImageButtonStyle();
    TextureRegion t = Assets.getGameTexture("controller_button");
    t.flip(flipX, flipY);
    // Rotate 90 degrees (u1 = u1, v1 = v2, u2 = u2, v2 = v1)
    if(rotate) {
        float v2 = t.getV2();
        float v1 = t.getV();
        t.setV(v2);
        t.setV2(v1);
    }

    style.imageUp = new TextureRegionDrawable(t);

    this.button = new ImageButton(style);
    this.button.addListener(new ControllerButtonListener(this));
}
 
开发者ID:arjanfrans,项目名称:master-maze,代码行数:26,代码来源:ControllerButton.java

示例7: makePurchaseDialog

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
private void makePurchaseDialog(String title, GridObjectTypeFactory typeFactory, final ImageButton.ImageButtonStyle purchaseButtonStyle) {
	purchaseDialog = new GridObjectPurchaseMenu(getStage(), title, typeFactory, new Runnable() {
		public void run() {
			hudToolButton.resetStyle();
		}
	});

	purchaseDialog.setDismissCallback(new Runnable() {
		public void run() {
			Gdx.app.log(TAG, "Tool: " + InputSystem.instance().getCurrentTool());
			purchaseDialog = null;
			if (InputSystem.instance().getCurrentTool() instanceof PickerTool) {
				hudToolButton.resetStyle();
			} else {
				hudToolButton.setStyle(purchaseButtonStyle);
			}
		}
	}).show();

}
 
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:21,代码来源:ToolMenu.java

示例8: Theme

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
private Theme() {
    buttonStyles = new ImageButton.ImageButtonStyle[4];
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:4,代码来源:Theme.java

示例9: update

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
private Theme update(final FileHandle handle) {
    if (skin == null) {
        throw new NullPointerException("A Theme.skin must be set before updating any Theme instance");
    }

    final JsonValue json = new JsonReader().parse(handle.readString());

    name = handle.nameWithoutExtension();
    displayName = json.getString("name");
    price = json.getInt("price");

    JsonValue colors = json.get("colors");
    // Java won't allow unsigned integers, we need to use Long
    background = new Color((int)Long.parseLong(colors.getString("background"), 16));
    foreground = new Color((int)Long.parseLong(colors.getString("foreground"), 16));

    JsonValue buttonColors = colors.get("buttons");
    Color[] buttons = new Color[buttonColors.size];
    for (int i = 0; i < buttons.length; ++i) {
        buttons[i] = new Color((int)Long.parseLong(buttonColors.getString(i), 16));
        if (buttonStyles[i] == null) {
            buttonStyles[i] = new ImageButton.ImageButtonStyle();
        }
        // Update the style. Since every button uses an instance from this
        // array, the changes will appear on screen automatically.
        buttonStyles[i].up = skin.newDrawable("button_up", buttons[i]);
        buttonStyles[i].down = skin.newDrawable("button_down", buttons[i]);
    }

    currentScore = new Color((int)Long.parseLong(colors.getString("current_score"), 16));
    highScore = new Color((int)Long.parseLong(colors.getString("high_score"), 16));
    bonus = new Color((int)Long.parseLong(colors.getString("bonus"), 16));
    bandColor = new Color((int)Long.parseLong(colors.getString("band"), 16));
    textColor = new Color((int)Long.parseLong(colors.getString("text"), 16));

    emptyCell = new Color((int)Long.parseLong(colors.getString("empty_cell"), 16));

    JsonValue cellColors = colors.get("cells");
    cells = new Color[cellColors.size];
    for (int i = 0; i < cells.length; ++i) {
        cells[i] = new Color((int)Long.parseLong(cellColors.getString(i), 16));
    }

    String cellTextureFile = json.getString("cell_texture");
    cellTexture = SkinLoader.loadPng("cells/"+cellTextureFile);

    return this;
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:49,代码来源:Theme.java

示例10: getStyle

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
public ImageButton.ImageButtonStyle getStyle(int button) {
    return buttonStyles[button];
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:4,代码来源:Theme.java

示例11: updateStyle

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
public void updateStyle(ImageButton.ImageButtonStyle style, int styleIndex) {
    style.imageUp = buttonStyles[styleIndex].imageUp;
    style.imageDown = buttonStyles[styleIndex].imageDown;
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:5,代码来源:Theme.java

示例12: init

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
public static void init(TextureAtlas atlas) {
	UI_SKIN = new Skin();

	FONT_DOSIS_SMALL = 					createFont("fonts/Dosis-Medium.ttf", 		18, Color.WHITE, 		null, 			0);
	FONT_DOSIS_MEDIUM_BORDER = 			createFont("fonts/Dosis-Medium.ttf", 		26, Color.WHITE, 		Color.BLACK,	2);
	FONT_DOSIS_SMALL_DIALOG_HEADLINE = 	createFont("fonts/Dosis-Medium.ttf", 		18, COLOR_DARK_BROWN, 	null, 			0);
	FONT_DOSIS_PROGRESS_TYPE = 			createFont("fonts/Dosis-Medium.ttf", 		22, COLOR_LIGHT_YELLOW, null, 			0);
	FONT_ENTSANS_SMALL = 				createFont("fonts/entsans.ttf", 			26, COLOR_LIGHT_YELLOW, null, 			0);
	FONT_LIBERATION_SMALL_BORDER = 		createFont("fonts/LiberationMono-Bold.ttf",	22, Color.WHITE, 		Color.BLACK, 	2);
	FONT_ENTSANS_TIME = 				createFont("fonts/entsans.ttf",				36, COLOR_LIGHT_YELLOW, null,			0);

	loadDefaultSkin(FONT_DOSIS_SMALL);

	NINE_PATCH_POPUP_BG_01 = 		new NinePatchDrawable(new NinePatch(atlas.findRegion("popupbg01"),16, 16, 16, 16));
	NINE_PATCH_BUTTON_BG_01 = 		new NinePatchDrawable(new NinePatch(atlas.findRegion("buttonbg01"),32, 32, 32, 32));
	NINE_PATCH_DIALOG_01 = 			new NinePatchDrawable(new NinePatch(atlas.findRegion("dialogBg01"), 33, 33, 42, 21));
	NINE_PATCH_STANDARD_BUTTON = 	new NinePatchDrawable(new NinePatch(atlas.findRegion("buttonStandard9patch"), 18, 18, 18, 18));

	TextButton.TextButtonStyle textButtonStyle = UI_SKIN.get(TextButton.TextButtonStyle.class);
	STYLE_BUTTON_01 = new TextButton.TextButtonStyle(textButtonStyle); // copy from default values
	STYLE_BUTTON_01.up = 		Styles.NINE_PATCH_BUTTON_BG_01;
	STYLE_BUTTON_01.down = 		Styles.NINE_PATCH_BUTTON_BG_01;
	STYLE_BUTTON_01.checked = 	Styles.NINE_PATCH_BUTTON_BG_01;
	STYLE_BUTTON_01.fontColor = COLOR_01;

	STYLE_BUTTON_02 = new TextButton.TextButtonStyle(textButtonStyle);
	STYLE_BUTTON_02.up = 		Styles.NINE_PATCH_STANDARD_BUTTON;
	STYLE_BUTTON_02.down = 		Styles.NINE_PATCH_STANDARD_BUTTON;
	STYLE_BUTTON_02.checked = 	Styles.NINE_PATCH_STANDARD_BUTTON;
	STYLE_BUTTON_02.font = 		FONT_DOSIS_SMALL_DIALOG_HEADLINE;

	Label.LabelStyle standardLabelStyle = UI_SKIN.get(Label.LabelStyle.class);
	LABEL_01 = new Label.LabelStyle(standardLabelStyle);
	LABEL_01.font = FONT_DOSIS_SMALL;

	LABEL_PROPERTY = new Label.LabelStyle(standardLabelStyle);
	LABEL_PROPERTY.font = FONT_DOSIS_SMALL;
	LABEL_PROPERTY.fontColor = Color.BLACK;

	LABEL_02 = new Label.LabelStyle(standardLabelStyle);
	LABEL_02.font = FONT_DOSIS_MEDIUM_BORDER;

	LABEL_DEV = new Label.LabelStyle(standardLabelStyle);
	LABEL_DEV.font = FONT_DOSIS_SMALL;

	LABEL_HUD_NUMBERS = new Label.LabelStyle(standardLabelStyle);
	LABEL_HUD_NUMBERS.font = FONT_ENTSANS_SMALL;

	LABEL_VALUE_ARTIFACT = new Label.LabelStyle(standardLabelStyle);
	LABEL_VALUE_ARTIFACT.font = FONT_ENTSANS_SMALL;
	LABEL_VALUE_ARTIFACT.fontColor = Color.BLACK;

	LABEL_DIALOG_HEADLINE = new Label.LabelStyle(standardLabelStyle);
	LABEL_DIALOG_HEADLINE.font = FONT_DOSIS_SMALL_DIALOG_HEADLINE;

	LABEL_PROGRESS_TYPE = new Label.LabelStyle(standardLabelStyle);
	LABEL_PROGRESS_TYPE.font = FONT_DOSIS_PROGRESS_TYPE;

	LABEL_RACE_TIME = new Label.LabelStyle(standardLabelStyle);
	LABEL_RACE_TIME.font = FONT_ENTSANS_TIME;

	TextField.TextFieldStyle standardTextFieldStyle = UI_SKIN.get(TextField.TextFieldStyle.class);
	TEXT_FIELD_STYLE_FAIL = new TextField.TextFieldStyle(standardTextFieldStyle);
	TEXT_FIELD_STYLE_FAIL.fontColor = Color.RED;

	TEXT_FIELD_STYLE = new TextField.TextFieldStyle(standardTextFieldStyle);

	IMAGE_BUTTON_STYLE = new ImageButton.ImageButtonStyle();
	IMAGE_BUTTON_STYLE.checked = new TextureRegionDrawable(atlas.findRegion("checkboxChecked"));
	IMAGE_BUTTON_STYLE.up = new TextureRegionDrawable(atlas.findRegion("checkbox"));

	//standardCheckBoxStyle.checked =
	//standardCheckBoxStyle.disabled =
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:75,代码来源:Styles.java

示例13: GameScreen

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
public GameScreen(AsteroidsGame asteroidsGame){
    //Load Assets
    AsteroidAssetManager.getInstance();

    stage = new Stage(new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));

    Player player = new Player(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2, AsteroidsGame.TEAM_BLUE);

    players.add(player);
    stage.addActor(player);
    stage.setKeyboardFocus(player);

    for(int i =0; i < 4; i++){
        float angle =  (float) (Math.random() * 2 * Math.PI);
        float x = (float) Math.cos(angle) * Gdx.graphics.getWidth();
        float y = (float) Math.sin(angle) * Gdx.graphics.getHeight();

        Asteroid ast = new Asteroid(x, y, 3, angle);
        stage.addActor(ast);
    }

    Hud hud = new Hud(players);
    stage.addActor(hud);

    //Add TouchPad if the player is Android
    if(Gdx.app.getType() == Application.ApplicationType.Android){
        //Create a joystick skin
        Skin touchpadSkin = new Skin();
        touchpadSkin.add("touchBackground", new Texture("touchBackground.png"));
        touchpadSkin.add("touchKnob", new Texture("touchKnob.png"));
        touchpadSkin.add("touchKnob_pressed", new Texture("touchKnob_pressed.png"));

        //Apply the Drawables to the TouchPad Style
        Touchpad.TouchpadStyle touchpadStyle = new Touchpad.TouchpadStyle();
        touchpadStyle.background = touchpadSkin.getDrawable("touchBackground");
        touchpadStyle.knob = touchpadSkin.getDrawable("touchKnob");

        //Create new TouchPad with the created style
        this.joystick = new Touchpad(10, touchpadStyle);
        this.joystick.setBounds(15, 15, 100, 100);

        ImageButton.ImageButtonStyle buttonStyle = new ImageButton.ImageButtonStyle();
        buttonStyle.imageUp = touchpadSkin.getDrawable("touchKnob");
        buttonStyle.imageDown = touchpadSkin.getDrawable("touchKnob_pressed");

        this.button = new ImageButton(buttonStyle);
        this.button.setBounds(Gdx.graphics.getWidth()-115, 15, 100, 100);

        stage.addActor(this.joystick);
        stage.addActor(this.button);
    }

}
 
开发者ID:AlexandreArpin,项目名称:unfinished-asteroids-libgdx,代码行数:54,代码来源:GameScreen.java

示例14: createStyles

import com.badlogic.gdx.scenes.scene2d.ui.ImageButton; //导入方法依赖的package包/类
public void createStyles(ResourcesManager resourcesManager) {
    if (!initialize) {
        initialize=true;
        font = resourcesManager.get(resourcesManager.DEFAULT_FONT);
        font.setScale(ScaleUtil.getSizeRatio());
        font.setUseIntegerPositions(false);
        font2 = resourcesManager.get(resourcesManager.HEADER_FONT);
        font2.setScale(ScaleUtil.getSizeRatio());
        font2.setUseIntegerPositions(false);
        skin = new Skin();
        skin.add("default", font);
        skin.add("header", font2);

        skin.add("lt-blue", new Color(.62f, .76f, .99f, 1f));
        skin.add("lt-green", new Color(.39f, .9f, .6f, 1f));
        skin.add("dark-blue", new Color(.79f, .95f, 91f, 1f));

        skin.addRegions(resourcesManager.<TextureAtlas>get(resourcesManager.GUI_ATLAS));
        skin.addRegions(resourcesManager.<TextureAtlas>get(resourcesManager.GUI_PACK_ATLAS));


        TextureRegionDrawable touchpad_background = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.GUI_ATLAS)).findRegion("touchpad_background"));
        TextureRegionDrawable touchpad_thumb = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.GUI_ATLAS)).findRegion("touchpad_thumb"));


        TextureRegionDrawable checkox_true = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.UISKIN_ATLAS)).findRegion("check-on"));

        TextureRegionDrawable checkox_false = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.UISKIN_ATLAS)).findRegion("check-off"));

        TextureRegionDrawable slider_knob = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.UISKIN_ATLAS)).findRegion("default-slider-knob"));
        TextureRegionDrawable slider = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.UISKIN_ATLAS)).findRegion("default-slider"));

        CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle(checkox_false, checkox_true, font, Color.WHITE);


        SpriteDrawable stats = new SpriteDrawable(new Sprite((Texture) resourcesManager.get(resourcesManager.STATS_BACKGROUND)));


        SliderStyle sliderStyle = new SliderStyle(slider, slider_knob);
        skin.add("default",new WindowStyle(font2,Color.ORANGE,skin.getDrawable("debug")));
        skin.add("stats", stats);


        LabelStyle lbs = new LabelStyle();
        lbs.font = font;
        lbs.fontColor = Color.WHITE;
        skin.add("default", lbs);

        LabelStyle lbsHeader = new LabelStyle();
        lbsHeader.font = font2;
        lbsHeader.fontColor = Color.WHITE;
        skin.add("header", lbsHeader);

        TextButtonStyle tbs = new TextButtonStyle(skin.getDrawable("btnMenu"), skin.getDrawable("btnMenuPress"), skin.getDrawable("btnMenu"), font);
        tbs.fontColor = skin.getColor("dark-blue");
        tbs.pressedOffsetX = Math.round(1f * Gdx.graphics.getDensity());
        tbs.pressedOffsetY = tbs.pressedOffsetX * -1f;

        ImageButton.ImageButtonStyle ImageButtonLeft = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonLeft"), skin.getDrawable("buttonLeftPress"),
                skin.getDrawable("buttonLeft"), null, null, null);
        ImageButton.ImageButtonStyle ImageButtonRight = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonRight"), skin.getDrawable("buttonRightPress"),
                skin.getDrawable("buttonRight"), null, null, null);
        ImageButton.ImageButtonStyle ImageButtonUp = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonUp"), skin.getDrawable("buttonUpPress"),
                skin.getDrawable("buttonUp"), null, null, null);


        Touchpad.TouchpadStyle touchpadStyle = new Touchpad.TouchpadStyle();
        touchpadStyle.background = touchpad_background;
        touchpadStyle.knob = touchpad_thumb;


        skin.add("default", tbs);
        skin.add("buttonLeft", ImageButtonLeft);
        skin.add("buttonRight", ImageButtonRight);
        skin.add("buttonUp", ImageButtonUp);
        skin.add("default", touchpadStyle);
        skin.add("default", checkBoxStyle);
        skin.add("default-horizontal", sliderStyle);
    }
}
 
开发者ID:Rubentxu,项目名称:DreamsLibGdx,代码行数:81,代码来源:Styles.java


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