Package org.newdawn.slick

Examples of org.newdawn.slick.UnicodeFont


    }

    @SuppressWarnings("unchecked")
    private static void setUpFonts() {
        java.awt.Font awtFont = new java.awt.Font("Times New Roman", java.awt.Font.BOLD, 18);
        font = new UnicodeFont(awtFont);
        font.getEffects().add(new ColorEffect(java.awt.Color.white));
        font.addAsciiGlyphs();
        try {
            font.loadGlyphs();
        } catch (SlickException e) {
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    private static void setUpFonts() {
        java.awt.Font awtFont = new java.awt.Font("Helvetica", java.awt.Font.BOLD, 18);
        font = new UnicodeFont(awtFont);
        font.getEffects().add(new ColorEffect(java.awt.Color.white));
        font.addAsciiGlyphs();
        try {
            font.loadGlyphs();
        } catch (SlickException e) {
View Full Code Here

   * @throws SlickException
   */
 
  static UnicodeFont extractFont(int size, int rule)
  {
    UnicodeFont f = searchFont(size, rule);
    if (f == null)
    {
      f = setFont(size, rule)
      return f;
    }
View Full Code Here

   * @throws SlickException
   */
  @SuppressWarnings("unchecked") //due to the unfixable getEffects() warnings
    private static UnicodeFont setFont(int size, int rule)
    {
    UnicodeFont f = null;
    try
    {
      f = new UnicodeFont("res/thin_pixel-7.ttf", size, false, false);
      f.getEffects().add(new ColorEffect());
        if (rule == 2) f.getEffects().add(new OutlineEffect(size/50, java.awt.Color.black));
        else if (rule == 1) f.getEffects().add(new ShadowEffect(java.awt.Color.gray, size/90, size/90, 0.52f));
      f.addAsciiGlyphs();
      f.setPaddingTop(f.getAscent()/2);
      f.loadGlyphs();
    } catch (SlickException e) {}
    font_index.put(size+rule+"", f);
    return f;
  }
View Full Code Here

   * @throws SlickException
   */
 
    public static void drawString(int size, int x, int y, String str, Color col, int rule)
    {
      UnicodeFont f = extractFont(size, rule);
      f.drawString(x, y, str, col);   
    }
View Full Code Here

     * @throws SlickException
     */
   
    public static int extractLength(String str, int size)
    {
      UnicodeFont f = Text.extractFont(size, 0);
      return (int) (Game.getAppX()/2-(f.getWidth(str)/2));
    }
View Full Code Here

     * @throws SlickException
     */
   
    public static int extractTrueLength(String str, int size)
    {
      UnicodeFont f = Text.extractFont(size, 0);
      return f.getWidth(str);
    }
View Full Code Here

     
     
      //Setup font. See: http://www.unicodemap.org/, if we can't get right glyphs, then add more unicode glyphs
      //Code for setting up fonts from: http://slick.cokeandcode.com/wiki/doku.php?id=unicode_font_support
      Font awtFont = new Font("Andale Mono", Font.BOLD, 24);
      basicFont = new UnicodeFont(awtFont, 24, true, false);
      basicFont.addAsciiGlyphs();
      //basicFont.addGlyphs(aNumber,aNotherNumber);  //as above, if we need more glyphs, look them up and add them here
      basicFont.getEffects().add(new ColorEffect(java.awt.Color.WHITE));
      try {
        basicFont.loadGlyphs();
View Full Code Here

     

      //Setup font. See: http://www.unicodemap.org/, if we can't get right glyphs, then add more unicode glyphs
      //Code for setting up fonts from: http://slick.cokeandcode.com/wiki/doku.php?id=unicode_font_support
      Font awtFont = new Font("Andale Mono", Font.BOLD, 24);
      basicFont = new UnicodeFont(awtFont, 24, true, false);
      basicFont.addAsciiGlyphs();
      //basicFont.addGlyphs(aNumber,aNotherNumber);  //as above, if we need more glyphs, look them up and add them here
      basicFont.getEffects().add(new ColorEffect(java.awt.Color.BLACK));
      try {
        basicFont.loadGlyphs();
View Full Code Here

   */
  public void init(GameContainer container) throws SlickException {
    container.setShowFPS(false);

    // unicodeFont = new UnicodeFont(Font.decode("Arial Unicode MS"), 25, false, false);
    unicodeFont = new UnicodeFont("c:/windows/fonts/arial.ttf", 48, false, false);
//    unicodeFont.setPaddingBottom(10);
//    unicodeFont.setPaddingRight(10);
//    unicodeFont.setPaddingAdvanceX(-10);
//    unicodeFont.getEffects().add(new ShadowEffect(java.awt.Color.black, 5, 5, 0.5f));
    unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.white));
View Full Code Here

TOP

Related Classes of org.newdawn.slick.UnicodeFont

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.