Advertisement
TheKacho

Untitled

Jul 24th, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. package com.corundumgames.util;
  2.  
  3. import com.badlogic.gdx.graphics.g2d.Batch;
  4. import com.badlogic.gdx.graphics.g2d.NinePatch;
  5. import com.badlogic.gdx.graphics.g2d.TextureRegion;
  6. import com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable;
  7. import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable;
  8.  
  9. public class CGNinePatchDrawable extends BaseDrawable {
  10.     private NinePatchDrawable patch;
  11.    
  12.     public TextureRegion region;
  13.     public int left;
  14.     public int right;
  15.     public int top;
  16.     public int bottom;
  17.    
  18.     public CGNinePatchDrawable() {
  19.         super();
  20.     }
  21.    
  22.     @Override
  23.     public void draw(Batch batch, float x, float y, float width, float height) {
  24.         if (this.patch == null) {
  25.             this.patch = new NinePatchDrawable(new NinePatch(region, left, right, top, bottom));
  26.         }
  27.        
  28.         this.patch.draw(batch, x, y, width, height);
  29.     }
  30.    
  31.    
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement