Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.Texture


    this.length = length;
    this.strength = strength;
    this.spriteManager = spriteManager;
   
    // Carga la animación de un spritesheet (todos los frames están en un mismo fichero)
    Texture spriteSheet = ResourceManager.assets.get("player/bomb_animation.png", Texture.class);
    TextureRegion[][] frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAMES, spriteSheet.getHeight());
    TextureRegion[] rightFrames = new TextureRegion[FRAMES];
    for (int i = 0; i < FRAMES; i++) {
      rightFrames[i] = frames[0][i];
    }
    animation = new Animation(0.15f, rightFrames);
View Full Code Here


   * Crea las animaciones del personaje
   */
  private void createAnimations() {
   
    // Carga la animación de un spritesheet (todos los frames están en un mismo fichero)
    Texture spriteSheet = ResourceManager.assets.get("player/player_right_animation.png", Texture.class);
    TextureRegion[][] frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAMES, spriteSheet.getHeight());
    TextureRegion[] rightFrames = new TextureRegion[FRAMES];
    for (int i = 0; i < FRAMES; i++) {
      rightFrames[i] = frames[0][i];
    }
    rightAnimation = new Animation(0.15f, rightFrames);
   
    spriteSheet = ResourceManager.assets.get("player/player_left_animation.png", Texture.class);
    frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAMES, spriteSheet.getHeight());
    rightFrames = new TextureRegion[FRAMES];
    for (int i = 0; i < FRAMES; i++) {
      rightFrames[i] = frames[0][i];
    }
    leftAnimation = new Animation(0.15f, rightFrames);
   
    spriteSheet = ResourceManager.assets.get("player/player_up_animation.png", Texture.class);
    frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAMES, spriteSheet.getHeight());
    rightFrames = new TextureRegion[FRAMES];
    for (int i = 0; i < FRAMES; i++) {
      rightFrames[i] = frames[0][i];
    }
    upAnimation = new Animation(0.15f, rightFrames);
   
    spriteSheet = ResourceManager.assets.get("player/player_down_animation.png", Texture.class);
    frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / FRAMES, spriteSheet.getHeight());
    rightFrames = new TextureRegion[FRAMES];
    for (int i = 0; i < FRAMES; i++) {
      rightFrames[i] = frames[0][i];
    }
    downAnimation = new Animation(0.15f, rightFrames);
   
    spriteSheet = ResourceManager.assets.get("player/player_explosion_animation.png", Texture.class);
    frames = TextureRegion.split(spriteSheet, spriteSheet.getWidth() / (FRAMES * 2), spriteSheet.getHeight());
    rightFrames = new TextureRegion[FRAMES * 2];
    for (int i = 0; i < FRAMES * 2; i++) {
      rightFrames[i] = frames[0][i];
    }
    explosionAnimation = new Animation(0.2f, rightFrames);
View Full Code Here

    try {
      FileHandle tideFile = resolve(fileName);
      root = xml.parse(tideFile);
      ObjectMap<String, Texture> textures = new ObjectMap<String, Texture>();
      for (FileHandle textureFile : loadTileSheets(root, tideFile)) {
        textures.put(textureFile.path(), new Texture(textureFile));
      }
      DirectImageResolver imageResolver = new DirectImageResolver(textures);
      TiledMap map = loadMap(root, tideFile, imageResolver);
      map.setOwnedResources(textures.values().toArray());
      return map;
View Full Code Here

    final short[] regionTriangles = region.triangles;
    final int regionTrianglesLength = regionTriangles.length;
    final float[] regionVertices = region.vertices;
    final int regionVerticesLength = regionVertices.length;

    final Texture texture = region.region.texture;
    if (texture != lastTexture)
      switchTexture(texture);
    else if (triangleIndex + regionTrianglesLength > triangles.length || vertexIndex + regionVerticesLength > vertices.length)
      flush();
View Full Code Here

    final int regionTrianglesLength = regionTriangles.length;
    final float[] regionVertices = region.vertices;
    final int regionVerticesLength = regionVertices.length;
    final TextureRegion textureRegion = region.region;

    final Texture texture = textureRegion.texture;
    if (texture != lastTexture)
      switchTexture(texture);
    else if (triangleIndex + regionTrianglesLength > triangles.length || vertexIndex + regionVerticesLength > vertices.length)
      flush();
View Full Code Here

    final int regionTrianglesLength = regionTriangles.length;
    final float[] regionVertices = region.vertices;
    final int regionVerticesLength = regionVertices.length;
    final TextureRegion textureRegion = region.region;

    Texture texture = textureRegion.texture;
    if (texture != lastTexture)
      switchTexture(texture);
    else if (triangleIndex + regionTrianglesLength > triangles.length || vertexIndex + regionVerticesLength > vertices.length)
      flush();
View Full Code Here

    if (!drawing) throw new IllegalStateException("PolygonSpriteBatch.begin must be called before draw.");

    final short[] triangles = this.triangles;
    final float[] vertices = this.vertices;

    Texture texture = region.texture;
    if (texture != lastTexture)
      switchTexture(texture);
    else if (triangleIndex + 6 > triangles.length || vertexIndex + SPRITE_SIZE > vertices.length) //
      flush();
View Full Code Here

    if (!drawing) throw new IllegalStateException("PolygonSpriteBatch.begin must be called before draw.");

    final short[] triangles = this.triangles;
    final float[] vertices = this.vertices;

    Texture texture = region.texture;
    if (texture != lastTexture)
      switchTexture(texture);
    else if (triangleIndex + 6 > triangles.length || vertexIndex + SPRITE_SIZE > vertices.length) //
      flush();
View Full Code Here

    if (!drawing) throw new IllegalStateException("PolygonSpriteBatch.begin must be called before draw.");

    final short[] triangles = this.triangles;
    final float[] vertices = this.vertices;

    Texture texture = region.texture;
    if (texture != lastTexture)
      switchTexture(texture);
    else if (triangleIndex + 6 > triangles.length || vertexIndex + SPRITE_SIZE > vertices.length) //
      flush();
View Full Code Here

  public void draw (TextureRegion region, float x, float y, float width, float height) {
    if (!drawing) throw new IllegalStateException("SpriteBatch.begin must be called before draw.");

    float[] vertices = this.vertices;

    Texture texture = region.texture;
    if (texture != lastTexture) {
      switchTexture(texture);
    } else if (idx == vertices.length) //
      flush();
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.