Advertisement
Guest User

Font Scaling draw behaviour

a guest
Apr 1st, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. import com.badlogic.gdx.ApplicationAdapter;
  2. import com.badlogic.gdx.Gdx;
  3. import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
  4. import com.badlogic.gdx.graphics.GL20;
  5. import com.badlogic.gdx.graphics.g2d.BitmapFont;
  6. import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  7.  
  8. public class sscceScaledBitmapFont extends ApplicationAdapter {
  9.     SpriteBatch batch;
  10.     BitmapFont font;
  11.     String text = "373";
  12.    
  13.    
  14.    
  15.     @Override
  16.     public void create () {
  17.         batch = new SpriteBatch();
  18.         font = new BitmapFont(Gdx.files.internal("skin/uiDistance2015.fnt"));
  19.     }
  20.  
  21.     @Override
  22.     public void render () {
  23.         Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  24.         font.setScale(1);
  25.         batch.begin();
  26.         font.draw(batch, text, 100, 300);
  27.         batch.end();
  28.         font.setScale(0.3f);
  29.         batch.begin();
  30.         font.draw(batch, text, 400, 300);
  31.         batch.end();
  32.     }
  33.  
  34.     public static void main (String[] args) throws Exception {
  35.         new LwjglApplication(new sscceScaledBitmapFont());
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement