Advertisement
Mouamle

MLabel

Jun 11th, 2016
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. public class MLabel{
  2.  
  3.   private String text = "";
  4.   private int x, y, size;
  5.   public int R, G, B;
  6.  
  7.   public MLabel(String text, int x, int y, int size, int r, int g, int b){
  8.     this.text = text;
  9.     this.x = x;
  10.     this.y = y;
  11.     this.size = size;
  12.    
  13.     this.R = r;
  14.     this.G = g;
  15.     this.B = b;
  16.   }
  17.  
  18.   public MLabel(String text, int x, int y){
  19.     this.text = text;
  20.     this.x = x;
  21.     this.y = y;
  22.     this.size = 14;
  23.    
  24.     this.R = 255;
  25.     this.G = 255;
  26.     this.B = 255;
  27.   }
  28.  
  29.   public MLabel(String text, int x, int y, int size){
  30.     this.text = text;
  31.     this.x = x;
  32.     this.y = y;
  33.     this.size = size;
  34.    
  35.     this.R = 255;
  36.     this.G = 255;
  37.     this.B = 255;
  38.   }
  39.  
  40.  
  41.   public void render(){
  42.       pushMatrix();
  43.       textSize(size);
  44.       fill(R, G, B, 255);
  45.       text(text.toString(), x, y);  
  46.       popMatrix();
  47.   }
  48.  
  49.   public void setColor(int r, int g, int b){
  50.     this.R = r;
  51.     this.G = g;
  52.     this.B = b;
  53.   }
  54.  
  55.   public void setText(String text){
  56.     this.text = text;
  57.   }
  58.  
  59.   public String getText(){
  60.     return this.text;
  61.   }
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement