Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.Texture


   
    setQueues();

    // =================Animations

    shipSheet = new Texture(Gdx.files.internal("data/spritesheets/CharacterSheet.png"));
    enemySheet = new Texture(Gdx.files.internal("data/spritesheets/EnemySheet.png"));
    projectileSheet = new Texture(Gdx.files.internal("data/spritesheets/ProjectileSheet.png"));
    bossSheet = new Texture(Gdx.files.internal("data/spritesheets/BossSheet.png"));

    frameTexture = new TextureRegion(new Texture("data/screens/frame.png"));

    // set sprite sheet to work with to shipSheet
    TextureRegion[][] tmp = TextureRegion.split(shipSheet, shipSheet.getWidth() / shipSheetTileWidth * 3,
        shipSheet.getHeight() / shipSheetTileHeight * 3);
    shipFrames = new TextureRegion[3]; // number of frames for the animation
View Full Code Here


      data.regions = new TextureRegion[pages.size];
     
      for (int i=0; i<pages.size; i++) {
        Page p = pages.get(i);
       
        Texture tex = new Texture(p.getPixmap(), p.getPixmap().getFormat(), false);
        tex.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
       
        data.regions[i] = new TextureRegion(tex);
      }
     
      //no more need for the PixmapPacker.. we can dispose it
View Full Code Here

  }

  private void load (TextureAtlasData data) {
    ObjectMap<Page, Texture> pageToTexture = new ObjectMap<Page, Texture>();
    for (Page page : data.pages) {
      Texture texture = null;
      if (page.texture == null) {
        texture = new Texture(page.textureFile, page.format, page.useMipMaps);
        texture.setFilter(page.minFilter, page.magFilter);
        texture.setWrap(page.uWrap, page.vWrap);
      } else {
        texture = page.texture;
        texture.setFilter(page.minFilter, page.magFilter);
        texture.setWrap(page.uWrap, page.vWrap);
      }
      textures.add(texture);
      pageToTexture.put(page, texture);
    }
View Full Code Here

    // 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(Color.WHITE);
    pixmap.fill();
    final AtlasRegion fake = new AtlasRegion(new Texture(pixmap), 0, 0, 32, 32);
    pixmap.dispose();
    FileHandle atlasFile = Gdx.files.internal(name + ".atlas");
    TextureAtlasData data = !atlasFile.exists() ? null : new TextureAtlasData(atlasFile, atlasFile.parent(), false);
    TextureAtlas atlas = new TextureAtlas(data) {
      public AtlasRegion findRegion (String name) {
View Full Code Here

   
  }

  @Override
  public void show() {
    splashTexture = new Texture("data/splashscreen.png");
    splashTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
   
    splashSprite = new Sprite(splashTexture);
    splashSprite.setColor(1, 1, 1, 0);
    splashSprite.setX(Gdx.graphics.getWidth() / 2 - (splashSprite.getWidth() / 2));
View Full Code Here

      data.regions = new TextureRegion[pages.size];

      for (int i = 0; i < pages.size; i++) {
        Page p = pages.get(i);

        Texture tex = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), parameter.genMipMaps,
          false, true)) {
          @Override
          public void dispose () {
            super.dispose();
            getTextureData().consumePixmap().dispose();
          }
        };
        tex.setFilter(parameter.minFilter, parameter.magFilter);

        data.regions[i] = new TextureRegion(tex);
      }
    }
    return data;
View Full Code Here

    cam.update();
   
    batch = new SpriteBatch();
    batch.setProjectionMatrix(cam.combined);   
   
    shipTexture = new Texture("data/ship.png");
    shipTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
   
    followerTexture = new Texture("data/follower.png");
    followerTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
   
    bulletTexture = new Texture("data/bullet.png");
    bulletTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
   
    sr = new ShapeRenderer();
   
    exhaust = new ParticleEmitter();
   
    try {
      exhaust.load(Gdx.files.internal("data/exhaust").reader(2024));
    } catch (IOException e) {
      e.printStackTrace();
    }
   
    Texture ballTexture = new Texture(Gdx.files.internal("data/particle.png"));
    Sprite ball = new Sprite(ballTexture);
    exhaust.setSprite(ball);
    exhaust.getScale().setHigh(0.3f);
    exhaust.start();
  }
View Full Code Here

      data.regions = new TextureRegion[pages.size];

      for (int i = 0; i < pages.size; i++) {
        Page p = pages.get(i);

        Texture tex = new Texture(new PixmapTextureData(p.getPixmap(), p.getPixmap().getFormat(), parameter.genMipMaps,
          false, true)) {
          @Override
          public void dispose () {
            super.dispose();
            getTextureData().consumePixmap().dispose();
          }
        };
        tex.setFilter(parameter.minFilter, parameter.magFilter);

        data.regions[i] = new TextureRegion(tex);
      }
    }
    return data;
View Full Code Here

      textureAtlas = new TextureAtlas();
    }

    for (TextureDefinition definition : textureDefinitions)
    {
      Texture texture = new Texture(Gdx.files.internal(definition.getPath()));
      TextureRegion textureRegion = new TextureRegion(texture);

      textureAtlas.addRegion(definition.getName(), textureRegion);
      definitions.put(definition.getName(), definition);
    }
View Full Code Here

   * @return the TextureAtlas */
  public synchronized TextureAtlas generateTextureAtlas (TextureFilter minFilter, TextureFilter magFilter, boolean useMipMaps) {
    TextureAtlas atlas = new TextureAtlas();
    for (Page page : pages) {
      if (page.rects.size != 0) {
        Texture texture = new Texture(new ManagedPixmapTextureData(page.image, page.image.getFormat(), useMipMaps)) {
          @Override
          public void dispose () {
            super.dispose();
            getTextureData().consumePixmap().dispose();
          }
        };
        texture.setFilter(minFilter, magFilter);

        Keys<String> names = page.rects.keys();
        for (String name : names) {
          Rectangle rect = page.rects.get(name);
          TextureRegion region = new TextureRegion(texture, (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.Texture

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.