Пример #1
0
  @Override
  public void render(GameContainer gc, StateBasedGame sb, Graphics g) throws SlickException {
    // Background etc.
    g.setAntiAlias(true);
    g.drawImage(
        background,
        gc.getWidth() / 2 - background.getWidth() / 2,
        gc.getHeight() / 2 - background.getHeight() / 2);
    uniTitle.drawString(
        gc.getWidth() / 2 - uniTitle.getWidth("Highscores") / 2,
        (float) 0,
        "Highscores",
        Color.orange);

    count = 0;

    // Zeichnet die Überschrift
    MenuItem item = levelNames.get(0);
    uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
    item = playerNames.get(0);
    uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
    item = times.get(0);
    uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());

    // Von start bis zu end
    for (int i = start; i <= end; i++) {
      // Falls wir am ende der Liste angekommen sind, abbrechen und itemsOnSide setzen
      if (i == levelNames.size()) {
        itemsOnSide = i - start;
        break;
      }
      // Maximale itemsOnSide = 10
      else {
        itemsOnSide = 10;
      }

      // Zeichnen der Highscores
      item = levelNames.get(i);
      uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
      item = playerNames.get(i);
      uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
      item = times.get(i);
      uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
    }

    g.setColor(Color.green);
    g.draw(selection);

    // aktuelle Seite zeichnen
    String displayside = "Seite " + (side + 1) + " von " + sideCount;
    uniNormal.drawString(
        gc.getWidth() / 2 - uniNormal.getWidth(displayside) / 2,
        gc.getHeight() - uniNormal.getHeight(displayside),
        displayside,
        Color.orange);

    // ESC String
    uniNormal.drawString(
        0, gc.getHeight() - uniNormal.getHeight("ESC = Zurück"), "ESC = Zurück", Color.orange);
  }
Пример #2
0
  @Override
  public void render(GameContainer container, StateBasedGame state, Graphics g)
      throws SlickException {

    /*g.setColor(Color.gray);
    g.fillRect(0, 0, container.getWidth(), container.getHeight());
    g.setColor(Color.black);*/

    play.renderWorld(g);
    g.setColor(Color.white);

    image.draw(0, 0, container.getWidth(), container.getHeight());

    float offset = 0;
    for (PlayerUI player : play.players) {
      g.drawString(
          player.agent.getName()
              + " died of exposure after only "
              + Math.floor(player.agent.getExpiredTime())
              + " hours.",
          10,
          scroller + offset);
      offset -= 30;
    }

    g.drawString(
        "press Escape to exit or Enter to start again",
        container.getWidth() / 2 - 250,
        container.getHeight() / 2 + 300);
  }
Пример #3
0
  /**
   * Rendering method for the HighScoreBoard.
   *
   * @param gameContainer used by the program.
   * @param stateBasedGame being played at the moment.
   * @param graphics used by the game.
   * @throws SlickException
   */
  @Override
  public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics)
      throws SlickException {
    gameContainer.setPaused(tPause);
    if (!tPause) {
      tBackground.draw(0, 0, gameContainer.getWidth(), gameContainer.getHeight());

      graphics.setColor(Color.white);
      graphics.drawString("HIGH SCORE BOARD", 600, 100);
      graphics.drawString("Press Enter to return to menu", 550, 150);

      if (tMain.getGame() == null) {
        tHighScoreManager = new HighScoreManager();
      } else {
        tHighScoreManager = tMain.getGame().getHighScoreManager();
      }

      ArrayList<Score> list = tHighScoreManager.getScores();
      int x = 400;
      int y = 300;
      int j = 1;

      for (Score aList : list) {
        graphics.drawString(
            j + ". " + aList.getPlayer() + ": " + Integer.toString(aList.getScore()) + "\n", x, y);
        y = y + 25;
        j = j + 1;
      }
    }
  }
