Search in sources :

Example 76 with Texture

use of com.badlogic.gdx.graphics.Texture in project AnotherMonekyParadox by SantiagoMille.

the class PantallaTutorial method crearMainView.

private void crearMainView() {
    stageMenu = new Stage(vista);
    imgBackground = new Texture("pantall_tutorial.png");
    spriteBackground = new Sprite(imgBackground);
    spriteBackground.setPosition(0, 0);
    // spriteBackground.setAlpha(0.7f);
    // Boton Return
    TextureRegionDrawable trdReturn = new TextureRegionDrawable(new TextureRegion(new Texture("go-back.png")));
    ImageButton btnReturn = new ImageButton(trdReturn);
    btnReturn.setPosition(30, ALTO - 30 - btnReturn.getHeight());
    // Click en boton Return
    btnReturn.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            // Gdx.app.log("ClickListener","Si se clickeoooo");
            main.setScreen(new PantallaMenu(main));
        }
    });
    stageMenu.addActor(btnReturn);
    Gdx.input.setInputProcessor(stageMenu);
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Sprite(com.badlogic.gdx.graphics.g2d.Sprite) Stage(com.badlogic.gdx.scenes.scene2d.Stage) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Texture(com.badlogic.gdx.graphics.Texture) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 77 with Texture

use of com.badlogic.gdx.graphics.Texture in project bdx by GoranM.

the class Material method texture.

public Texture texture(String filename) {
    Texture tex = currentTexture;
    if (!filename.equals(texturePath)) {
        tex = new Texture(Gdx.files.internal("bdx/textures/" + filename));
        tex.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
        texture(tex);
        texturePath = filename;
    }
    return tex;
}
Also used : Texture(com.badlogic.gdx.graphics.Texture)

Example 78 with Texture

use of com.badlogic.gdx.graphics.Texture in project FruityMod-StS by gskleres.

the class FruityMod method receivePostInitialize.

@Override
public void receivePostInitialize() {
    // Mod badge
    Texture badgeTexture = new Texture(makePath(BADGE_IMG));
    ModPanel settingsPanel = new ModPanel();
    settingsPanel.addLabel("FruityMod does not have any settings (yet)!", 400.0f, 700.0f, (me) -> {
    });
    BaseMod.registerModBadge(badgeTexture, MODNAME, AUTHOR, DESCRIPTION, settingsPanel);
    Settings.isDailyRun = false;
    Settings.isTrial = false;
    Settings.isDemo = false;
}
Also used : ModPanel(basemod.ModPanel) Texture(com.badlogic.gdx.graphics.Texture)

Example 79 with Texture

use of com.badlogic.gdx.graphics.Texture in project ultimate-java by pantinor.

the class AnimationPixMapPacker method updateTextureAtlas.

/**
 * Updates the given {@link TextureAtlas}, adding any new {@link Pixmap}
 * instances packed since the last call to this method. This can be used to
 * insert Pixmap instances on a separate thread via
 * {@link #pack(String, Pixmap)} and update the TextureAtlas on the
 * rendering thread. This method must be called on the rendering thread.
 */
public synchronized void updateTextureAtlas(TextureAtlas atlas, TextureFilter minFilter, TextureFilter magFilter, boolean useMipMaps) {
    for (Page page : pages) {
        if (page.texture == null) {
            if (page.rects.size != 0 && page.addedRects.size > 0) {
                page.texture = new Texture(new PixmapTextureData(page.image, page.image.getFormat(), useMipMaps, false, true)) {

                    @Override
                    public void dispose() {
                        super.dispose();
                        getTextureData().consumePixmap().dispose();
                    }
                };
                page.texture.setFilter(minFilter, magFilter);
                for (String name : page.addedRects) {
                    Rectangle rect = page.rects.get(name);
                    TextureRegion region = new TextureRegion(page.texture, (int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height);
                    atlas.addRegion(name, region);
                }
                page.addedRects.clear();
            }
        } else {
            if (page.addedRects.size > 0) {
                page.texture.load(page.texture.getTextureData());
                for (String name : page.addedRects) {
                    Rectangle rect = page.rects.get(name);
                    TextureRegion region = new TextureRegion(page.texture, (int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height);
                    atlas.addRegion(name, region);
                }
                page.addedRects.clear();
                return;
            }
        }
    }
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) Rectangle(com.badlogic.gdx.math.Rectangle) PixmapTextureData(com.badlogic.gdx.graphics.glutils.PixmapTextureData) Texture(com.badlogic.gdx.graphics.Texture)

Example 80 with Texture

use of com.badlogic.gdx.graphics.Texture in project ultimate-java by pantinor.

the class DungeonScreen method createMiniMap.

public void createMiniMap() {
    if (miniMap != null) {
        miniMap.dispose();
    }
    Pixmap pixmap = new Pixmap(MM_BKGRND_DIM, MM_BKGRND_DIM, Format.RGBA8888);
    for (int y = 0; y < DUNGEON_MAP; y++) {
        for (int x = 0; x < DUNGEON_MAP; x++) {
            DungeonTile tile = dungeonTiles[currentLevel][x][y];
            if (tile == DungeonTile.WALL || tile == DungeonTile.SECRET_DOOR) {
                pixmap.setColor(0.3f, 0.3f, 0.3f, 0.7f);
                pixmap.fillRectangle(OFST + (x * DIM), OFST + (y * DIM), DIM, DIM);
            } else if (tile == DungeonTile.DOOR) {
                pixmap.setColor(0.6f, 0.6f, 0.6f, 0.7f);
                pixmap.fillRectangle(OFST + (x * DIM), OFST + (y * DIM), DIM, DIM);
            } else if (tile.getValue() >= 208 && tile.getValue() <= 223) {
                // room indicator
                pixmap.setColor(0.36f, 0.04f, 0.04f, 0.7f);
                pixmap.fillRectangle(OFST + (x * DIM), OFST + (y * DIM), DIM, DIM);
            } else if (tile.getValue() >= 160 && tile.getValue() <= 163) {
                // fields
                Color c = Color.GREEN;
                if (tile == DungeonTile.FIELD_ENERGY) {
                    c = Color.BLUE;
                }
                if (tile == DungeonTile.FIELD_FIRE) {
                    c = Color.RED;
                }
                if (tile == DungeonTile.FIELD_SLEEP) {
                    c = Color.PURPLE;
                }
                pixmap.setColor(c);
                pixmap.fillRectangle(OFST + (x * DIM), OFST + (y * DIM), DIM, DIM);
            } else if (tile.getValue() >= 10 && tile.getValue() <= 48) {
                // ladders
                drawLadderTriangle(tile, pixmap, x, y);
            }
        }
    }
    miniMap = new Texture(pixmap);
    pixmap.dispose();
}
Also used : Color(com.badlogic.gdx.graphics.Color) Texture(com.badlogic.gdx.graphics.Texture) Pixmap(com.badlogic.gdx.graphics.Pixmap)

Aggregations

Texture (com.badlogic.gdx.graphics.Texture)235 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)78 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)62 Pixmap (com.badlogic.gdx.graphics.Pixmap)56 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)35 Stage (com.badlogic.gdx.scenes.scene2d.Stage)35 Sprite (com.badlogic.gdx.graphics.g2d.Sprite)26 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)21 OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)20 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)19 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)17 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)16 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)16 TextureRegionDrawable (com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable)16 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)14 Material (com.badlogic.gdx.graphics.g3d.Material)12 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)12 Actor (com.badlogic.gdx.scenes.scene2d.Actor)11 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)11 FileHandle (com.badlogic.gdx.files.FileHandle)10