コード例 #1
0
 private void renderAmmo() {
   Ammo ammo = ammoMapper.get(player);
   g.translate(container.getWidth() - 64, container.getHeight() - 45);
   {
     font.drawString(-16, 8, "Ammo");
     g.rotate(0, 0, -90);
     float ammoStatus = ammo.getAmmoStatus();
     g.setDrawMode(Graphics.MODE_ADD);
     statusBar.draw(
         0,
         0,
         statusBar.getWidth() * ammoStatus,
         statusBar.getHeight(),
         0,
         0,
         statusBar.getWidth() * ammoStatus,
         statusBar.getHeight(),
         ammoStatus < 0.25 ? Color.red : ammoStatus < 0.6 ? Color.yellow : Color.green);
     statusBar.draw(
         statusBar.getWidth() * ammoStatus,
         0,
         statusBar.getWidth(),
         statusBar.getHeight(),
         statusBar.getWidth() * ammoStatus,
         0,
         statusBar.getWidth(),
         statusBar.getHeight(),
         new Color(0.15f, 0.15f, 0.15f));
     g.setDrawMode(Graphics.MODE_NORMAL);
     g.rotate(0, 0, 90);
   }
   g.translate(-container.getWidth() + 64, -container.getHeight() + 45);
 }
コード例 #2
0
 private void renderHealth() {
   Health health = healthMapper.get(player);
   g.translate(35, container.getHeight() - 45);
   {
     font.drawString(-26, 8, "Health");
     g.rotate(0, 0, -90);
     float healthStatus = health.getHealthStatus();
     g.setDrawMode(Graphics.MODE_ADD);
     statusBar.draw(
         0,
         0,
         statusBar.getWidth() * healthStatus,
         statusBar.getHeight(),
         0,
         0,
         statusBar.getWidth() * healthStatus,
         statusBar.getHeight(),
         healthStatus < 0.25 ? Color.red : healthStatus < 0.6 ? Color.yellow : Color.green);
     statusBar.draw(
         statusBar.getWidth() * healthStatus,
         0,
         statusBar.getWidth(),
         statusBar.getHeight(),
         statusBar.getWidth() * healthStatus,
         0,
         statusBar.getWidth(),
         statusBar.getHeight(),
         new Color(0.15f, 0.15f, 0.15f));
     g.setDrawMode(Graphics.MODE_NORMAL);
     g.rotate(0, 0, 90);
   }
   g.translate(-35, -container.getHeight() + 45);
 }
コード例 #3
0
 @Override
 public void render(GameContainer container, StateBasedGame game, Graphics g)
     throws SlickException {
   background.draw(0, 0);
   startGameOption.draw(menuX, menuY);
   exitOption.draw(menuX, menuY + 100);
 }
コード例 #4
0
  /**
   * @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer,
   *     org.newdawn.slick.Graphics)
   */
  public void render(GameContainer container, Graphics g) {
    g.setBackground(Color.lightGray);
    //		image.draw(0,0, inside ? Color.red : Color.white);
    //		timage.draw(10,310);

    image.draw();
    timage.draw(image.getWidth(), 0);
  }
コード例 #5
0
 @Override
 public void render(GameContainer container, Graphics g) throws SlickException {
   // throw new UnsupportedOperationException("Not supported yet.");
   // g.drawString("Hello World", 100, 100);
   land.draw(0, 0);
   plane1.draw(
       (float) jugador1.getPosicion().getX(), (float) jugador1.getPosicion().getY(), 0.75f);
   plane2.draw(
       (float) jugador2.getPosicion().getX(), (float) jugador2.getPosicion().getY(), 0.75f);
 }
コード例 #6
0
ファイル: MainMenuState.java プロジェクト: kdnewton/Pixahl
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {

    xTitle = (gc.getWidth() / 2) - (imgTitle.getWidth() / 2);
    xStart = (gc.getWidth() / 2) - (imgStart.getWidth() / 2);
    xOptions = (gc.getWidth() / 2) - (imgOptions.getWidth() / 2);
    xQuit = (gc.getWidth() / 2) - (imgQuit.getWidth() / 2);

    imgTitle.draw(xTitle, yTitle, sTitle);
    imgStart.draw(xStart, yStart, sStart);
    imgOptions.draw(xOptions, yOptions, sOptions);
    imgQuit.draw(xQuit, yQuit, sQuit);
  }
