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


Java TextureRegionDrawable类代码示例

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


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

示例1: Arrow

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
public Arrow(String name, int health, AnimationLoader anims, float posX, float posY, Entity tg){
	super(name, health,anims);
	scale = 0.5f;
	
	target = tg;
	tpos = target.getPosition();
	texl = anims.getTex("arrowleft");
	texr = anims.getTex("arrowright");
	currentframe = new TextureRegion(texl);
	currentframe.flip(false, true);
       	
       enemyDrawable = new TextureRegionDrawable(currentframe);
	
	// Create enemy Image/Actor
	enemy = new Image(enemyDrawable);
	enemy.setX(posX);
	enemy.setY(posY);
	
	scale = ((Gdx.graphics.getHeight() - getPosition().y) / 1000) * 0.5f;
	enemy.setScale(scale);
}
 
开发者ID:AngryStickStudios,项目名称:StickFlick,代码行数:22,代码来源:Arrow.java

示例2: makeDroidTowersLogo

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
private void makeDroidTowersLogo(boolean animateBuildOut) {
	TextureAtlas.AtlasRegion droidTowersLogoTexture = atlas2.findRegion("droid-towers-logo");
	droidTowersLogo = new Image(new TextureRegionDrawable(droidTowersLogoTexture), fit);
	droidTowersLogo.setWidth(Math.min(getStage().getWidth() * 0.5f, droidTowersLogo.getWidth()));
	droidTowersLogo.layout();
	droidTowersLogo.setY(getStage().getHeight() - droidTowersLogo.getImageHeight() - 75);
	droidTowersLogo.setX(50);

	if (animateBuildOut) {
		droidTowersLogo.setX(-droidTowersLogo.getImageWidth());
		Tween.to(droidTowersLogo, WidgetAccessor.POSITION, CAMERA_PAN_DOWN_DURATION).delay(50).target(50, droidTowersLogo.getY())
				.ease(TweenEquations.easeInOutExpo).start(TweenSystem.manager());
	}

	container.addActor(droidTowersLogo);
}
 
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:17,代码来源:SplashScene.java

示例3: createSkins

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
/**
 * Function used to create the Skins' Buttons and Labels and associate them to a given table, organized.
 * It also adds Listeners to the Skins' Buttons.
 *
 * @param table Table where the Skins' Labels and Buttons will be organized.
 */
private void createSkins(Table table) {
    for (int i = 0; i < game.getNumSkins(); ++i) {

        //Adding Buttons and Labels to the Arrays
        skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class)))));
        skinLabels.add(new Label("Current", skin1));

        final int j = i; //Needed for Listener initialization
        skinButtons.get(i).addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                setCurrentLabel(j);
            }
        });

        table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE);
    }
    table.row();

    for (int i = 0; i < game.getNumSkins(); ++i)
        table.add(skinLabels.get(i));

    initializeCurrentSkin();
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:31,代码来源:CustomizeMenuScreen.java

示例4: initHUD

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
/**
 * Function used to initialize all the elements of the HUD and add the respective Listeners.
 */
private void initHUD() {
    Table hudTable = new Table();
    hudTable.setFillParent(true);

    Button pauseButton = new Button(new TextureRegionDrawable(
            new TextureRegion(game.getAssetManager().get("pause.png", Texture.class))));

    scoreText = new Label("0:00", skin);
    scoreText.setFontScale(FONT_SCALE, FONT_SCALE);

    pauseButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            model.togglePause();
        }
    });

    hudTable.top();
    hudTable.add(scoreText).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).expandX()
            .left().fill().padLeft(HORIZONTAL_PAD).padTop(VERTICAL_PAD);
    hudTable.add(pauseButton).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).fill()
            .padRight(HORIZONTAL_PAD).padTop(VERTICAL_PAD);

    this.addActor(hudTable);
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:29,代码来源:HudMenu.java

