@Override
  public void init(GameContainer gc, StateBasedGame st) throws SlickException {
    // Lade Pixel Font
    try {
      font = Font.createFont(Font.TRUETYPE_FONT, new File("./resources/pixel.ttf"));
    } catch (FontFormatException | IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    // Große Pixel Font
    uniTitle = new UnicodeFont(font, 100, true, false);
    uniTitle.getEffects().add(new ColorEffect(java.awt.Color.orange));
    uniTitle.addAsciiGlyphs();
    uniTitle.loadGlyphs();

    // Kleine Pixel Font
    uniNormal = new UnicodeFont(font, 30, true, false);
    uniNormal.getEffects().add(new ColorEffect(java.awt.Color.white));
    uniNormal.addAsciiGlyphs();
    uniNormal.loadGlyphs();

    levelNames = new ArrayList<>();
    playerNames = new ArrayList<>();
    times = new ArrayList<>();
    selection = new Rectangle(0, 0, 0, 40);
  }
示例#2
0
  @SuppressWarnings("unchecked")
  public GameOver(String text, int score, boolean victory) {
    this.text = text;
    this.score = score;
    this.victory = victory;
    font = new UnicodeFont(Database.instance().getDefaultFont().getFont(), 50, true, false);

    font.addAsciiGlyphs();
    font.getEffects().add(new ColorEffect());
    try {
      font.loadGlyphs();
    } catch (SlickException e1) {
      e1.printStackTrace();
    }

    nameInput =
        new TextField(
            GameCore.getInstance().getApp(),
            Database.instance().getDefaultFont(),
            150,
            20,
            500,
            Database.instance().getDefaultFont().getLineHeight() + 20,
            new ComponentListener() {
              public void componentActivated(AbstractComponent source) {
                input = nameInput.getText();
              }
            });
    nameInput.setFocus(true);
    nameInput.setBorderColor(Color.black);
    nameInput.setText("Anonymous");
    nameInput.setMaxLength(20);
  }
示例#3
0
  public Fuente(Font fuente, int tamano) throws SlickException {
    this.tamano = tamano;

    uFont = new UnicodeFont(fuente, this.tamano, this.italica, this.negrita);
    uFont.addAsciiGlyphs();
    uFont.addGlyphs(400, 600);
    uFont.getEffects().add(new ColorEffect(this.color));
    uFont.loadGlyphs();
    cargado = true;
  }
示例#4
0
 public ConsoleGuiNewChat(Minecraft par1Minecraft) {
   this.mc = par1Minecraft;
   font = new UnicodeFont(new Font("Arial Bold", Font.TRUETYPE_FONT, 16));
   font.addAsciiGlyphs();
   font.getEffects().add(new ColorEffect(java.awt.Color.white));
   try {
     font.loadGlyphs();
   } catch (Exception e) {
   }
 }
示例#5
0
 public RendererText() {
   Font awtFont = new Font("Consola", Font.BOLD, 18);
   unicodeFont = new UnicodeFont(awtFont);
   unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.white));
   unicodeFont.addAsciiGlyphs();
   try {
     unicodeFont.loadGlyphs();
   } catch (SlickException e) {
     e.printStackTrace();
   }
 }
示例#6
0
  public Fuente(String fuente, int tamano, boolean italica, boolean negrita, Color color)
      throws SlickException {
    this.tamano = tamano;
    this.italica = italica;
    this.negrita = negrita;
    this.color = color;

    uFont = new UnicodeFont(fuente, this.tamano, this.italica, this.negrita);
    uFont.addAsciiGlyphs();
    uFont.addGlyphs(400, 600);
    uFont.getEffects().add(new ColorEffect(this.color));
    uFont.loadGlyphs();
    cargado = true;
  }
  @Override
  public void init(GameContainer container, StateBasedGame game) throws SlickException {
    this.game = game;
    Font awtFont = new Font("SansSerif", Font.BOLD, 14);
    font = new UnicodeFont(awtFont);
    font.getEffects().add(new ShadowEffect(Color.black, 2, 2, 0.5f));
    font.getEffects().add(new ColorEffect(Color.white));
    font.addAsciiGlyphs();
    font.loadGlyphs();
    background = new Image("new-assets/background/background-no-shelf.png");

    mouseOffsetX = (container.getWidth() - PlatformerGame.WIDTH) / 2;
    mouseOffsetY = (container.getHeight() - PlatformerGame.HEIGHT) / 2;
  }
示例#8
0
 @SuppressWarnings("unchecked")
 public Font loadFont(String filename, int size) {
   Font font;
   try {
     UnicodeFont unicodeFont = new UnicodeFont(filename, size, false, false);
     unicodeFont.addAsciiGlyphs();
     unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.WHITE));
     unicodeFont.loadGlyphs();
     font = unicodeFont;
   } catch (SlickException e) {
     font = container.getDefaultFont();
   } catch (RuntimeException e) {
     font = container.getDefaultFont();
   }
   return font;
 }
示例#9
0
 @Override
 public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
   this.bg = new Image("res/menu/backgroundLoad.jpg");
   this.espace = new Image("res/score/espace.png");
   this.score = new Image("res/score/score.png");
   this.rubis = new Image("res/score/rubis.png");
   this.saphirs = new Image("res/score/saphirs.png");
   this.timing = new Image("res/score/timing.png");
   this.point = new Image("res/score/points.png");
   uFont = new UnicodeFont("res/score/police.ttf", 35, false, false);
   uFont.addAsciiGlyphs();
   uFont.addGlyphs(400, 600);
   java.awt.Color color = new java.awt.Color(136, 213, 242);
   uFont.getEffects().add(new ColorEffect(color));
   uFont.loadGlyphs();
 }
示例#10
0
  @SuppressWarnings("unchecked")
  public static UnicodeFont getFontWithSize(int fontSize) {

    for (UnicodeFont f : fonts) {
      if (f.getFont().getSize() == fontSize) {
        return f;
      }
    }

    try {
      UnicodeFont newFont = new UnicodeFont("res/font/Tahoma.ttf", fontSize, false, false);
      newFont.addAsciiGlyphs();
      newFont.getEffects().add(new ColorEffect());
      newFont.loadGlyphs();
      return newFont;
    } catch (SlickException e) {
      return null;
    }
  }