Class TitleScreen
java.lang.Object
net.vincent.parkourwarrior.TitleScreen
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTitleScreen(ParkourMain parkourMain) Constructs a newTitleScreenwith a reference to the main game panel. -
Method Summary
Modifier and TypeMethodDescriptionintcenterTextX(String text, Graphics2D graphics2D) Calculates the X position to center a text string horizontally.intcenterTextY(String text, Graphics2D graphics2D) Calculates the Y position to center a text string vertically.voiddrawTitleScreen(Graphics2D graphics2D) Draws the title screen.
-
Field Details
-
choosedMap
public int choosedMapThe index of the currently selected map.- Since:
- 1.2
-
-
Constructor Details
-
TitleScreen
Constructs a newTitleScreenwith a reference to the main game panel.- Parameters:
parkourMain- the main game panel instance- Since:
- 1.2
-
-
Method Details
-
drawTitleScreen
Draws the title screen.Renders the background image, game title, map selection list with record times, and control instructions.
- Parameters:
graphics2D- theGraphics2Dcontext to draw on- Since:
- 1.2
-
centerTextX
Calculates the X position to center a text string horizontally.- Parameters:
text- the text to centergraphics2D- theGraphics2Dcontext for font metrics- Returns:
- the X coordinate for centered text
- Since:
- 1.2
-
centerTextY
Calculates the Y position to center a text string vertically.- Parameters:
text- the text to centergraphics2D- theGraphics2Dcontext for font metrics- Returns:
- the Y coordinate for centered text
- Since:
- 1.2
-