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


Java Skin.newDrawable方法代码示例

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


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

示例1: createToolTip

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
private void createToolTip()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	labelToolTip = new TextButton("TEST", skin);
	labelToolTip.setX(5);
	labelToolTip.setY(5);
	labelToolTip.setWidth(125);
	labelToolTip.setVisible(false);
	labelToolTip.getLabel().setWrap(true);
	labelToolTip.setHeight(labelToolTip.getLabel().getHeight());
	group.addActor(labelToolTip);
}
 
开发者ID:MartensCedric,项目名称:LD38-Compo,代码行数:24,代码来源:LudumDare38.java

示例2: createResetButton

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
private void createResetButton()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	btnReset = new TextButton("RESET", skin);
	btnReset.setX(5);
	btnReset.setY(Gdx.graphics.getHeight() - 25);
	btnReset.setWidth(60);
	btnReset.setVisible(true);
	group.addActor(btnReset);
}
 
开发者ID:MartensCedric,项目名称:LD38-Compo,代码行数:22,代码来源:LudumDare38.java

示例3: createUndoButton

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
private void createUndoButton()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	btnUndo = new TextButton("UNDO", skin);
	btnUndo.setX(70);
	btnUndo.setY(Gdx.graphics.getHeight() - 25);
	btnUndo.setWidth(60);
	btnUndo.setVisible(true);
	group.addActor(btnUndo);
}
 
开发者ID:MartensCedric,项目名称:LD38-Compo,代码行数:22,代码来源:LudumDare38.java

示例4: updateVisual

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
public void updateVisual(){
    Skin skin = new Skin();
    Pixmap pixmap = new Pixmap(1,(int)(Gdx.graphics.getHeight()*0.0175), Pixmap.Format.RGBA8888);
    switch (infoProfile.getDateUserGame().getFaction()){
        case 1:{
            pixmap.setColor(1, 0f, 0f, 1);
            break;
        }
        case 2:{
            pixmap.setColor(0f, 0.831f, 0.969f,1f);
            break;
        }
        case 3:{
            pixmap.setColor(0.129f, 0.996f, 0.29f,1);
            break;
        }
    }
    pixmap.fill();
    skin.add("blue", new Texture(pixmap));
    ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(bar.getStyle().background,skin.newDrawable("blue",Color.WHITE));
    style.knobBefore = style.knob;
    bar.setStyle(style);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:24,代码来源:ProgressBarEnergy.java

示例5: IntroScreen

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
IntroScreen(final ParticleGame game) {
    particle_game = game;
    stage = new Stage();
    table = new Table();

    table.setFillParent(true);
    table.setDebug(true);
    stage.addActor(table);

    Skin skin = new Skin();
    
    Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    
    skin.add("white", new Texture(pixmap));
    skin.add("font", game.getFont());

    TextButton.TextButtonStyle text_button_style = new TextButton.TextButtonStyle();
    final Color button_color = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
    final Color hover_color = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
    text_button_style.up = skin.newDrawable("white", button_color);
    text_button_style.down = skin.newDrawable("white", button_color);
    text_button_style.over = skin.newDrawable("white", hover_color);
    text_button_style.font = skin.getFont("font");
    skin.add("default", text_button_style);

    TextButton play_button = new TextButton("play", skin);
    play_button.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            particle_game.setScreen(particle_game.getGameSetupScreen());
        }
    });
    table.add(play_button);
}
 
开发者ID:treeman1111,项目名称:Particles,代码行数:37,代码来源:IntroScreen.java

示例6: ParticleChoiceScreen

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
ParticleChoiceScreen(final ParticleGame p, final GameScreen g) {
    game = p;
    game_screen = g;

    camera = new OrthographicCamera(PARTICLE_BOARD_W, PARTICLE_BOARD_W);
    camera.position.set(PARTICLE_BOARD_W / 2, PARTICLE_BOARD_W / 2, 0);
    camera.update();

    initStage();
    initTable();

    Skin skin = new Skin();

    Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add("white", new Texture(pixmap));
    skin.add("default", game.getFont());

    TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    final Color buttonColor = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
    final Color hoverColor = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
    textButtonStyle.up = skin.newDrawable("white", buttonColor);
    textButtonStyle.down = skin.newDrawable("white", buttonColor);
    textButtonStyle.over = skin.newDrawable("white", hoverColor);
    textButtonStyle.font = skin.getFont("default");
    skin.add("default", textButtonStyle);

    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = game.getFont();
    labelStyle.fontColor = Color.WHITE;
    skin.add("default", labelStyle);

    // initTableContents(skin);
}
 
