Example usage for com.badlogic.gdx.graphics Pixmap Pixmap

List of usage examples for com.badlogic.gdx.graphics Pixmap Pixmap

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Pixmap Pixmap.

Prototype

public Pixmap(byte[] encodedData, int offset, int len) 

Source Link

Document

Creates a new Pixmap instance from the given encoded image data.

Usage

From source file:com.bladecoder.engine.util.RectangleRenderer.java

License:Apache License

private static Texture makePixel() {
    Texture _temp;//from   ww  w.  j a v a2 s.  co  m
    Pixmap p = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    p.setColor(Color.WHITE);
    p.fillRectangle(0, 0, 1, 1);
    _temp = new Texture(p, true);
    p.dispose();
    return _temp;
}

From source file:com.bombinggames.clonkrageremade.ClonkRage.java

@Override
public void create() {
    view = new View(this);
    devtools = new DevTools(0, 0);
    //koordinatensystem nach unten zeigend
    foreGround = new Pixmap(1920, 1080, Pixmap.Format.RGBA8888);
    //foreGround.setColor(new Color(0.4f, 0.5f, 0.9f, 1));
    //foreGround.fill();
    backGround = new Pixmap(1920, 1080, Pixmap.Format.RGBA8888);
    backGround.setColor(new Color(0.4f, 0.5f, 0.9f, 1));
    backGround.fill();// w w w  .j  a v a2  s .  c o  m
    int surfaceheight = 300;
    int amplitude = 50;
    float width = (float) (Math.PI / 300f);
    float colornoise = 0.3f;
    int curvatureHeight = 30;
    for (int x = 0; x < foreGround.getWidth(); x++) {
        //y position of surface
        int surface = (int) (Math.sin(width * x) * amplitude + surfaceheight);
        for (int y = 0; y < surface; y++) {
            float topCurvature = 0;//brightness of added top curvature
            if (y > surface - curvatureHeight) {//is in area of curvature
                topCurvature = (1 - (y - surface) / (float) curvatureHeight) * 0.5f;
            }

            int color = ((int) ((topCurvature + 0.4f * (1 - colornoise / 2 + colornoise * Math.random()))
                    * 255) << 24)//R
                    | ((int) ((topCurvature + 0.3f * (1 - colornoise / 2 + colornoise * Math.random()))
                            * 255) << 16)//G
                    | ((int) ((topCurvature + 0.2f * (1 - colornoise / 2 + colornoise * Math.random()))
                            * 255) << 8)//B
                    | 1 * 255;//A
            if (x < 500) {
                foreGround.drawPixel(x, y, color);
            }
            backGround.drawPixel(x, y,
                    ((int) ((0.2f * (1 - colornoise / 2 + colornoise * Math.random())) * 255) << 24)//R
                            | ((int) ((0.1f * (1 - colornoise / 2 + colornoise * Math.random())) * 255) << 16)//G
                            | ((int) ((0.1f * (1 - colornoise / 2 + colornoise * Math.random())) * 255) << 8)//B
                            | 1 * 255//A
            );
        }
    }
    spawnEnts();

}

From source file:com.commons.color.ColorChannelWidget.java

License:Apache License

public ColorChannelWidget(ColorPickerStyle style, Sizes sizes, String label, int maxValue, boolean useAlpha,
        final ColorChannelWidgetListener drawer) {
    super(true);/*from   w  w w. j  a  va2s . c  o m*/

    this.style = style;
    this.sizes = sizes;
    this.value = 0;
    this.maxValue = maxValue;
    this.drawer = drawer;
    this.useAlpha = useAlpha;

    barListener = new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            value = bar.getValue();
            drawer.updateFields();
            inputField.setValue(value);
        }
    };

    if (useAlpha)
        pixmap = new Pixmap(maxValue, 1, Pixmap.Format.RGBA8888);
    else
        pixmap = new Pixmap(maxValue, 1, Pixmap.Format.RGB888);

    texture = new Texture(pixmap);
    add(new VisLabel(label)).width(10 * sizes.scaleFactor).center();
    add(inputField = new ColorInputField(maxValue, new ColorInputField.ColorInputFieldListener() {
        @Override
        public void changed(int newValue) {
            value = newValue;
            drawer.updateFields();
            bar.setValue(newValue);
        }
    })).width(CustomColorPicker.FIELD_WIDTH * sizes.scaleFactor);
    add(bar = createBarImage()).size(CustomColorPicker.BAR_WIDTH * sizes.scaleFactor,
            CustomColorPicker.BAR_HEIGHT * sizes.scaleFactor);

    inputField.setValue(0);
}

