Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.Texture


        FileHandle file;
        if (imagePath.equals("particle.png"))
          file = Gdx.files.classpath(imagePath);
        else
          file = Gdx.files.absolute(imagePath);
        emitter.setSprite(new Sprite(new Texture(file)));
      } catch (GdxRuntimeException ex) {
        ex.printStackTrace();
        EventQueue.invokeLater(new Runnable() {
          public void run () {
            JOptionPane.showMessageDialog(ParticleEditor.this, "Error loading image:\n" + imagePath);
View Full Code Here


        EventQueue.invokeLater(new Runnable() {
          public void run () {
            final ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 1024 * 4);
            buffer.order(ByteOrder.LITTLE_ENDIAN);
            fontGenerator.getTextureData(buffer.asIntBuffer());
            TextureRegion glyphRegion = new TextureRegion(new Texture(new TextureData() {
              Pixmap pixmap;

              public int getWidth () {
                return width;
              }
View Full Code Here

      this.yUp = parameters.yUp;
      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

        // renderingBackgroundColor.a);
        // fillRect(0, 0, unicodeFont.getGlyphPageWidth() + 2, unicodeFont.getGlyphPageHeight() + 2);
        int index = glyphPageCombo.getSelectedIndex();
        List pages = unicodeFont.getGlyphPages();
        if (index >= 0 && index < pages.size()) {
          Texture texture = ((GlyphPage)pages.get(glyphPageCombo.getSelectedIndex())).getTexture();

          glDisable(GL_TEXTURE_2D);
          glColor4f(renderingBackgroundColor.r, renderingBackgroundColor.g, renderingBackgroundColor.b,
            renderingBackgroundColor.a);
          glBegin(GL_QUADS);
          glVertex3f(0, 0, 0);
          glVertex3f(0, texture.getHeight(), 0);
          glVertex3f(texture.getWidth(), texture.getHeight(), 0);
          glVertex3f(texture.getWidth(), 0, 0);
          glEnd();
          glEnable(GL_TEXTURE_2D);

          texture.bind();
          glColor4f(1, 1, 1, 1);
          glBegin(GL_QUADS);
          glTexCoord2f(0, 0);
          glVertex3f(0, 0, 0);

          glTexCoord2f(0, 1);
          glVertex3f(0, texture.getHeight(), 0);

          glTexCoord2f(1, 1);
          glVertex3f(texture.getWidth(), texture.getHeight(), 0);

          glTexCoord2f(1, 0);
          glVertex3f(texture.getWidth(), 0, 0);
          glEnd();
        }
      }
    }
View Full Code Here

        FileHandle file;
        if (imagePath.equals(ParticleEditor.DEFAULT_PARTICLE))
          file = Gdx.files.classpath(imagePath);
        else
          file = Gdx.files.absolute(imagePath);
        emitter.setSprite(new Sprite(new Texture(file)));
      } catch (GdxRuntimeException ex) {
        ex.printStackTrace();
        EventQueue.invokeLater(new Runnable() {
          public void run () {
            JOptionPane.showMessageDialog(ParticleEditor.this, "Error loading image:\n" + imagePath);
View Full Code Here

   
    batch = new SpriteBatch();
    font = new BitmapFont();
    font.setColor(Color.RED);
   
    textureRegion = new TextureRegion(new Texture(
        Gdx.files.internal("data/marble.png")));
    bg = new Texture(Gdx.files.internal("data/bg.png"));

    createPhysicsWorld();
    Gdx.input.setInputProcessor(this);

    normalProjection.setToOrtho2D(
View Full Code Here

        public TextureRegion image;
        public AtlasRegion atlasRegion;
                   
        public final void loadFromFile (String fileName) {
            Texture texture = new Texture(Gdx.files.internal(fileName));

            image = new TextureRegion(texture, 0, 0, texture.getWidth(), texture.getHeight());
            //image.flip(false, true);
        }
View Full Code Here

       
       
       
    public static TransientGDXImage load(String fileName) {
        Log.info("Load from file: "+fileName);
            Texture texture = new Texture(Gdx.files.internal(fileName));
            TransientGDXImage newImage = new TransientGDXImage();
           
            newImage.image = new TextureRegion(texture, 0, 0, texture.getWidth(), texture.getHeight());       
            //newImage.image.flip(false, true);
            return newImage;
    }
View Full Code Here

            return newImage;
    }
       
   
  public static TextureRegion load (String name, int width, int height) {
    Texture texture = new Texture(Gdx.files.internal(name));
    TextureRegion region = new TextureRegion(texture, 0, 0, width, height);
    //region.flip(false, true);
    return region;
  }    
View Full Code Here

  private static TextureRegion[][] split (String name, int width, int height) {
    return split(name, width, height, false);
  }

  private static TextureRegion[][] split (String name, int width, int height, boolean flipX) {
    Texture texture = new Texture(Gdx.files.internal(name));
    int xSlices = texture.getWidth() / width;
    int ySlices = texture.getHeight() / height;
    TextureRegion[][] res = new TextureRegion[xSlices][ySlices];
    for (int x = 0; x < xSlices; x++) {
      for (int y = 0; y < ySlices; y++) {
        res[x][y] = new TextureRegion(texture, x * width, y * height, width, height);
        res[x][y].flip(flipX, true);
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.