开发者ID:treeman1111,项目名称:Particles,代码行数:36,代码来源:ParticleChoiceScreen.java

示例7: show

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
@Override
    public void show() {


        batch = new SpriteBatch();

        viewport = new FitViewport(Constants.DIFFICULTY_WORLD_SIZE_WIDTH, Constants.DIFFICULTY_WORLD_SIZE_HEIGHT);
        renderer = new ShapeRenderer();
        renderer.setAutoShapeType(true);


        stage = new Stage(viewport);
        Gdx.input.setInputProcessor(stage);
        Skin uiSkin = new Skin(Gdx.files.internal("UiSkin/uiskin.json"));
        button = new TextButton(menucontinue, uiSkin);

        TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
        textButtonStyle.font = font12;
        textButtonStyle.up = uiSkin.newDrawable("white", Color.DARK_GRAY);
        textButtonStyle.down = uiSkin.newDrawable("white", Color.DARK_GRAY);
        textButtonStyle.checked = uiSkin.newDrawable("white", Color.DARK_GRAY);
        textButtonStyle.over = uiSkin.newDrawable("white", Color.DARK_GRAY);
        button.setStyle(textButtonStyle);

        imageLogo = new Image();
        imageLogo.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("Star.png")))));


        /*container=new Container<Image>(imageLogo);
        container.setTransform(true);   // for enabling scaling and rotation
        container.size(100, 100);
        container.setOrigin(Align.center);//container.getWidth() / 2, container.getHeight() / 2);
        container.setPosition(100,100);
        container.setScale(1);  //scale according to your requirement
*/


        Table table = new Table();
        table.setFillParent(true);
        table.add(imageLogo);
        table.row();
        table.add(button).width(450).height(300).pad(10);
        table.row();

        stage.addActor(table);
        //container.addAction(Actions.parallel(/*Actions.moveTo(500, 300, 2.0f),*/Actions.rotate(1.f,1.0f)));//Actions.scaleTo(0.1f, 0.1f,2.0f)));

        button.addListener(new ChangeListener() {
            public void changed (ChangeEvent event, Actor actor) {

                if(!victory || (victory && level == maxNumLevels))
                    game.ShowMenuScreen();
                else
                    game.ShowSuperBullScreen(level +1);

            }
        });





    }
 
开发者ID:luarca84,项目名称:Caramelos,代码行数:64,代码来源:StatusScreen.java

示例8: DrawOneAttachers

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
private Group DrawOneAttachers(String typeFrame, String name, Color type, String photo, float energy,float energymax) {
    Group gr = new Group();
    Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
    Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
    final Image frame = new Image(new TextureRegion(txt));
    frame.setName("frame");
    frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
    frame.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
    gr.addActor(frame);
    if(InformationProfile.getInstance().getDateUserGame().getFaction() != InformationEnklave.getInstance().getFaction())
        txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
    else
        txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
    crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
    Image frameselect = new Image(new TextureRegion(txt));
    frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
    frameselect.setName("frameselect");
    frameselect.toFront();
    frameselect.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
    frameselect.setVisible(false);
    gr.addActor(frameselect);
    Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()), new Label.LabelStyle(bt, type));
    labelName.setAlignment(Align.center);
    labelName.setWidth(crop.x*0.18f);
    labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
    gr.addActor(labelName);
    txt = managerAssets.getAssetsCombat().getTexture(photo);
    crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
    Image profile = new Image(new TextureRegion(txt));
    profile.setColor(type);
    profile.setSize(crop.x * 0.07f, crop.y * 0.07f);
    profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
    gr.addActor(profile);
    Skin skin = new Skin();
    skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite), 0, 0, (int) (WIDTH * 0.014), (int) (WIDTH * 0.014)));
    ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white", type));
    barStyle.knobBefore = barStyle.knob;
    ProgressBar bar = new ProgressBar(0,energymax, 1, false, barStyle);
    bar.setSize(WIDTH * 0.14f,HEIGHT * 0.012f);
    bar.setPosition(frame.getX() + frame.getWidth() * 0.07f, frame.getY() + frame.getHeight() * 0.07f);
    bar.setValue(energy);
    gr.addActor(bar);
    return gr;
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:45,代码来源:DrawAttachers.java