From source file:com.commons.color.CustomColorPicker.java

License:Apache License

private void createColorWidgets() {
    palettePixmap = new Pixmap(100, 100, Format.RGB888);
    paletteTexture = new Texture(palettePixmap);

    barPixmap = new Pixmap(1, 360, Format.RGB888);

    for (int h = 0; h < 360; h++) {
        ColorUtils.HSVtoRGB(360 - h, 100, 100, tmpColor);
        barPixmap.drawPixel(0, h, Color.rgba8888(tmpColor));
    }//  w  w w  .  j ava2s  .  co m

    barTexture = new Texture(barPixmap);

    palette = new Palette(style, sizes, paletteTexture, 0, 0, 100, new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            sBar.setValue(palette.getV());
            vBar.setValue(palette.getS());

            updateHSVValuesFromFields();
            updatePixmaps();
        }
    });

    verticalBar = new VerticalChannelBar(style, sizes, barTexture, 0, 360, new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            hBar.setValue(verticalBar.getValue());
            updateHSVValuesFromFields();
            updatePixmaps();
        }
    });

    hBar = new ColorChannelWidget(style, sizes, "H", 360, new ColorChannelWidget.ColorChannelWidgetListener() {
        @Override
        public void updateFields() {
            verticalBar.setValue(hBar.getValue());
            updateHSVValuesFromFields();
            updatePixmaps();
        }

        @Override
        public void draw(Pixmap pixmap) {
            for (int h = 0; h < 360; h++) {
                ColorUtils.HSVtoRGB(h, sBar.getValue(), vBar.getValue(), tmpColor);
                pixmap.drawPixel(h, 0, Color.rgba8888(tmpColor));
            }
        }
    });

    sBar = new ColorChannelWidget(style, sizes, "S", 100, new ColorChannelWidget.ColorChannelWidgetListener() {
        @Override
        public void updateFields() {
            palette.setValue(vBar.getValue(), sBar.getValue());
            updateHSVValuesFromFields();
            updatePixmaps();
        }

        @Override
        public void draw(Pixmap pixmap) {
            for (int s = 0; s < 100; s++) {
                ColorUtils.HSVtoRGB(hBar.getValue(), s, vBar.getValue(), tmpColor);
                pixmap.drawPixel(s, 0, Color.rgba8888(tmpColor));
            }
        }
    });

    vBar = new ColorChannelWidget(style, sizes, "V", 100, new ColorChannelWidget.ColorChannelWidgetListener() {
        @Override
        public void updateFields() {
            palette.setValue(vBar.getValue(), sBar.getValue());
            updateHSVValuesFromFields();
            updatePixmaps();
        }

        @Override
        public void draw(Pixmap pixmap) {
            for (int v = 0; v < 100; v++) {
                ColorUtils.HSVtoRGB(hBar.getValue(), sBar.getValue(), v, tmpColor);
                pixmap.drawPixel(v, 0, Color.rgba8888(tmpColor));
            }

        }
    });

    rBar = new ColorChannelWidget(style, sizes, "R", 255, new ColorChannelWidget.ColorChannelWidgetListener() {
        @Override
        public void updateFields() {
            updateRGBValuesFromFields();
            updatePixmaps();
        }

        @Override
        public void draw(Pixmap pixmap) {
            for (int r = 0; r < 255; r++) {
                tmpColor.set(r / 255.0f, color.g, color.b, 1);
                pixmap.drawPixel(r, 0, Color.rgba8888(tmpColor));
            }
        }
    });

    gBar = new ColorChannelWidget(style, sizes, "G", 255, new ColorChannelWidget.ColorChannelWidgetListener() {
        @Override
        public void updateFields() {
            updateRGBValuesFromFields();
            updatePixmaps();
        }

        @Override
        public void draw(Pixmap pixmap) {
            for (int g = 0; g < 255; g++) {
                tmpColor.set(color.r, g / 255.0f, color.b, 1);
                pixmap.drawPixel(g, 0, Color.rgba8888(tmpColor));
            }
        }
    });

    bBar = new ColorChannelWidget(style, sizes, "B", 255, new ColorChannelWidget.ColorChannelWidgetListener() {
        @Override
        public void updateFields() {
            updateRGBValuesFromFields();
            updatePixmaps();
        }

        @Override
        public void draw(Pixmap pixmap) {
            for (int b = 0; b < 255; b++) {
                tmpColor.set(color.r, color.g, b / 255.0f, 1);
                pixmap.drawPixel(b, 0, Color.rgba8888(tmpColor));
            }

        }
    });

    aBar = new ColorChannelWidget(style, sizes, "A", 255, true,
            new ColorChannelWidget.ColorChannelWidgetListener() {
                @Override
                public void updateFields() {
                    if (aBar.isInputValid())
                        color.a = aBar.getValue() / 255.0f;
                    updatePixmaps();
                }

                @Override
                public void draw(Pixmap pixmap) {
                    pixmap.fill();
                    for (int i = 0; i < 255; i++) {
                        tmpColor.set(color.r, color.g, color.b, i / 255.0f);
                        pixmap.drawPixel(i, 0, Color.rgba8888(tmpColor));
                    }
                }
            });
}