Пример #4
0
  @Override
  public void display(Graphics g, Player player, Area currentArea, int camX, int camY) {
    int viewX = StateSingleplayer.VIEW_SIZE_X;
    int viewY = StateSingleplayer.VIEW_SIZE_Y;
    int worldX = StateSingleplayer.WORLD_SIZE_X;
    int worldY = StateSingleplayer.WORLD_SIZE_Y;

    g.setColor(BACKGROUND_BLACK);

    int posX = (int) (7.5 * viewX) / 10 + camX;
    int posY = (int) (.75 * viewY) / 10 + camY;
    int width = (int) (2.3 * viewX) / 10;
    int height = (int) (((double) worldY / worldX) * (2.3 * viewX) / 10);

    g.fillRect(posX, posY, width, height);

    for (GameObject o : currentArea.getObjects()) {
      g.setColor(o.getColor());
      g.fillRect(
          (int) (posX + (width - o.getMiniWidth()) * ((double) o.getX()) / worldX),
          (int) (posY + (height - o.getMiniHeight()) * ((double) o.getY()) / worldY),
          o.getMiniWidth(),
          o.getMiniHeight());
    }
  }
 public void render(GameContainer gc, Graphics g) {
   int rid, x, y;
   if (!filling) g.drawImage(c, 0, 0);
   for (int i = 0; i < speed; i++) {
     if (fpx.size() == 0) {
       // after this all of the data in this class will be written over
       if (filling) {
         ClientMain.menu = postTrans;
       }
       filling = true;
       initialize();
     }
     rid = ServerMain.r.nextInt(fpx.size());
     x = fpx.get(rid);
     y = fpy.get(rid);
     fpx.remove(rid);
     fpy.remove(rid);
     indeces[x][y] = !indeces[x][y];
     if (filling) {
       g1.drawImage(
           a.getSubImage(
               x * ClientMain.pixW, y * ClientMain.pixW, ClientMain.pixW, ClientMain.pixW),
           x * ClientMain.pixW,
           y * ClientMain.pixW);
     } else {
       g1.setColor(Colors.backgroundColor.darker(1f - (ServerMain.r.nextInt(55) + 200f) / 256f));
       g1.fillRect(x * ClientMain.pixW, y * ClientMain.pixW, ClientMain.pixW, ClientMain.pixW);
     }
     add(x + 1, y);
     add(x - 1, y);
     add(x, y + 1);
     add(x, y - 1);
   }
   g.drawImage(b, 0, 0);
 }
Пример #6
0
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    g.setBackground(Color.black);
    g.setFont(
        new TrueTypeFont(
            new java.awt.Font(java.awt.Font.SANS_SERIF, java.awt.Font.BOLD, 50), true));

    for (int i = 0; i < 4; ++i) {
      if (i == this.selected) {
        g.setColor(new Color(255, 255, 255));
      } else {
        g.setColor(new Color(0, 0, 255));
      }
      g.fillRect(10, 10 * (i + 1) + 137 * i, 780, 137);
    }

    g.setColor(new Color(255, 255, 255));
    g.drawString("Block Dutz", 250, 50);

    String[] texte = {"Jouer", "Scores", "Quitter"};
    for (int i = 1; i < 4; ++i) {
      if (i == this.selected) {
        g.setColor(new Color(0, 0, 0));
      } else {
        g.setColor(new Color(255, 255, 255));
      }
      g.drawString(texte[i - 1], 300, 10 * (i + 1) + 137 * i + 30);
    }
  }
Пример #7
0
  @Override
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    for (int i = 0; i < tile_map.length; i++) {
      for (int j = tile_map[i].length - 1; j >= 0; j--) {
        int x = (int) (((j * tile_width / 2) + (i * tile_width / 2)) * Properties.ResolutionScale);
        int y =
            (int)
                (((i * tile_height / 2) - (j * tile_height / 2) + 360)
                    * Properties.ResolutionScale);
        getSpriteImage(tile_map[i][j]).draw(x, y, Properties.ResolutionScale);
      }
    }

    for (int i = 0; i < object_map.length; i++) {
      for (int j = object_map[i].length - 1; j >= 0; j--) {
        int x = (int) (((j * tile_width / 2) + (i * tile_width / 2)) * Properties.ResolutionScale);
        int y =
            (int)
                (((i * tile_height / 2) - (j * tile_height / 2) + 360)
                    * Properties.ResolutionScale);
        getSpriteImage(object_map[i][j]).draw(x, y, Properties.ResolutionScale);
      }
    }

    if (updatePreview) {
      g.copyArea(imagePreview, 0, 0);
      updatePreview = false;
    }
    if (!HideOverlay) {
      g.setColor(backgroundColor);
      g.fillRect(0, 0, 1280 * Properties.ResolutionScale, 720 * Properties.ResolutionScale);
      textHandle.drawStrings(sceneDescription);
    }
  }