コード例 #7
0
 @Override
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   knight.draw(594, 360);
   mage.draw(784, 360);
   thief.draw(976, 360);
   g.setColor(Color.white);
   g.drawString("Name:", 650, 500);
   tf.render(gc, g);
   tf.setFocus(true);
   for (int i = 0; i < buttons.size(); i++) {
     buttons.get(i).draw(g);
   }
 }
コード例 #8
0
ファイル: Hero.java プロジェクト: DaoDaiMai/lsthatcreep
 public void Render(int i, Graphics g) throws SlickException {
   if (i == 0) {
     pic.draw(150, 200);
     g.drawString("Name " + name, 100, 100);
     g.drawString("Hp " + hp, 100, 120);
     g.drawString("Damage " + damage, 100, 140);
     g.drawString("Delay " + delay, 100, 160);
   } else {
     pic.draw(550, 200);
     g.drawString("Name " + name, 400, 100);
     g.drawString("Hp " + hp, 400, 120);
     g.drawString("Damage " + damage, 400, 140);
     g.drawString("Delay " + delay, 400, 160);
   }
 }
コード例 #9
0
ファイル: HomerIA.java プロジェクト: nam0r/Devint
  @Override
  public void render(Graphics g) {
    int sx = 0;
    int sy = 0;

    if (moving() && onGround()) {
      sx = frame % nb_sprites;
      sy = 0;
    } else if (onGround()) {
      sx = 0;
      sy = 0;
    }

    // get the appropriate sprite
    Image image = walk.getSprite(sx, sy);
    image = image.getFlippedCopy(true, false);

    // if we're facing the other direction, flip the sprite over
    if (facingRight()) {
      image = image.getFlippedCopy(true, false);
    }

    image.draw(getX() - width / 2, getY() - height / 2, width, height + 4);
    permanentSound();
  }
コード例 #10
0
ファイル: Camera.java プロジェクト: kieve/Archive
  /** Special render method for the TiledMap foreground layer. */
  private void renderFore() {

    if (playerIsBehindForeground(curPlayerX, curPlayerY) || movedIntoOpen) {

      // Update the non-rendered tiles if the player
      // is occupying a new tile this frame
      if (updateForeground || movedIntoOpen) {
        updateForeground = false;

        for (int i = 0; i < foreAlpha.length; i++) {
          map.setTileId(foreAlpha[i][0], foreAlpha[i][1], foregroundLayerIndex, foreAlpha[i][2]);
        }
        foreAlphaIndex = 0;
      }

      if (changedPosition && !movedIntoOpen) {
        for (int y = curPlayerY - foregroundAlphaRadius;
            y <= curPlayerY + foregroundAlphaRadius;
            y++) {
          for (int x = curPlayerX - foregroundAlphaRadius;
              x <= curPlayerX + foregroundAlphaRadius;
              x++) {
            int dX = curPlayerX - x;
            int dY = curPlayerY - y;
            float dd = (float) Math.sqrt((dX * dX) + (dY * dY));
            if (dd <= foregroundAlphaRadius + 0.5
                && x >= 0
                && y >= 0
                && x < map.getWidth()
                && y < map.getHeight()) {
              addToForegroundAlpha(
                  x,
                  y,
                  map.getTileId(x, y, foregroundLayerIndex),
                  map.getTileImage(x, y, foregroundLayerIndex));
              map.setTileId(x, y, foregroundLayerIndex, 0);
            }
          }
        }
      }
    }
    renderLayer("FOREGROUND");

    if (playerIsBehindForeground(curPlayerX, curPlayerY)) {
      for (int i = 0; i < foreAlphaImage.length; i++) {
        try {
          int x = foreAlpha[i][0];
          int y = foreAlpha[i][1];
          float dX = (vPlayerX / tileWidth) - x;
          float dY = (vPlayerY / tileHeight) - y;
          float dd = (float) Math.sqrt((dX * dX) + (dY * dY));
          float alpha = (dd / foregroundAlphaRadius) + 0.25f;
          Image image = foreAlphaImage[i];
          image.setAlpha(alpha);
          image.draw(x * tileWidth, y * tileHeight);
        } catch (Exception e) {
        }
      }
    }
  }
コード例 #11
0
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   background.draw(0, 0);
   g.drawString(
       "Controls:\nWASD - Movement\nLeft Control - Slow Ship\nSpace Or Left Click - Fire\n\n\nClick To Begin\n\nEscape To Exit",
       330,
       100);
 }