示例9: drawoneDefenders

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
private Group drawoneDefenders(String typeFrame,String name,Color type,String photo,float energy,float energymax){
        Group gr = new Group();
        Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
        Vector2 crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image frame = new Image(new TextureRegion(txt));
        frame.setName("frame");
        frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
        frame.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
        gr.addActor(frame);
        if(InformationProfile.getInstance().getDateUserGame().getFaction() == InformationEnklave.getInstance().getFaction())
            txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
        else
            txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
        crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image frameselect = new Image(new TextureRegion(txt));
        frameselect.setName("frameselect");
        frameselect.toFront();
        frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
        frameselect.setPosition(WIDTH * 0.025f, HEIGHT / 2.3f);
        frameselect.setVisible(false);
        gr.addActor(frameselect);
        Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()),new Label.LabelStyle(bt,type));
        labelName.setAlignment(Align.center);
        labelName.setSize(WIDTH * 0.18f, HEIGHT * 0.02f);
        labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
        gr.addActor(labelName);
        txt = managerAssets.getAssetsCombat().getTexture(photo);
        crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
        Image profile = new Image(new TextureRegion(txt));
//        profile.setColor(Color.BLUE);
        profile.setSize(crop.x*0.07f, crop.y*0.07f);
        profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
        gr.addActor(profile);
        Skin skin = new Skin();
        skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite),0,0,(int)(WIDTH*0.004),(int)(WIDTH*0.014)));
        ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white",type));
        barStyle.knobBefore = barStyle.knob;
        ProgressBar bar = new ProgressBar(0, energymax, 1, false, barStyle);
        bar.setSize(WIDTH * 0.14f, HEIGHT * 0.012f);
        bar.setPosition(frame.getX()+frame.getWidth()*0.1f, frame.getY()+frame.getHeight()*0.07f);
        bar.setValue(energy);
        gr.addActor(bar);
        return gr;
    }
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:45,代码来源:DrawDefenders.java

示例10: GameSetupScreen

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
GameSetupScreen(ParticleGame game) {
    particle_game = game;
    stage = new Stage();
    table = new Table();

    table.setDebug(true);
    table.setFillParent(true);
    stage.addActor(table);

    Skin skin = new Skin();

    Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();

    skin.add("white", new Texture(pixmap));
    skin.add("font", game.getFont());

    TextButton.TextButtonStyle text_button_style = new TextButton.TextButtonStyle();
    final Color button_color = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
    final Color hover_color = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
    text_button_style.up = skin.newDrawable("white", button_color);
    text_button_style.down = skin.newDrawable("white", button_color);
    text_button_style.over = skin.newDrawable("white", hover_color);
    text_button_style.font = skin.getFont("font");
    skin.add("default", text_button_style);

    TextButton create_game_button = new TextButton("create game!", skin);
    create_game_button.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            final int num_boards = 10;
            final PlayerCamera player_camera = new PlayerCamera(PARTICLE_BOARD_W, PARTICLE_BOARD_W,
                PARTICLE_BOARD_W * num_boards
            );
            final DisplayManager display_manager = new DisplayManager(particle_game.getBatch(), player_camera);
            final PropertyDictionary property_dictionary = new PropertyDictionary(10, 10, 10, 10);
            final ParticleSystem particle_system = new ParticleSystem(PARTICLE_BOARD_W, num_boards);
            final VelocitySystem velocity_system = new VelocitySystem(PARTICLE_BOARD_W / 9);
            final WorldGenerator world_generator = new WorldGenerator(
                    11, 25, PARTICLE_BOARD_W * num_boards
            );

            particle_game.setCamera(player_camera);
            particle_game.setDisplayManager(display_manager);
            particle_game.setPropertyDictionary(property_dictionary);
            particle_game.setParticleSystem(particle_system);
            particle_game.setVelocitySystem(velocity_system);

            world_generator.generate(property_dictionary, particle_system);
            final Player player = new Player(particle_game, 0, 50);
            particle_game.setPlayer(player);

            particle_game.setScreen(particle_game.getGameScreen());
        }
    });
    table.add(create_game_button);
}
 
开发者ID:treeman1111,项目名称:Particles,代码行数:59,代码来源:GameSetupScreen.java


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