Package com.golden.gamedev.object

Examples of com.golden.gamedev.object.GameFont


    this.put("Background Color", new Color(204, 204, 255));
   
    this.put("Text Color", Color.BLACK);
    this.put("Text Disabled Color", Color.GRAY);
   
    GameFont font = new SystemFont(new Font("DIALOG", Font.BOLD, 14));
    this.put("Text Font", font);
    this.put("Text Disabled Font", font);
   
    this.put("Text Vertical Alignment Integer", UIConstants.CENTER);
    this.put("Text Insets", new Insets(2, 6, 2, 0));
View Full Code Here


    }
   
    String tipText = tooltip.getToolTipText();
    String[] document = GraphicsUtil.parseString(tipText);
   
    GameFont font = (GameFont) this.get("Text Font", component);
    Insets inset = (Insets) this.get("Text Insets", component);
    int space = ((Integer) this.get("Text Vertical Space Integer",
            component)).intValue();
    int width = 0;
    for (int i = 0; i < document.length; i++) {
      w = font.getWidth(document[i]) + inset.left + inset.right;
      if (w > width) {
        width = w;
      }
    }
    int height = (document.length * (font.getHeight() + space)) - space
            + inset.top + inset.bottom;
   
    BufferedImage[] ui = GraphicsUtil.createImage(1, width, height,
            Transparency.OPAQUE);
    Graphics2D g = ui[0].createGraphics();
View Full Code Here

    this.put("Background Disabled Color", null);
   
    this.put("Text Color", Color.BLACK);
    this.put("Text Disabled Color", Color.GRAY);
   
    GameFont font = new SystemFont(new Font("Verdana", Font.PLAIN, 12));
    this.put("Text Font", font);
    this.put("Text Disabled Font", font);
   
    this.put("Text Horizontal Alignment Integer", UIConstants.LEFT);
    this.put("Text Vertical Alignment Integer", UIConstants.CENTER);
View Full Code Here

   * method.
   */
  public final void start() {
    // grabbing engines from master engine
    this.grabEngines();
    GameFont fpsFont = this.parent.fpsFont;
    if (!this.initialized) {
      this.initResources();
      this.initialized = true;
    }
   
    this.finish = false;
   
    // start game loop!
    // before play, clear memory (runs garbage collector)
    System.gc();
    System.runFinalization();
   
    this.bsInput.refresh();
    this.bsTimer.refresh();
   
    long elapsedTime = 0;
    out: while (true) {
      if (this.parent.inFocus) {
        // update game
        this.update(elapsedTime);
        this.parent.update(elapsedTime); // update common variables
        this.bsInput.update(elapsedTime);
       
      }
      else {
        // the game is not in focus!
        try {
          Thread.sleep(300);
        }
        catch (InterruptedException e) {
        }
      }
     
      do {
        if (this.finish || !this.parent.isRunning()) {
          // if finish, quit this game
          break out;
        }
       
        // graphics operation
        Graphics2D g = this.bsGraphics.getBackBuffer();
       
        this.render(g); // render game
        this.parent.render(g); // render global game
       
        if (!this.parent.isDistribute()) {
          // if the game is still under development
          // draw game FPS and other stuff
         
          // to make sure the FPS is drawn!
          // remove any clipping and alpha composite
          if (g.getClip() != null) {
            g.setClip(null);
          }
          if (g.getComposite() != null) {
            if (g.getComposite() != AlphaComposite.SrcOver) {
              g.setComposite(AlphaComposite.SrcOver);
            }
          }
         
          fpsFont.drawString(g, "FPS = " + this.getCurrentFPS() + "/"
                  + this.getFPS(), 9, this.getHeight() - 21);
         
          fpsFont.drawString(g, "GTGE", this.getWidth() - 65, 9);
        }
       
        if (!this.parent.inFocus) {
          this.parent.renderLostFocus(g);
        }
View Full Code Here

TOP

Related Classes of com.golden.gamedev.object.GameFont

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.