Class TitleScreen

java.lang.Object
net.vincent.parkourwarrior.TitleScreen

public class TitleScreen extends Object
Title screen class for Parkour Warrior.

This class handles the rendering of the title screen, including the game title, map selection list with record times, and control instructions. It allows the player to navigate through available maps before starting a game.

Since:
1.2
  • Field Details

    • choosedMap

      public int choosedMap
      The index of the currently selected map.
      Since:
      1.2
  • Constructor Details

    • TitleScreen

      public TitleScreen(ParkourMain parkourMain)
      Constructs a new TitleScreen with a reference to the main game panel.
      Parameters:
      parkourMain - the main game panel instance
      Since:
      1.2
  • Method Details

    • drawTitleScreen

      public void drawTitleScreen(Graphics2D graphics2D)
      Draws the title screen.

      Renders the background image, game title, map selection list with record times, and control instructions.

      Parameters:
      graphics2D - the Graphics2D context to draw on
      Since:
      1.2
    • centerTextX

      public int centerTextX(String text, Graphics2D graphics2D)
      Calculates the X position to center a text string horizontally.
      Parameters:
      text - the text to center
      graphics2D - the Graphics2D context for font metrics
      Returns:
      the X coordinate for centered text
      Since:
      1.2
    • centerTextY

      public int centerTextY(String text, Graphics2D graphics2D)
      Calculates the Y position to center a text string vertically.
      Parameters:
      text - the text to center
      graphics2D - the Graphics2D context for font metrics
      Returns:
      the Y coordinate for centered text
      Since:
      1.2