Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.Texture


  public static GameObject createTip(LabelComponent l, GameState newState) {
    GameObject tip = new GameObject("Tip");

    int height = 512;
    int width = 512;
    Texture tx = Cactus2DApplication.loadTexture("data/textures/gui.png", true);
    SpriteRendererComponent sr = SpriteRendererComponent.getTextureRegion(tx ,width, height, 1, 1);
    sr.layer = 2;
    sr.gui = true;
    tip.AddComponent(sr);
View Full Code Here


    return tip;
  }

  public static GameObject createGUI() {
    Texture tx = Cactus2DApplication.loadTexture("data/textures/gui.png", true);
    GameObject gui = new GameObject("Gui");
    int width = 640;
    int height = 128;
    SpriteRendererComponent sprite = SpriteRendererComponent.getTextureRegion(tx, width, height, 3, 0);
View Full Code Here

 
  @Override
  protected void init() {
   
    GameObject go = new GameObject("back");
    Texture texture = Cactus2DApplication.loadTexture("data/textures/allTextures.png", true);
    int width = 600;
    int height = 1024;
    TextureRegion[][] matriz = TextureRegion.split(texture, width, height);
    SpriteRendererComponent sr = new SpriteRendererComponent(texture);
    sr.spriteRegion = matriz[0][0];
    Utils.offsetCorrection(go.transform.getLocalPosition());
   
    go.AddComponent(sr);
    addGameObject(go);
   
    GameObject seismographGO = new GameObject("seismograph");
    texture = Cactus2DApplication.loadTexture("data/textures/gui.png", true);
    width = 512;
    height = 256;
    seismographGO.transform.getPosition().set(300 - width/2, 1024 - height * 1.2f);
    Utils.offsetCorrection(seismographGO.transform.getLocalPosition());
    TextureRegion[][] matriz3 = TextureRegion.split(texture, width, height);
    sr = new SpriteRendererComponent(null,matriz3[2][0]);
    seismographGO.AddComponent(sr);
    addGameObject(seismographGO);
   
    GameObject animatedGO = new GameObject("anim");
    AnimationComponent anim = new AnimationComponent();
    Texture tx  = new Texture(Gdx.files.internal("data/textures/sismoAnim.png"));
    int[] frames = { 0, 1, 2, 3, 4, 5, 6, 7};
    anim.addAnimation("anim", tx, 384, 192, frames, 5, false);
   
    anim.play("anim");
   
    animatedGO.AddComponent(anim);
    animatedGO.AddComponent(new SpriteRendererComponent(null));
    animatedGO.transform.getPosition().add(width/2 - 370/2, height/2 - 215/2);
    seismographGO.addGameObject(animatedGO);
   
    GameObject titleGO = new GameObject("title");
    titleGO.transform.getPosition().add(width/2 - 384/2, height/2 - 128/2);
    width = 384;
    height = 128;
    TextureRegion[][] matriz2 = TextureRegion.split(texture, 384, 128);
     sr = new SpriteRendererComponent(null,matriz2[6][0]);
     titleGO.AddComponent(sr);
    seismographGO.addGameObject(titleGO);
   
    go = new GameObject("play");
    go.AddComponent(new SpriteRendererComponent(null));
   
    Texture bt = Cactus2DApplication.loadTexture("data/textures/gui.png",true);
    width = 256;
    height = 128;
    TextureRegion[][] tmp = TextureRegion.split(bt, width, height);
    go.transform.getLocalPosition().add(Gdx.graphics.getWidth()/2 - 128 * Cactus2DApplication.invCameraZoom, Gdx.graphics.getHeight()/2 - 64 * Cactus2DApplication.invCameraZoom);
    go.spriteRenderer.gui = true;
View Full Code Here

     * @param frame frame of the sprite
     */
    public SpriteGDX(String path, Rectangle rectangle, int frame) {
        m_path = new File(path).getAbsolutePath();
        FileHandle f = Gdx.files.absolute(m_path);
        m_texture = new Texture(f);
        m_region = new TextureRegion(m_texture, rectangle.x, rectangle.y, rectangle.width, rectangle.height);
        m_rectangle = rectangle;
        m_frame = frame;
    }
View Full Code Here

 
  /**
   * Load the textures, initialize the TextureRegions
   */
  private void loadTextures(){
    texture = new Texture(Gdx.files.internal("data/png.png"));
    texFireButton = new TextureRegion(texture, 0, 0, 64, 16);
    texArrow = new TextureRegion(texture, 65, 0, 8, 16);
    texTank = new TextureRegion(texture, 83, 0, 32, 16);
    texCannon = new TextureRegion(texture, 159, 0, 16, 8);
   
View Full Code Here

  public void update(float delta){
    if(hasChanged == true) {
      pixmap = new Pixmap(Skitg.WIDTH, Skitg.HEIGHT, Pixmap.Format.RGB888);
     
      //New Texture must be > Pixmap dimensions, and in powers of 2
      texture = new Texture(1024, 1024, Pixmap.Format.RGB888);
      texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Linear);
     
      //Since it is larger than the pixmap, it needs to wrap around the edges
      texture.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge);
     
View Full Code Here

   
    //New Pixmap with the width and height of the screen.
    pixmap = new Pixmap(Skitg.WIDTH, Skitg.HEIGHT, Pixmap.Format.RGB888);
   
    //New Texture must be > Pixmap dimensions, and in powers of 2
    texture = new Texture(1024, 1024, Pixmap.Format.RGB888);
    texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Linear);
   
    //Since it is larger than the pixmap, it needs to wrap around the edges
    texture.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge);
   
View Full Code Here

      emitter.setSprite(new Sprite(loadTexture(imagesDir.child(imageName))));
    }
  }

  protected Texture loadTexture (FileHandle file) {
    return new Texture(file, false);
  }
View Full Code Here

      this.convertObjectToTileSpace = parameters.convertObjectToTileSpace;
      FileHandle tmxFile = resolve(fileName);
      root = xml.parse(tmxFile);
      ObjectMap<String, Texture> textures = new ObjectMap<String, Texture>();
      for (FileHandle textureFile : loadTilesets(root, tmxFile)) {
        Texture texture = new Texture(textureFile, parameters.generateMipMaps);
        texture.setFilter(parameters.textureMinFilter, parameters.textureMagFilter);
        textures.put(textureFile.path(), texture);
      }
      DirectImageResolver imageResolver = new DirectImageResolver(textures);
      TiledMap map = loadTilemap(root, tmxFile, imageResolver);
      map.setOwnedResources(textures.values().toArray());
View Full Code Here

  }

  @Override
  public void render (FrameBuffer src, FrameBuffer dest) {
    // the original scene
    Texture in = src.getColorBufferTexture();

    boolean blendingWasEnabled = PostProcessor.isStateEnabled(GL20.GL_BLEND);
    Gdx.gl.glDisable(GL20.GL_BLEND);

    Texture out = null;

    if (doblur) {

      pingPongBuffer.begin();
      {
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.