Package sprites

Examples of sprites.Sprite


    String[] lines = string.split("\n");
    int height = 0;
    for(int i = 0; i < lines.length ; i++){
      int width = 0;
      for(int j = 0; j < lines[i].length(); j++){
        Sprite glyph = font.getGlyph(lines[i].charAt(j));
        if(glyph != null){
          this.renderSprite(glyph, x + width, y + height);
        }
        width += glyph.getWidth();
      }
      height += font.getGlyphHeight();
    }
  }
View Full Code Here


    this.glyphHeight = glyphHeight;
    this.glyphWidthRatio = this.font.getWidthRatio() / 32f;
    this.glyphHeightRatio = this.font.getHeightRatio() / 4f;
    this.glyphMap = new HashMap<Character, Sprite>();
    for(int i = 0; i < lowercase.length ; i++){
      Sprite g = new Sprite(font, glyphWidth, glyphHeight, i*this.glyphWidthRatio, 0, this.glyphWidthRatio, this.glyphHeightRatio);
      this.glyphMap.put(lowercase[i], g);
    }
    for(int i = 0; i < uppercase.length ; i++){
      Sprite g = new Sprite(font, glyphWidth, glyphHeight, i*this.glyphWidthRatio, this.glyphHeightRatio, this.glyphWidthRatio, this.glyphHeightRatio);
      this.glyphMap.put(uppercase[i], g);
    }
    for(int i = 0; i < signs.length ; i++){
      Sprite g = new Sprite(font, glyphWidth, glyphHeight, i*this.glyphWidthRatio, 2*this.glyphHeightRatio, this.glyphWidthRatio, this.glyphHeightRatio);
      this.glyphMap.put(signs[i], g);
    }
    for(int i = 0; i < extra.length ; i++){
      Sprite g = new Sprite(font, glyphWidth, glyphHeight, i*this.glyphWidthRatio, 3*this.glyphHeightRatio, this.glyphWidthRatio, this.glyphHeightRatio);
      this.glyphMap.put(extra[i], g);
    }
  }
View Full Code Here

    float widthInTexture;
   
    for(int i = 0; i < lowercase.length; i++){
      width = glyphWidths[0][i];
      widthInTexture = (((float) width) / font.getWidth()) * font.getWidthRatio();
      Sprite g = new Sprite(font, glyphWidths[0][i], glyphHeight, tpos, 0, widthInTexture, this.glyphHeightRatio);
      tpos += widthInTexture;
      this.glyphMap.put(lowercase[i], g);
    }
    tpos = 0;
    for(int i = 0; i < uppercase.length; i++){
      width = glyphWidths[1][i];
      widthInTexture = (((float) width) / font.getWidth()) * font.getWidthRatio();
      Sprite g = new Sprite(font, glyphWidths[1][i], glyphHeight, tpos, this.glyphHeightRatio, widthInTexture, this.glyphHeightRatio);
      tpos += widthInTexture;
      this.glyphMap.put(uppercase[i], g);
    }
    tpos = 0;
    for(int i = 0; i < signs.length; i++){
      width = glyphWidths[2][i];
      widthInTexture = (((float) width) / font.getWidth()) * font.getWidthRatio();
      Sprite g = new Sprite(font, glyphWidths[2][i], glyphHeight, tpos, 2*this.glyphHeightRatio, widthInTexture, this.glyphHeightRatio);
      tpos += widthInTexture;
      this.glyphMap.put(signs[i], g);
    }
    tpos = 0;
    for(int i = 0; i < extra.length; i++){
      width = glyphWidths[3][i];
      widthInTexture = (((float) width) / font.getWidth()) * font.getWidthRatio();
      Sprite g = new Sprite(font, glyphWidths[3][i], glyphHeight, tpos, 3*this.glyphHeightRatio, widthInTexture, this.glyphHeightRatio);
      tpos += widthInTexture;
      this.glyphMap.put(extra[i], g);
    }
   
  }
View Full Code Here

      char c = string.charAt(i);
      if(c == '\n'){
        maxLength = length > maxLength ? length : maxLength;
        length = 0;
      } else {
        Sprite sprite = this.getGlyph(c);
        length += sprite.getWidth();
      }
    }
    maxLength = length > maxLength ? length : maxLength;
    return maxLength;
  }
View Full Code Here

TOP

Related Classes of sprites.Sprite

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.