From source file:com.cyphercove.doublehelix.PowerLUT.java

License:Apache License

/** W power will be in luminance, and H power will be in alpha**/
public PowerLUT(float powerW, float intensityW, float powerH, float intensityH, int width, int height) {

    Pixmap pixmap = new Pixmap(width, height, Format.RGBA8888);
    for (int i = 0; i < width; i++) {
        float valueW = (float) Math.pow((float) i / width, powerW) * intensityW;
        for (int j = 0; j < height; j++) {
            float valueH = (float) Math.pow((float) j / height, powerH) * intensityH;
            pixmap.setColor(valueW, valueH, 1.0f, 1.0f);
            pixmap.drawPixel(i, j);/*  ww  w .  ja va2  s .c om*/
        }
    }

    PixmapTextureData data = new PixmapTextureData(pixmap, Format.RGBA8888, false, false, true);

    texture = new Texture(data);
    texture.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);
    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
}

From source file:com.dongbat.game.screen.DbScreen.java

public DbScreen() {
    camera = CameraUtil.getCamera();/* ww w .j  ava2 s  .  c  om*/
    batch = RenderUtil.getBatch();
    logo = new Sprite(AssetUtil.db);
    logo.setSize(CameraUtil.MIN_WIDTH * .75f, CameraUtil.MIN_WIDTH * .75f / backgroundRatio);
    logo.setPosition(-logo.getWidth() / 2, -logo.getHeight() / 2);

    Pixmap pm1 = new Pixmap(1, 1, Pixmap.Format.RGB565);
    pm1.setColor(Color.WHITE);
    pm1.fill();
    background = new Sprite(new Texture(pm1));
    background.setSize(CameraUtil.MIN_WIDTH, CameraUtil.MIN_HEIGHT);
    background.setPosition(-background.getWidth() / 2, -background.getHeight() / 2);

    startTime = TimeUtils.millis();
}

From source file:com.dongbat.game.screen.SplashScreen.java

public SplashScreen() {
    camera = CameraUtil.getCamera();// w  ww.j  av a  2s  .  c  o m
    batch = RenderUtil.getBatch();
    logo = new Sprite(AssetUtil.logo);
    logo.setSize(CameraUtil.MIN_WIDTH * .75f, CameraUtil.MIN_WIDTH * .75f / backgroundRatio);
    logo.setPosition(-logo.getWidth() / 2, -logo.getHeight() / 2);

    Pixmap pm1 = new Pixmap(1, 1, Format.RGB565);
    pm1.setColor(Color.WHITE);
    pm1.fill();
    background = new Sprite(new Texture(pm1));
    background.setSize(CameraUtil.MIN_WIDTH, CameraUtil.MIN_HEIGHT);
    background.setPosition(-background.getWidth() / 2, -background.getHeight() / 2);

    startTime = TimeUtils.millis();

    AssetUtil.loadAsset();
}

From source file:com.eightpuzzle.game.EightPuzzle.java

License:Apache License