Пример #8
0
  @Override
  public void render(GameContainer gc, Graphics g) throws SlickException {
    backgroundImage.draw();

    Airplane airplaneHandle;
    Iterator<Airplane> it;
    it = airQueue.iterator();
    while (it.hasNext()) {
      airplaneHandle = it.next();

      airplaneHandle.render(g, airplaneImage);
    }
    it = groundQueue.iterator();
    while (it.hasNext()) {
      airplaneHandle = it.next();

      airplaneHandle.render(g, airplaneImage);
    }
    airplaneHandle = runway.getCurrentAirplane();
    if (airplaneHandle != null) airplaneHandle.render(g, airplaneImage);

    g.setColor(Color.white);
    g.drawString("Airport Simulator", gc.getWidth() - 170, 10);
    g.drawString("Update: " + currentUpdate, gc.getWidth() - 130, gc.getHeight() - 30);
  }
Пример #9
0
  public void render(GameContainer gc, Graphics g) throws SlickException {
    // clears
    g.clear();
    // backgrond
    g.setColor(new Color(103, 194, 240));
    g.fillRect(0, 0, MainApp.SCREEN_WIDTH, MainApp.SCREEN_HEIGHT);

    // compute shift right
    shiftRight += computeShiftRight();

    // draws every object
    ObjectBoilerplate object;
    for (int x = 0; x < WORLD_LENGTH; x++) {
      for (int y = 0; y < WORLD_HEIGHT; y++) {
        object = tileArray[x][y];
        if (object != null) {
          object.render(shiftRight);
          g.setColor(Color.red);
          //                    g.fillRect(object.rect.getX() - shiftRight, MainApp.SCREEN_HEIGHT -
          // object.rect.getY(), object.rect.getWidth(), object.rect.getHeight());
        }
      }
    }
    //        g.setColor(Color.red);
    //        g.fillRect(player.rect.getX() - shiftRight, MainApp.SCREEN_HEIGHT -
    // player.rect.getY(), player.rect.getWidth(), -player.rect.getHeight());
    player.render(shiftRight);
  }
Пример #10
0
 @Override
 public void render(GUIContext container, Graphics g) {
   g.setColor(Color.black);
   g.drawRect(x, y, width, height);
   area.render(container, g);
   g.drawString("" + shortcut, x + 2, y + 2);
 }
Пример #11
0
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    if (this.isHit == false && !gc.isPaused()) {
      this.move(hip, this.ship.getRotation());
      this.ship.draw(this.x, this.y);
    } else if (System.currentTimeMillis() <= this.explosionTime + 300) {
      MultiplayerGame.explosion.draw(this.x - 15, this.y - 10);
    }

    if (shotFired && !Menu.multi) {
      if (currentShotSP.shotVisible && !currentShotSP.hit) {
        currentShotSP.updateShot();
        g.fillOval(currentShotSP.x, currentShotSP.y, 8, 8);
      } else if (currentShotSP.timeFired + 800 < System.currentTimeMillis()) {
        currentShotSP.hit = false;
        currentShotSP.shotVisible = false;
      }
    } else if (shotFired && Menu.multi) {
      if (currentShotMP.shotVisible && !currentShotMP.hit) {
        currentShotMP.updateShot();
        g.fillOval(currentShotMP.x, currentShotMP.y, 8, 8);
      } else if (currentShotMP.timeFired + 800 < System.currentTimeMillis()) {
        currentShotMP.hit = false;
        currentShotMP.shotVisible = false;
      }
    }
  }
Пример #12
0
 private void renderText(Graphics g) {
   g.setColor(Color.white);
   g.drawString("Press SPACE to change display setup.", 10, 25);
   g.drawString("Currently viewing: " + mode, 10, 40);
   g.drawString("Press W to show all windows in this state.", 10, 55);
   g.drawString("Use keys 1-3 to change states.", 10, 70);
 }