示例5: pauseGame

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
private void pauseGame() {
    if (paused)
        return;
    paused = true;

    final Window.WindowStyle pauseWindowStyle = new Window.WindowStyle();
    pauseWindowStyle.titleFont = game.getFonts().get("moonhouse64");
    pauseWindowStyle.background = new TextureRegionDrawable(new TextureRegion(background));

    pauseWindow = new PauseWindow(pauseWindowStyle, game.getFonts().get("moonhouse64"), new Runnable() {
        @Override
        public void run() {
            unpauseGame();
        }
    }, new Runnable() {
        @Override
        public void run() {
            save();
        }
    }, game, uiAssets, button);
    pauseWindow.setBounds(viewport.getWorldWidth() / 2 - viewport.getWorldWidth() / 3, viewport.getWorldHeight() / 2 - viewport.getWorldHeight() / 3, viewport.getWorldWidth() / 3 * 2, viewport.getWorldHeight() / 3 * 2);
    stage.addActor(pauseWindow);
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:24,代码来源:GameScreen.java

示例6: build

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
@Override
public void build(Group group) {
	pauseButtonTexture = new TextureRegionDrawable(new TextureRegion(new Texture("pause.png")));
	backButtonTexture = new TextureRegionDrawable(new TextureRegion(new Texture("back.png")));
	
	pauseButton = new VisImageButton(pauseButtonTexture);
	pauseButton.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			((WorldSimulator)getController()).toggleOverlayMenu();
		}
	});
	
	pauseButton.setWidth(widthVal.get(pauseButton));
	pauseButton.setHeight(heightVal.get(pauseButton));
	
	group.addActor(pauseButton);
}
 
开发者ID:mcgeer,项目名称:Climatar,代码行数:19,代码来源:PauseView.java

示例7: setObjectives

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
public void setObjectives(Objective[] objectives, boolean[] objectiveStatus)
{
    this.objectives = objectives;
    this.objectiveStatus = objectiveStatus;

    if(objectives.length != objectiveStatus.length)
        throw new IllegalArgumentException();

    getContentTable().clearChildren();
    getBackground().setMinHeight(200 + 100 * objectives.length);
    getContentTable().setDebug(false);
    for(int i = 0; i < objectives.length; i++)
    {
        ImageButton imgCheck = new ImageButton(new TextureRegionDrawable(
                new TextureRegion((Texture)
                        hexpert.assetManager.get(objectiveStatus[i] ? TEXTURE_CORRECT : TEXTURE_BAD
                ))));

        Label labelObjective = new Label(objectives[i].toString(hexpert.i18NBundle), getSkin());

        getContentTable().add(imgCheck).width(100).height(80);
        imgCheck.getImageCell().expand().fill();
        getContentTable().add(labelObjective);
        getContentTable().row();
    }
}
 
开发者ID:MartensCedric,项目名称:Hexpert,代码行数:27,代码来源:ObjectiveDialog.java

示例8: MenuScreen

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
public MenuScreen(final LePendu game) {
    super(game);

    titleImg = new Image(new TextureRegionDrawable(game.atlas.findRegion("title")));
    playBtn  = new ImageButton(new TextureRegionDrawable(game.atlas.findRegion("playBtn")));
    decosImg = new Image(new TextureRegionDrawable(game.atlas.findRegion("decos")));

    table.add(titleImg).top().padTop(169);
    table.row();
    table.add(playBtn).expandY();
    table.row();
    table.add(decosImg).bottom().padBottom(50);

    playBtn.addListener(new ChangeListener() {
        public void changed(ChangeListener.ChangeEvent event, Actor actor) {
            game.setScreen(new DifficultyScreen(game));
        }
    });
}
 
开发者ID:Frappagames,项目名称:le-pendu,代码行数:20,代码来源:MenuScreen.java

