Package playn.core

Examples of playn.core.Image


    @Override protected String title () {
        return "UI: Backgrounds";
    }

    @Override protected Group createIface () {
        Image testBg = PlayN.assets().getImage("images/background.png");

        // Have to do async shenanigans with scale9 backgrounds
        final Label scale9Labels[] = {
            label("Scale 9", Background.blank()),
            label("Scale 9\nSomewhat\nTaller\nAnd\nWider", Background.blank()),
View Full Code Here


        layer.add(bg);

        // test our simple frames
        final GroupLayer box = graphics().createGroupLayer();
        layer.addAt(box, 0, 100);
        Image image = assets().getImage("images/spritesheet.png");
        image.addCallback(new Callback<Image>() {
            public void onSuccess (Image image) {
                SimpleFrames frames = new SimpleFrames(image, 60, 60, 60);
                anim.repeat(box).flipbook(box, new Flipbook(frames, 66));
                anim.repeat(box).tweenX(box).to(width-frames.width()).in(2000).easeInOut().then().
                    tweenX(box).to(0).in(2000).easeInOut();
            }
            public void onFailure (Throwable error) {} // n/a
        });

        // test our packed frames
        final Image packed = assets().getImage("images/packed.png");
        assets().getText("images/packed.json", new Callback<String>() {
            public void onSuccess (String json) {
                GroupLayer box = graphics().createGroupLayer();
                layer.addAt(box, 100, 200);
                anim.repeat(box).flipbook(
View Full Code Here

    @Override protected String title () {
        return "UI: General";
    }
    @Override protected Group createIface () {
        Icon smiley = Icons.image(PlayN.assets().getImage("images/smiley.png"));
        final Image squares = PlayN.assets().getImage("images/squares.png");
        final CapturedRoot capRoot = iface.addRoot(
            new CapturedRoot(iface, AxisLayout.horizontal(), stylesheet()));

        CheckBox toggle, toggle2;
        Label label2;
View Full Code Here

    }

    @Override public void apply (int index, ImageLayer layer) {
        layer.setTranslation(0, 0);
        int cols = cols(), row = (index % cols), col = (index / cols);
        Image cur = layer.image();
        if (cur instanceof Image.Region) {
            Image.Region curr = (Image.Region)cur;
            if (curr.parent() == _source) {
                curr.setBounds(_width * row, _height * col, _width, _height);
                return;
View Full Code Here

                if (remaining == 0) callback.onSuccess(new Library(frameRate, movies, textures));
            }
        });

        for (final LibraryData.AtlasData atlasData : atlases) {
            Image atlas = imageLoader.load(baseDir + "/" + atlasData.file);
            atlas.addCallback(new Callback.Chain<Image>(callback) {
                public void onSuccess (Image atlas) {
                    for (LibraryData.TextureData textureData : atlasData.textures) {
                        textures.add(decodeTexture(textureData, atlas));
                    }
                    remainingAtlases.update(remainingAtlases.get() - 1);
View Full Code Here

                if (remaining == 0) callback.onSuccess(new Library(frameRate, movies, textures));
            }
        });

        for (final Json.Object atlasJson : atlases) {
            Image atlas = loader.load(baseDir + "/" + atlasJson.getString("file"));
            atlas.addCallback(new Callback.Chain<Image>(callback) {
                public void onSuccess (Image atlas) {
                    for (Json.Object tjson : atlasJson.getArray("textures", Json.Object.class)) {
                        textures.add(decodeTexture(tjson, atlas));
                    }
                    remainingAtlases.update(remainingAtlases.get() - 1);
View Full Code Here

    }

    @Override public void apply (int index, ImageLayer layer) {
        Frame f = _frames[index];
        layer.setTranslation(f.offset.x, f.offset.y);
        Image cur = layer.image();
        if (cur instanceof Image.Region) {
            Image.Region curr = (Image.Region)cur;
            if (curr.parent() == _source) {
                curr.setBounds(f.bounds.x, f.bounds.y, f.bounds.width, f.bounds.height);
                return;
View Full Code Here

  }

  @Override
  public void init() {
    // create and add background image layer
    Image bgImage = assets().getImage("images/bg.png");
    ImageLayer bgLayer = graphics().createImageLayer(bgImage);
    graphics().rootLayer().add(bgLayer);
  }
View Full Code Here

TOP

Related Classes of playn.core.Image

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.