コード例 #12
0
ファイル: HighScoreBoard.java プロジェクト: nubcaker/SEM
  /**
   * 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;
      }
    }
  }
コード例 #13
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);
  }
コード例 #14
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);
  }
コード例 #15
0
 @Override
 public void render(GameContainer container, StateBasedGame game, Graphics g)
     throws SlickException {
   image.draw();
   startButton.render(container, g);
   endButton.render(container, g);
   wtfButton.render(container, g);
 }
コード例 #16
0
 @Override
 public void render(GUIContext container, Graphics g) {
   fond.draw(getX(), getY(), getWidth(), getHeight());
   super.render(container, g);
   for (PanelSenateur s : senateurs) {
     s.render(container, g);
   }
 }
コード例 #17
0
 @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);
 }
コード例 #18
0
ファイル: Exit.java プロジェクト: spotco/Save-the-Princess
 public void render() {
   arrowdisplay++;
   if (arrowdisplay < 25) {
     if (direction.equals("up")) {
       pointer.draw(x + 8, y);
     } else if (direction.equals("down")) {
       pointer.draw(x + 8, y + 15);
     } else if (direction.equals("left")) {
       pointer.draw(x, y + 7);
     } else if (direction.equals("right")) {
       pointer.draw(x + 14, y + 7);
     }
   }
   if (arrowdisplay > 50) {
     arrowdisplay = 0;
   }
 }
コード例 #19
0
  @Override
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    g.setColor(Color.black);

    // Top part
    backgroundImage.draw(
        -backgroundImage.getWidth() / 8, -backgroundImage.getHeight() / 8, 300, 800);
    titleImage.draw(TITLE_X, TITLE_Y);
    newGameImage.draw(NEWGAME_X, NEWGAME_Y);
    loadGameImage.draw(LOADGAME_X, LOADGAME_Y);
    if (MainMenuGameState.optionsActivated) {
      optionsImage.draw(OPTIONS_X, OPTIONS_Y);
    }

    // Map part
    mapImage.draw(MAP_X, MAP_Y, 800 - 2 * MAP_X, 600 - MAP_Y);
    Save s = Save.getInstance();
    if (s.hasSaveLoaded()) {
      int[] ids = s.getAllIds();
      for (int i = 0; i < ids.length; i++) {
        int[] mapLvl = s.mapPointForLevelID(ids[i]);
        if (mapLvl != null) {
          switch (s.getFinishedStateForLevelID(ids[i])) {
            case 0:
              mapLvlDefaultImage.draw(MAP_X + mapLvl[0], MAP_Y + mapLvl[1], mapLvl[2], mapLvl[3]);
              break;
            case 1:
              mapLvlUnlockedImage.draw(MAP_X + mapLvl[0], MAP_Y + mapLvl[1], mapLvl[2], mapLvl[3]);
              break;
            case 2:
              mapLvlFinishedImage.draw(MAP_X + mapLvl[0], MAP_Y + mapLvl[1], mapLvl[2], mapLvl[3]);
              break;
            case 3:
              mapLvlUnlockedFinishedImage.draw(
                  MAP_X + mapLvl[0], MAP_Y + mapLvl[1], mapLvl[2], mapLvl[3]);
              break;
            default:
              break;
          }
        }
      }
    }

    display.render(gc, g);
  }
コード例 #20
0
ファイル: TextBox.java プロジェクト: Niach/RetroProjects
 public void render(GameContainer gc, Graphics g) {
   sprite.draw(x, y);
   if (lines.size() > 0) {
     font.drawString(xLine1, yLine1, lines.get(0));
   }
   if (lines.size() > 1) {
     font.drawString(xLine2, yLine2, lines.get(1));
   }
 }
コード例 #21
0
  @Override
  public void render(GameContainer arg0, StateBasedGame arg1, Graphics arg2) throws SlickException {

    startScreen.draw(0, 0);
    startGameButton.draw();
    optionsButton.draw();
    loreButton.draw();
    instructionsButton.draw();
  }
コード例 #22
0
 @Override
 public void render(GameContainer arg0, Graphics arg1) throws SlickException {
   renderwall();
   player.render();
   trap.render();
   if (player.GameOver) {
     SplashGameOver.draw(140, 140);
   }
 }
コード例 #23
0
  @Override
  public void render(GameContainer container, StateBasedGame state, Graphics g)
      throws SlickException {
    g.setColor(Color.black);

    background.draw(0, 0);
    rupeeCounterImg.draw(320, 643);

    allOtherObjects.render(container, g);
    frog.render(container, g);

    woman.render(container, g);
    timerBar.render(container, g);

    g.drawString(guideString, 10, 6);
    g.drawString(String.valueOf(rupeeCounter), 300, 644);
    g.drawString("Highscore: " + String.valueOf(highscore), 20, 644);
  }
コード例 #24
0
ファイル: Instructions.java プロジェクト: puffluff/Supson
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   Instructions.draw(0, 0);
   move.draw(450, 120);
   slash.draw(450, 200);
   baddy.draw(450, 300);
   if (slash.getFrame() == 1) {
     g.drawImage(new Image("res/Link/Sword (right 2).png"), 490, 200);
   }
 }
コード例 #25
0
ファイル: MouseOverArea.java プロジェクト: alxyuu/tractorcg
 /**
  * @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();
 }
コード例 #26
0
ファイル: HUD.java プロジェクト: dustyshouri/LinksAwakening
  public void drawWeapons() {
    if (ticker % 1 < .5f)
      selecticon.draw(
          8 + (this.selection % 2) * 32 - 2, y + 24 + (int) (this.selection / 2) * 24 + 1);

    for (int i = 0; i < 10; i++) {
      if (plyr.inventory[i].getIDname() == "none") continue;
      int dx = 8 + (i % 2) * 32;
      int dy = y + 24 + (int) (i / 2) * 24;
      weapimgs.draw(
          dx,
          dy,
          dx + 24,
          dy + 16,
          (plyr.inventory[i].getID() % 4) * 24,
          (int) (plyr.inventory[i].getID() / 4) * 16,
          (plyr.inventory[i].getID() % 4) * 24 + 24,
          (int) (plyr.inventory[i].getID() / 4) * 16 + 16);
    }
  }
コード例 #27
0
  public void render(GameContainer container, StateBasedGame game, Graphics g)
      throws SlickException {

    startimage.draw();

    // TODO Auto‐generated method stub

    g.setColor(Color.white);

    // g.drawString("You LOSE!", 450, 200);
    g.drawString("you lost! restart game", 400, 320);
  }
コード例 #28
0
ファイル: EarthProjectile.java プロジェクト: joester/GJF12
 public void render(GameContainer container, Graphics g) throws SlickException {
   if (isFlippedHorizontally) {
     currentImage = imageLeft;
     spinAngularVelocity = -15;
   } else {
     currentImage = imageRight;
     spinAngularVelocity = 15;
   }
   spinAngle += spinAngularVelocity;
   currentImage.setRotation(spinAngle);
   currentImage.draw(xCoord, yCoord);
   // g.draw(getHitbox());
 }
コード例 #29
0
  /** Overriding the rendering method to render our own resources */
  @Override
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {

    /* Get mouse position */
    int posX = Mouse.getX();
    int posY = stateContainer.Game.MAXIMUMHEIGHT - Mouse.getY();
    // Fixing posY to reflect graphics coords

    /* Draw the background */
    menuBackground.draw(0, 0);

    /* If mouse over the menu button show hover version */
    if (posX > 20 && posX < 136 && posY > 20 && posY < 66) menuHover.draw(20, 20);
    else menuButton.draw(20, 20);

    // Draw background panel
    // pale orange, semi-transparent
    g.setColor(new Color(250, 235, 215, 50));
    g.fillRoundRect(50, 230, 1100, 320, 5);

    { // Draw credits screen
      g.setColor(Color.white);
      /* Starting y coordinate */
      int y = 240;

      for (String[] section : credits) {
        for (String line : section) {
          g.drawString(line, 60, y);
          /*
           * Each new line at 15 px from the previous
           */
          y += 15;
        }
        /* Each new paragraph at 30 px from the previous */
        y += 30;
      }
    }
  }
コード例 #30
0
  @Override
  protected void processEntities(ImmutableBag<Entity> entities) {
    ensurePlayerEntity();

    if (player != null) {
      hudBg.draw(
          0, container.getHeight() - hudBg.getHeight(), container.getWidth(), hudBg.getHeight());

      renderHealth();
      renderAmmo();
    }

    renderMinimap();
  }