Пример #13
0
  public void renderShopStock(Graphics g, int[] inventory) {

    int x = 240, y = 464;
    g.setColor(Color.black);

    int inventoryCounter = 0;

    for (Items item : this.itemList) {

      if (!item.isEquipped()) {
        if (inventoryCounter <= 20) {
          g.setColor(item.getItemRarityColor());
          g.fillRect(x, y, 32, 32);
          item.drawImageItem(x, y);
          inventory[inventoryCounter++] = item.getID();
        }

        x += 64;
        if (x > 496) {
          x = 112;
          y += 64;
        }
      }
    }
  }
Пример #14
0
 @Override
 public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics)
     throws SlickException {
   graphics.drawString("1. Single Play Game", 50, 100);
   graphics.drawString("2. Multi Play Game", 50, 120);
   graphics.drawString("3. Quit", 50, 140);
 }
Пример #15
0
 @Override
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   g.setColor(Color.white);
   g.drawString(title, (gc.getWidth() / 2) - ((title.length() * 9) / 2), 180);
   g.drawString(enter, (gc.getWidth() / 2) - ((enter.length() * 9) / 2), 220); // Use buttons later
   g.drawString(esc, (gc.getWidth() / 2) - ((esc.length() * 9) / 2), 240);
 }
  /**
   * @see org.newdawn.slick.state.GameState#render(org.newdawn.slick.GameContainer,
   *     org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics)
   */
  public void render(GameContainer container, StateBasedGame arg1, Graphics g)
      throws SlickException {
    world.render(container, arg1, g);
    //		for (int i = 0 ; i < bulletDirector.getBullets ().size (); ++i)
    //		{
    //			Bullet bullet = bulletDirector.getBullets ().get (i);
    //			if (bullet.isHeadingActive ())
    //				rocket.getImage ().setRotation (bullet.getHeading () + 90);
    //			else
    //				rocket.getImage ().setRotation (bullet.getRotation () + 90);
    //
    //			g.drawImage (rocket.getImage (), (int)bullet.getX (), (int)bullet.getY ());
    //		}
    //		for (int x = 0; x < 20; ++x)
    //			g.drawImage (rocket.getImage (), (int)60 + xpos, (int)250 + (15 * x));
    //		g.drawImage (rocket.getImage (), (int)60 + xxpos, (int)350);
    int tileIndexX = (int) (mapX / map.getTileWidth());
    int tileIndexY = (int) (mapY / map.getTileHeight());
    map.render(
        (int) 0,
        (int) 0,
        tileIndexX,
        tileIndexY,
        (int) 1024 + map.getTileWidth(),
        (int) 768 + map.getTileHeight());

    g.drawString("GameTime: " + world.getNetworkTime(), 100, 10);
    g.drawString("TimeShift: " + client.getGameTimeManager().getNetworkTimeShift(), 280, 10);
    g.drawString("Delta: " + delta, 450, 10);
    g.drawString("MapXY: " + mapX + ":" + mapY, 450, 60);
  }
Пример #17
0
 @Override
 public void render(GameContainer container, Graphics g) throws SlickException {
   g.drawImage(background, 0, 0);
   g.setBackground(Color.white);
   g.setColor(new Color(100, 100, 100, 0.5f));
   g.drawImage(balls, 0, 0, new Color(255, 255, 255, 0.5f));
   // g.fillOval( 0, 0, 0, 90);
 }
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   // g.getBackground();//TODO use .Background() function?
   g.drawImage(startgamebackground, 0, 0);
   g.drawImage(startgame, buttonleftx, 300);
   g.drawImage(highscore, buttonleftx, 360);
   g.drawImage(Instructions, buttonleftx, 420);
   g.drawImage(exitgame, buttonleftx, 480);
 }
Пример #19
0
 /**
  * Draw a line of text at a given start point
  *
  * @param g - Graphics context
  * @param font - The font of the text
  * @param string - The string to be drawn
  * @param firstLineX - The x coordinate of the first character
  * @param firstLineY - The y coordinate
  */
 public static void drawLines(
     Graphics g, Font font, String string, int firstLineX, int firstLineY) {
   g.setFont(font);
   for (String s : string.split("\n")) {
     g.drawString(s, firstLineX, firstLineY);
     firstLineY += font.getLineHeight() + 10;
   }
 }