@Override
public void create() {
    gameFont = new BitmapFont();
    solvedFont = new BitmapFont();
    batch = new SpriteBatch();
    aspectRatio = (float) Gdx.graphics.getHeight() / (float) Gdx.graphics.getWidth();
    OrthographicCamera camera = new OrthographicCamera(GAME_WIDTH * aspectRatio, GAME_HEIGHT * aspectRatio);
    //camera.position.set(GAME_WIDTH/2, GAME_HEIGHT/2, 0)
    camera.setToOrtho(false, GAME_WIDTH * aspectRatio, GAME_HEIGHT * aspectRatio);
    //camera.setToOrtho(false,GAME_WIDTH,GAME_HEIGHT);
    stage = new Stage(new ExtendViewport(GAME_WIDTH * aspectRatio, GAME_HEIGHT * aspectRatio, camera));//Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), camera));
    Gdx.input.setInputProcessor(stage);//w  ww .  j av a  2  s.  c  o m

    // A skin can be loaded via JSON or defined programmatically, either is fine. Using a skin is optional but strongly
    // recommended solely for the convenience of getting a texture, region, etc as a drawable, tinted drawable, etc.
    skin = new Skin();

    // Generate a 1x1 white texture and store it in the skin named "white".
    Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add("white", new Texture(pixmap));

    // Store the default libgdx font under the name "default".
    skin.add("default", new BitmapFont());

    // Configure a TextButtonStyle and name it "default". Skin resources are stored by type, so this doesn't overwrite the font.
    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
    //textButtonStyle.checked = skin.newDrawable("white", Color.BLUE);
    textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
    textButtonStyle.font = skin.getFont("default");
    skin.add("default", textButtonStyle);

    Label.LabelStyle labelSty = new Label.LabelStyle();
    labelSty.font = skin.getFont("default");
    //labelSty.fontColor = Color.GREEN;
    skin.add("default", labelSty);

    WindowStyle ws = new Window.WindowStyle();
    ws.titleFont = new BitmapFont();
    ws.background = skin.newDrawable("white", Color.BLACK);
    skin.add("default", ws);

    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Zig.ttf"));

    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 25;
    gameFont = generator.generateFont(parameter);

    FreeTypeFontParameter parameter2 = new FreeTypeFontParameter();
    parameter2.size = 100;
    parameter2.color = Color.GREEN;
    solvedFont = generator.generateFont(parameter2);
    generator.dispose();

    FileHandle blue, n1, n2, n3, n4, n5, n6, n7, n8, solveUp, solveDown;
    if (Gdx.app.getType() == ApplicationType.Desktop) {
        blue = Gdx.files.internal("icons64px/blue-square.png");
        n1 = Gdx.files.internal("icons64px/Number-1-icon.png");
        n2 = Gdx.files.internal("icons64px/Number-2-icon.png");
        n3 = Gdx.files.internal("icons64px/Number-3-icon.png");
        n4 = Gdx.files.internal("icons64px/Number-4-icon.png");
        n5 = Gdx.files.internal("icons64px/Number-5-icon.png");
        n6 = Gdx.files.internal("icons64px/Number-6-icon.png");
        n7 = Gdx.files.internal("icons64px/Number-7-icon.png");
        n8 = Gdx.files.internal("icons64px/Number-8-icon.png");
        solveUp = blue;
        solveDown = blue;
    } else {
        blue = Gdx.files.internal("icons256px/blue-circle.png");
        n1 = Gdx.files.internal("icons256px/Number-1-icon.png");
        n2 = Gdx.files.internal("icons256px/Number-2-icon.png");
        n3 = Gdx.files.internal("icons256px/Number-3-icon.png");
        n4 = Gdx.files.internal("icons256px/Number-4-icon.png");
        n5 = Gdx.files.internal("icons256px/Number-5-icon.png");
        n6 = Gdx.files.internal("icons256px/Number-6-icon.png");
        n7 = Gdx.files.internal("icons256px/Number-7-icon.png");
        n8 = Gdx.files.internal("icons256px/Number-8-icon.png");
        solveUp = Gdx.files.internal("icons256px/Box_Green.png");
        solveDown = Gdx.files.internal("icons256px/rectangle_green.png");
    }
    Texture bSquare = new Texture(blue);
    Texture n1T = new Texture(n1);
    Texture n2T = new Texture(n2);
    Texture n3T = new Texture(n3);
    Texture n4T = new Texture(n4);
    Texture n5T = new Texture(n5);
    Texture n6T = new Texture(n6);
    Texture n7T = new Texture(n7);
    Texture n8T = new Texture(n8);

    TextureRegion bSquareReg = new TextureRegion(bSquare);
    TextureRegion n1Reg = new TextureRegion(n1T);
    TextureRegion n2Reg = new TextureRegion(n2T);
    TextureRegion n3Reg = new TextureRegion(n3T);
    TextureRegion n4Reg = new TextureRegion(n4T);
    TextureRegion n5Reg = new TextureRegion(n5T);
    TextureRegion n6Reg = new TextureRegion(n6T);
    TextureRegion n7Reg = new TextureRegion(n7T);
    TextureRegion n8Reg = new TextureRegion(n8T);

    TextureRegionDrawable solveDUp = new TextureRegionDrawable(new TextureRegion(new Texture(solveUp)));
    TextureRegionDrawable solveDDown = new TextureRegionDrawable(new TextureRegion(new Texture(solveDown)));
    ImageTextButton.ImageTextButtonStyle tbSty = new ImageTextButton.ImageTextButtonStyle(solveDUp, solveDDown,
            solveDUp, gameFont);
    skin.add("default", tbSty);

    ImageButtonStyle bSquareSty = new ImageButtonStyle();
    bSquareSty.imageUp = new TextureRegionDrawable(bSquareReg);
    bSquareSty.imageDown = new TextureRegionDrawable(bSquareReg);

    ImageButtonStyle n1Sty = new ImageButtonStyle();
    n1Sty.imageUp = new TextureRegionDrawable(n1Reg);
    n1Sty.imageDown = new TextureRegionDrawable(n1Reg);

    ImageButtonStyle n2Sty = new ImageButtonStyle();
    n2Sty.imageUp = new TextureRegionDrawable(n2Reg);
    n2Sty.imageDown = new TextureRegionDrawable(n2Reg);

    ImageButtonStyle n3Sty = new ImageButtonStyle();
    n3Sty.imageUp = new TextureRegionDrawable(n3Reg);
    n3Sty.imageDown = new TextureRegionDrawable(n3Reg);

    ImageButtonStyle n4Sty = new ImageButtonStyle();
    n4Sty.imageUp = new TextureRegionDrawable(n4Reg);
    n4Sty.imageDown = new TextureRegionDrawable(n4Reg);

    ImageButtonStyle n5Sty = new ImageButtonStyle();
    n5Sty.imageUp = new TextureRegionDrawable(n5Reg);
    n5Sty.imageDown = new TextureRegionDrawable(n5Reg);

    ImageButtonStyle n6Sty = new ImageButtonStyle();
    n6Sty.imageUp = new TextureRegionDrawable(n6Reg);
    n6Sty.imageDown = new TextureRegionDrawable(n6Reg);

    ImageButtonStyle n7Sty = new ImageButtonStyle();
    n7Sty.imageUp = new TextureRegionDrawable(n7Reg);
    n7Sty.imageDown = new TextureRegionDrawable(n7Reg);

    ImageButtonStyle n8Sty = new ImageButtonStyle();
    n8Sty.imageUp = new TextureRegionDrawable(n8Reg);
    n8Sty.imageDown = new TextureRegionDrawable(n8Reg);

    ImageButton b1 = new ImageButton(n1Sty);
    b1.addListener(new MyChangeListener(1));
    map.put(1, b1);

    ImageButton holeB = new ImageButton(bSquareSty);
    map.put(0, holeB);

    ImageButton ib = new ImageButton(n2Sty);
    ib.addListener(new MyChangeListener(2));
    map.put(2, ib);

    ImageButton b4 = new ImageButton(n3Sty);
    b4.addListener(new MyChangeListener(3));
    ImageButton b5 = new ImageButton(n4Sty);
    b5.addListener(new MyChangeListener(4));
    ImageButton b6 = new ImageButton(n5Sty);
    b6.addListener(new MyChangeListener(5));
    map.put(3, b4);
    map.put(4, b5);
    map.put(5, b6);

    ImageButton b7 = new ImageButton(n6Sty);
    b7.addListener(new MyChangeListener(6));
    ImageButton b8 = new ImageButton(n7Sty);
    b8.addListener(new MyChangeListener(7));
    ImageButton b9 = new ImageButton(n8Sty);
    b9.addListener(new MyChangeListener(8));
    map.put(6, b7);
    map.put(7, b8);
    map.put(8, b9);

    newGameB = new ImageTextButton("New Game", skin);
    newGameB.addListener(new NewGameListener());

    solveB = new ImageTextButton("Solve", skin);
    solveB.addListener(new MySolveListener());

    newGameBoard();

    //table.padTop(50);
    //table.padBottom(20);

    VerticalGroup vg = new VerticalGroup();
    //vg.padTop(50);
    vg.setFillParent(true);
    vg.addActor(newGameB);
    vg.addActor(table);
    vg.addActor(solveB);

    stage.addActor(vg);
}

