Package mdesl.graphics

Examples of mdesl.graphics.TextureRegion


  public BitmapFont(URL fontDef, URL texture) throws IOException {
    this(fontDef, new Texture(texture));
  }
 
  public BitmapFont(URL fontDef, Texture texture) throws IOException {
    this(fontDef.openStream(), new TextureRegion(texture));
  }
View Full Code Here


      return kerning[c];
    }
   
    void updateRegion(TextureRegion tex) {
      if (region==null)
        region = new TextureRegion(tex, 0, 0, tex.getWidth(), tex.getHeight());
      region.set(tex, x, y, width, height);
    }
View Full Code Here

    //Load some textures
    try {
      tex = new Texture(Util.getResource("res/tiles.png"), Texture.NEAREST);
      tex2 = new Texture(Util.getResource("res/ptsans_00.png"));
      tile = new TextureRegion(tex, 128, 64, 64, 64);
     
      font = new BitmapFont(Util.getResource("res/ptsans.fnt"), Util.getResource("res/ptsans_00.png"));
     
    } catch (IOException e) {
      // ... do something here ...
View Full Code Here

    //create our font
    try {
      atlas = new Texture(Util.getResource("res/slider.png"), Texture.NEAREST);
     
      //ideally you would use a texture packer like in LibGDX
      track = new TextureRegion(atlas, 0, 0, 64, 256);
      thumb = new TextureRegion(atlas, 65, 0, 64, 128);
     
      int width = track.getWidth();
      int height = track.getHeight();
     
      //create a new FBO with the width and height of our track
      if (Texture.isNPOTSupported()) {
        fbo = new FrameBuffer(width, height);
        fboRegion = new TextureRegion(fbo.getTexture());
      } else {
        int texWidth = Texture.toPowerOfTwo(width);
        int texHeight = Texture.toPowerOfTwo(height);
        fbo = new FrameBuffer(texWidth, texHeight);
        fboRegion = new TextureRegion(fbo.getTexture(), 0, texHeight-height, width, height);
      }
      fboRegion.flip(false, true);
      //GL uses lower left coords... we use upper-left for textures, so we need to flip Y
     
    } catch (IOException e) {
View Full Code Here

    try {
      fontTex = new Texture(Util.getResource("res/ptsans_00.png"), Texture.NEAREST);
     
      //in Photoshop, we included a small white box at the bottom right of our font sheet
      //we will use this to draw lines and rectangles within the same batch as our text
      rect = new TextureRegion(fontTex, fontTex.getWidth()-2, fontTex.getHeight()-2, 1, 1);
     
      font = new BitmapFont(Util.getResource("res/ptsans.fnt"), fontTex);
    } catch (IOException e) {
      throw new RuntimeException("couldn't decode texture");
    }
View Full Code Here

     
      batch = new SpriteBatch();
     
      //in Photoshop, we included a small white box at the bottom right of our font sheet
      //we will use this to draw lines and rectangles within the same batch as our text
      rect = new TextureRegion(fontTex, fontTex.getWidth()-2, fontTex.getHeight()-2, 1, 1);
     
      fpsWidth = font.getWidth("FPS: 0000");
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of mdesl.graphics.TextureRegion

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.