示例9: KeyboardActor

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
public KeyboardActor(final PlayScreen playScreen) {
    alphabet = new Texture("alphabet.png");

    for (int i = 0 ; i < 26 ; i++) {
        if (i%7 == 0) {
            hg  = new HorizontalGroup();
            this.addActor(hg);
        }
        final char character = (char) (i + 65);

        button = new ImageButton(new TextureRegionDrawable(new TextureRegion(alphabet, i * 90, 0, 90, 90)));
        button.addListener(new ChangeListener() {
            @Override
            public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                playScreen.proposeLetter(character);
            }
        });

        hg.addActor(button);
    }
}
 
开发者ID:Frappagames,项目名称:le-pendu,代码行数:22,代码来源:KeyboardActor.java

示例10: render

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
/**------------------------RENDER------------------------**/
@Override
public void render(float f) 
{        
    //Debug
    //stage.setDebugAll(true);
    
    //Clear Screen
    Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
    Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
    
    //Set background image
    rootTable.background(new TextureRegionDrawable(new TextureRegion(TextureManager.menuBackground)));

    //Draw stage
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
    
    /*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
    super.changeToFullScreenOnF12();
    
}
 
开发者ID:Aeo-Informatik,项目名称:Space-Bombs,代码行数:23,代码来源:MenuScreen.java

示例11: createInfoLabel

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的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

示例12: createMobileMoveButton

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
private void createMobileMoveButton() {
    float screenWidth = Gdx.graphics.getWidth();
    float screenHeight = Gdx.graphics.getHeight();

    moveButton = new Button(skin);
    moveButton.getStyle().down = new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default")).tint(MOBILE_BUTTON_DOWN_COLOR);
    moveButton.getStyle().up = new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default")).tint(MOBILE_BUTTON_UP_COLOR);
    moveButton.setSize(screenWidth * 0.35f, screenHeight * 0.2f);
    moveButton.setPosition(screenWidth / 32, screenHeight / 32f);
    moveButton.addListener(new com.badlogic.gdx.scenes.scene2d.InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            boolean isTutorial = DAO.getInstance().getBoolean(DAO.IS_NEW_KEY, true);
            if (Globals.getGameState() == Game.State.WAIT_FOR_INPUT) {
                Globals.setGameState(Game.State.RUNNING);
            }

            if (Globals.getGameState() == Game.State.RUNNING) {
                movePointer = pointer;
            }
            return true;
        }
    });

    stage.addActor(moveButton);
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:27,代码来源:HUD.java

示例13: loadAsyncImages

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
protected void loadAsyncImages()
{
    // Check if we need to load level icons and if they are loaded show them.
    if (!this.asyncImages.isEmpty())
    {
        AssetManager assMan = AssMan.getAssMan();

        ArrayList<String> texturePaths =
            new ArrayList<>(this.asyncImages.keySet());
        for (String texturePath : texturePaths)
        {
            if (assMan.update()
                || assMan.isLoaded(texturePath))
            {
                Texture texture = assMan.get(texturePath);
                texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
                this.asyncImages.get(texturePath)
                    .setDrawable(new TextureRegionDrawable(new TextureRegion(texture)));

                this.asyncImages.remove(texturePath);
            }
        }
    }
}
 
开发者ID:overengineering,项目名称:space-travels-3,代码行数:25,代码来源:Screen.java

示例14: getConfigurableAttributes

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
@Override
public List<ConfigurableAttribute<?>> getConfigurableAttributes() {
    List<ConfigurableAttribute<?>> attrs = new ArrayList<>();

    attr(attrs, new Meta.Object("Translation X", "Transform"),   () -> ((Float)transform().getValues()[Reference.Matrix4Alias.TranslationX]).intValue(),   (val) -> { transform().getValues()[Reference.Matrix4Alias.TranslationX] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Translation Y", "Transform"),   () -> ((Float)transform().getValues()[Reference.Matrix4Alias.TranslationY]).intValue(),   (val) -> { transform().getValues()[Reference.Matrix4Alias.TranslationY] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Translation Z", "Transform"),   () -> ((Float)transform().getValues()[Reference.Matrix4Alias.TranslationZ]).intValue(),   (val) -> { transform().getValues()[Reference.Matrix4Alias.TranslationZ] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);

    attr(attrs, new Meta.Object("Rotation Roll", "Transform"),   () -> ((Float)rotRoll).intValue(),                                                      (val) -> { rotRoll =Float.parseFloat(val.toString()); updateTransform(); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Rotation Pitch", "Transform"),  () -> ((Float)rotPitch).intValue(),                                                     (val) -> { rotPitch=Float.parseFloat(val.toString()); updateTransform(); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Rotation Yaw", "Transform"),    () -> ((Float)rotYaw).intValue(),                                                       (val) -> { rotYaw  =Float.parseFloat(val.toString()); updateTransform(); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);

    attr(attrs, new Meta.Object("Scale X", "Transform"),         () -> ((Float)transform().getValues()[Reference.Matrix4Alias.ScaleX]).intValue(),         (val) -> { transform().getValues()[Reference.Matrix4Alias.ScaleX] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Scale Y", "Transform"),         () -> ((Float)transform().getValues()[Reference.Matrix4Alias.ScaleY]).intValue(),         (val) -> { transform().getValues()[Reference.Matrix4Alias.ScaleY] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);
    attr(attrs, new Meta.Object("Scale Z", "Transform"),         () -> ((Float)transform().getValues()[Reference.Matrix4Alias.ScaleZ]).intValue(),         (val) -> { transform().getValues()[Reference.Matrix4Alias.ScaleZ] = Float.parseFloat(val.toString()); }, ConfigControl.NUMBERSELECTOR, Float::parseFloat);

    ConfigurableAttribute modelAttr = attr(attrs, new Meta.Object("Model", "Rendering"), this::getModelRef, this::setModel, ConfigControl.SELECTIONLIST);
    String[] modelRefs = Argent.content.getAllRefs(Model.class);
    SearchableList.Item.Data[] modelItems = new SearchableList.Item.Data[modelRefs.length];
    int index = 0;
    for (String ref : modelRefs)
        modelItems[index++] = new SearchableList.Item.Data<>(new TextureRegionDrawable(new TextureRegion(net.ncguy.argent.utils.SpriteCache.pixel())), ref, ref);
    modelAttr.addParam("items", SearchableList.Item.Data[].class, modelItems);

    return attrs;
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:27,代码来源:WorldObject.java

示例15: getMainMenuButtons

import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; //导入依赖的package包/类
public ImageButton.ImageButtonStyle getMainMenuButtons(int number){
    ImageButton.ImageButtonStyle s = new ImageButton.ImageButtonStyle();
    Texture mainMenuButtonsAtlas = get("MainMenuAtlas.png", Texture.class);
    TextureRegion[][] mainMenuButtons = TextureRegion.split(mainMenuButtonsAtlas, mainMenuButtonsAtlas.getWidth() / 2, mainMenuButtonsAtlas.getHeight() / 10);

    switch (number){
        case 1:
            s.up = new TextureRegionDrawable(mainMenuButtons[0][0]);
            s.over = new TextureRegionDrawable(mainMenuButtons[0][1]);
            s.down = new TextureRegionDrawable(mainMenuButtons[0][1]);
            return s;
        case 2:
            s.up = new TextureRegionDrawable(mainMenuButtons[1][0]);
            s.over = new TextureRegionDrawable(mainMenuButtons[1][1]);
            s.down = new TextureRegionDrawable(mainMenuButtons[1][1]);
            return s;
        case 3:
            s.up = new TextureRegionDrawable(mainMenuButtons[2][0]);
            s.over = new TextureRegionDrawable(mainMenuButtons[2][1]);
            s.down = new TextureRegionDrawable(mainMenuButtons[2][1]);
            return s;
    }
    return null;
}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:25,代码来源:AssetLoader.java


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