Package org.newdawn.slick

Examples of org.newdawn.slick.Font


    Resource[] resources = Resource.values();
    final int fontSize = g.getFont().getLineHeight();
    final int resourceNumber = resources.length;
    final int tableHeight = resourceNumber * fontSize + fontSize;
    final int cellPadding = 2;
    Font font = FontHelper.getDefaultFont();

    // Draw the table
    // Vertical lines
    int dx = this.ox;
    int dy = this.oy;
    g.setColor(Color.black);
    g.drawLine(dx, dy, dx, dy + tableHeight);
    dx += this.columnWidth;
    g.drawLine(dx, dy, dx, dy + tableHeight);
    dx += this.columnWidth;
    g.drawLine(dx, dy, dx, dy + tableHeight);
    dx += this.columnWidth;
    g.drawLine(dx, dy, dx, dy + tableHeight);
    dx = this.ox + this.width; // Adjustment
    g.drawLine(dx, dy, dx, dy + tableHeight);

    // Horizontal lines
    dx = this.ox;
    dy = this.oy;
    g.drawLine(dx, dy, dx + this.width, dy);
    font.drawString(dx + cellPadding, dy, I18n.getFirstToUpper("resource"));

    dx += this.columnWidth;
    font.drawString(dx + cellPadding, dy, I18n.getFirstToUpper("resource.price"));

    dx += this.columnWidth;
    font.drawString(dx + cellPadding, dy, I18n.getFirstToUpper("resource.income"));

    dx += this.columnWidth;
    font.drawString(dx + cellPadding, dy, I18n.getFirstToUpper("resource.store"));

    dx = this.ox;
    dy += fontSize;
    String temp;
    for (Resource r : resources) {
      font.drawString(dx + cellPadding, dy, r.getI18n());
      g.drawLine(dx, dy, dx + this.width, dy);

      // Cost
      dx += this.columnWidth;
      temp = this.basicData.getUpgradeCost().get(r).toString();
      font.drawString(dx + cellPadding, dy, temp);

      // Production
      dx += this.columnWidth;
      temp = this.basicData.getProduction().get(r).toString();
      temp += " -> " + this.compareData.getProduction().get(r).toString();
      font.drawString(dx + cellPadding, dy, temp);

      // Store
      dx += this.columnWidth;
      temp = this.basicData.getStoreCapacity().get(r).toString();
      temp += "->" + this.compareData.getStoreCapacity().get(r).toString();
      font.drawString(dx + cellPadding, dy, temp);

      dy += fontSize;
      dx = this.ox;
    }
    g.drawLine(dx, dy, dx + this.width, dy);
View Full Code Here


    // The buttons
    this.backToSectorButton.render(g);
    this.homeButton.render(g);

    Font font = FontHelper.getDefaultFont();
    String label;
    // If a technology is currently beeing researched, progress is rendered
    ResearchAction action = GameData.getSelectedColony().getResearch();
    if (action == null) {
      label = I18n.getFirstToUpper("research.no_research");
    } else {
      label = action.getTechnology().getName();
      this.researchProgress.setMaxValue(BigDecimal.valueOf(100));
      this.researchProgress.setValue(BigDecimal.valueOf(action
          .getProgression()));
      this.researchProgress.render(g);
    }
    font.drawString(10, 60, label);

    // TODO the minimap
  }
View Full Code Here

      y += 20;
      x = rsx;
    }

    if (t != null) {
      Font font = FontHelper.getFont(FontHelper.HEMI_HEAD, Color.white,
          25);
      font.drawString(sx + 10, sy + 10, t.getName());
      technologyDescription.setText(t.getDescription());
      technologyDescription.setPosition(sx + 10, sy += 35);
    } else {
      technologyDescription.setText("");
    }
View Full Code Here

    final int x = Settings.WIDTH / 2 - w / 2 - 5;
    UIHelper.drawWindow(g, x, 0, w, h, 5);

    // Render the colony name
    UIHelper.drawWindow(g, Settings.WIDTH - 140, 0, 140, 46, 5);
    Font font = FontHelper.getFont(FontHelper.HEMI_HEAD, Color.white, 20);
    font.drawString(Settings.WIDTH - 130, 15, GameData.getSelectedColony()
        .getName());

    researchProgress.setOX(x + 10);
    researchProgress.setOY(41);
    researchProgress.setWidth(BUTTON_WIDTH * 2 + 5);

    String label = "";
    ResearchAction action = GameData.getSelectedColony().getResearch();
    if (action == null) {
      label = I18n.getFirstToUpper("research.no_research");
    } else {
      label = action.getTechnology().getName();
      this.researchProgress.setMaxValue(BigDecimal.valueOf(100));
      this.researchProgress.setValue(BigDecimal.valueOf(action
          .getProgression()));
    }
    researchProgress.render(g);

    font.drawString(x + 10, 60, label);
  }
View Full Code Here

    @Override
    public void render(GameContainer gc, StateBasedGame sbg, Graphics grphcs) throws SlickException {
        grphcs.setBackground(Color.white);
        grphcs.setColor(Color.black);
       
        Font font = grphcs.getFont();
        int posX = (800/2 - font.getWidth("BLOCKS THAT FALL") / 2);
        int posY = (600/2 - font.getHeight("BLOCKS THAT FALL") / 2);
       
        grphcs.drawString("BLOCKS THAT FALL", posX, posY);
       
        posX = (800/2 - font.getWidth("Press SPACE to start game") / 2);
        posY = 30 + (600/2 - font.getHeight("Press SPACE to start game") / 2);
       
        grphcs.drawString("Press SPACE to start game", posX, posY);
    }
View Full Code Here

    @Override
    public void render(GameContainer gc, StateBasedGame sbg, Graphics grphcs) throws SlickException {
        grphcs.setBackground(Color.white);
        grphcs.setColor(Color.black);
       
        Font font = grphcs.getFont();
        int posX = (800/2 - font.getWidth("SCORE: "+BlocksThatFall.score) / 2);
        int posY = (600/2 - font.getHeight("SCORE: "+BlocksThatFall.score) / 2)-60;
        grphcs.drawString("SCORE: "+BlocksThatFall.score, posX, posY);
       
        posX = (800/2 - font.getWidth("GAME OVER") / 2);
        posY = (600/2 - font.getHeight("GAME OVER") / 2);
        grphcs.drawString("GAME OVER", posX, posY);
       
        posX = (800/2 - font.getWidth("press SPACE to play again or ESC to exit") / 2);
        posY = 30 + (600/2 - font.getHeight("press SPACE to play again or ESC to exit") / 2);
        grphcs.drawString("press SPACE to play again or ESC to exit", posX, posY);
    }
View Full Code Here

    simple_fonts.put(3, new AngelCodeFont("res/fonts/simple18.fnt","res/fonts/simple18_0.png"));
  }
 
  /** Draws String. */
  public void drawString(Graphics g, float x, float y, String text, int style, float size, Color color){
    Font oldFont = g.getFont();
    Color oldColor = g.getColor();
   
    Font newFont = chooseFonts(style).get((int) size);
   
    g.setFont(newFont);
    g.setColor(color);
   
    g.drawString(text, x, y);
View Full Code Here

    if (background != null) {
      g.setColor(background.multiply(clr));
      g.fillRect(x, y, width, height);
    }
    g.setColor(text.multiply(clr));
    Font temp = g.getFont();

    int cpos = font.getWidth(value.substring(0, cursorPos));
    int tx = 0;
    if (cpos > width) {
      tx = width - cpos - font.getWidth("_");
View Full Code Here

TOP

Related Classes of org.newdawn.slick.Font

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.