From source file:com.esotericsoftware.spine.SkeletonViewer.java

License:Open Source License

void loadSkeleton(FileHandle skeletonFile, boolean reload) {
    if (skeletonFile == null)
        return;//w  ww .j ava 2s.c o m

    // A regular texture atlas would normally usually be used. This returns a white image for images not found in the atlas.
    Pixmap pixmap = new Pixmap(32, 32, Format.RGBA8888);
    pixmap.setColor(new Color(1, 1, 1, 0.33f));
    pixmap.fill();
    final AtlasRegion fake = new AtlasRegion(new Texture(pixmap), 0, 0, 32, 32);
    pixmap.dispose();

    String atlasFileName = skeletonFile.nameWithoutExtension();
    if (atlasFileName.endsWith(".json"))
        atlasFileName = new FileHandle(atlasFileName).nameWithoutExtension();
    FileHandle atlasFile = skeletonFile.sibling(atlasFileName + ".atlas");
    if (!atlasFile.exists())
        atlasFile = skeletonFile.sibling(atlasFileName + ".atlas.txt");
    TextureAtlasData data = !atlasFile.exists() ? null
            : new TextureAtlasData(atlasFile, atlasFile.parent(), false);
    TextureAtlas atlas = new TextureAtlas(data) {
        public AtlasRegion findRegion(String name) {
            AtlasRegion region = super.findRegion(name);
            return region != null ? region : fake;
        }
    };

    try {
        String extension = skeletonFile.extension();
        if (extension.equalsIgnoreCase("json") || extension.equalsIgnoreCase("txt")) {
            SkeletonJson json = new SkeletonJson(atlas);
            json.setScale(ui.scaleSlider.getValue());
            skeletonData = json.readSkeletonData(skeletonFile);
        } else {
            SkeletonBinary binary = new SkeletonBinary(atlas);
            binary.setScale(ui.scaleSlider.getValue());
            skeletonData = binary.readSkeletonData(skeletonFile);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        ui.toast("Error loading skeleton: " + skeletonFile.name());
        lastModifiedCheck = 5;
        return;
    }

    skeleton = new Skeleton(skeletonData);
    skeleton.setToSetupPose();
    skeleton = new Skeleton(skeleton);
    skeleton.updateWorldTransform();

    state = new AnimationState(new AnimationStateData(skeletonData));

    this.skeletonFile = skeletonFile;
    Preferences prefs = Gdx.app.getPreferences("spine-skeletontest");
    prefs.putString("lastFile", skeletonFile.path());
    prefs.flush();
    lastModified = skeletonFile.lastModified();
    lastModifiedCheck = checkModifiedInterval;

    // Populate UI.

    ui.skeletonLabel.setText(skeletonFile.name());
    {
        Array<String> items = new Array();
        for (Skin skin : skeletonData.getSkins())
            items.add(skin.getName());
        ui.skinList.setItems(items);
    }
    {
        Array<String> items = new Array();
        for (Animation animation : skeletonData.getAnimations())
            items.add(animation.getName());
        ui.animationList.setItems(items);
    }

    // Configure skeleton from UI.

    skeleton.setSkin(ui.skinList.getSelected());
    state.setAnimation(0, ui.animationList.getSelected(), ui.loopCheckbox.isChecked());

    if (reload)
        ui.toast("Reloaded.");
}

From source file:com.explatcreations.sft.graphics.RectSprite.java

License:Open Source License

private static Texture makeTexture() {
    final Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();/*from   www .  j av  a 2  s  . c  o m*/
    final Texture result = new Texture(pixmap);
    pixmap.dispose();
    return result;
}