Пример #20
0
 /**
  * Draws a string centered relative to a given point
  *
  * @param g - Graphics context
  * @param font - The font for the text
  * @param string - the string to draw
  * @param firstLineMiddleX - The middle x coordinate
  * @param firstLineY - The y coordinate
  */
 public static void drawCenteredLines(
     Graphics g, Font font, String string, int firstLineMiddleX, int firstLineY) {
   g.setFont(font);
   for (String s : string.split("\n")) {
     g.drawString(s, firstLineMiddleX - font.getWidth(s) / 2, firstLineY);
     firstLineY += font.getLineHeight() + 10;
   }
 }
Пример #21
0
 @Override
 public void render(GameContainer container, StateBasedGame game, Graphics g)
     throws SlickException {
   // TODO Auto-generated method stub
   g.drawString("You Lose", 460, 120);
   Image image = new Image("gameStates/restart.png");
   g.drawImage(image, 400, 200);
 }
 @Override
 public void render(GameContainer c, StateBasedGame arg1, Graphics g) throws SlickException {
   img.draw(c.getWidth() / 5, c.getHeight() / 5, c.getWidth() / 5, c.getHeight() / 5);
   g.setColor(Color.white);
   // change to be font - text selection capabilites
   g.drawString(newGame, c.getWidth() / 2, c.getHeight() / 2);
   g.drawString(quit, c.getWidth() / 2, c.getHeight() / 2 + 50);
 }
 private void renderKioskWarning(Graphics g) {
   g.setColor(Color.white);
   g.setFont(GameFont.GARAMOND_18_WHITE_BOLD.font());
   g.drawString(
       String.format(
           "Returning to main menu in %d seconds. Move mouse to cancel.", getSecondsRemaining()),
       300,
       750);
 }
Пример #24
0
 public void drawColorName(Graphics g, TrueTypeFont f, int drawX, int drawY, boolean isName) {
   Graphics g1 = g;
   g1.setColor(new Color(colorNameR, colorNameG, colorNameB));
   if (isName) {
     g1.drawString(name, drawX, drawY);
   } else {
     g1.drawString(String.valueOf(score), drawX, drawY);
   }
 }
Пример #25
0
 /*
  * Vykresleni
  */
 @Override
 public void render(Graphics graphics) {
   super.render(graphics);
   graphics.setColor(Color.black);
   graphics.fillRect(530, 10, 102, 7);
   graphics.setColor(Color.red);
   graphics.fillRect(531, 11, (float) (hStep * getHealth()), 5);
   inventory.draw(graphics);
 }
Пример #26
0
 /** Draws a red outline of the personal shape */
 public void drawPersonal(Graphics g) {
   // Create a red color
   org.newdawn.slick.Color r = new org.newdawn.slick.Color(255, 0, 0);
   // Set the graphics to the red color
   g.setColor(r);
   updatePersonal();
   // draw the shape
   g.draw(personal);
 }
Пример #27
0
 @Override
 public void render(
     GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics) {
   if (active) {
     graphics.drawImage(activeImage, x, y);
   } else {
     graphics.drawImage(inactiveImage, x, y);
   }
 }
Пример #28
0
 @Override
 public void render(GameContainer container, Graphics graphics) throws SlickException {
   Animation curAnimation = getAnimationCurrent();
   if (curAnimation == null) {
     graphics.drawImage(getImage(), getLocX(), getLocY());
   } else {
     graphics.drawAnimation(curAnimation, getLocX(), getLocY());
   }
 }
Пример #29
0
 /**
  * @see org.newdawn.slick.gui.AbstractComponent#render(org.newdawn.slick.gui.GUIContext,
  *     org.newdawn.slick.Graphics)
  */
 public void render(GUIContext container, Graphics g) {
   if (currentImage != null) {
     currentImage.draw(area.getX(), area.getY(), currentColor);
   } else {
     g.setColor(currentColor);
     g.fill(area);
   }
   updateImage();
 }
Пример #30
0
 @Override
 public void render(GameContainer container, StateBasedGame game, Graphics g) {
   Entity owner = this.owner;
   g.setColor(owner.getBackgroundColor());
   g.fillRect(
       owner.getPosition().getX() - owner.getPadding().getLeft() - owner.getMargin().getRight(),
       owner.getPosition().getY() - owner.getPadding().getTop(),
       owner.getWidth() + owner.getPadding().getRight() + owner.getPadding().getLeft(),
       owner.getHeight() + owner.getPadding().getBottom() + owner.getPadding().getTop());
 }