Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.risenphoenix.jnk.StarField.Menus;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.RenderingHints;
- import net.risenphoenix.jnk.StarField.Menus.Tutorials.HelpOne;
- import net.risenphoenix.jnk.StarField.Menus.Tutorials.HelpTwo;
- public class Menu {
- public static SFMenu sfmenu = new MainMenu();
- public static int menu = 0;
- public static final int NO_MENU = -1;
- public static final int MAIN_MENU = 0;
- public static final int OPTIONS_MENU = 1;
- public static final int ABOUT_MENU = 2;
- public static final int PAUSE_MENU = 3;
- public static final int DEATH_MENU = 4;
- public static final int HELP_MENU_1 = 5;
- public static final int HELP_MENU_2 = 6;
- public void drawMenu(Graphics g) {
- g.setFont(new Font("Century Gothic", Font.PLAIN, 40));
- // Antialias Text (GLOBAL)
- Graphics2D g2D = (Graphics2D)g;
- g2D.setRenderingHint(
- RenderingHints.KEY_TEXT_ANTIALIASING,
- RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
- // Main Menu
- if (menu == MAIN_MENU) {
- if (!sfmenu.getMenuName().equals("main") || sfmenu == null) {
- sfmenu = new MainMenu();
- }
- // Options Menu
- } else if (menu == OPTIONS_MENU) {
- if (!sfmenu.getMenuName().equals("options") || sfmenu == null) {
- sfmenu = new OptionsMenu();
- }
- // About Display
- } else if (menu == ABOUT_MENU) {
- if (!sfmenu.getMenuName().equals("about") || sfmenu == null) {
- sfmenu = new AboutMenu();
- }
- // Pause Menu
- } else if (menu == PAUSE_MENU) {
- if (!sfmenu.getMenuName().equals("pause") || sfmenu == null) {
- sfmenu = new PauseMenu();
- }
- // Death (Gameover) Menu
- } else if (menu == DEATH_MENU) {
- if (!sfmenu.getMenuName().equals("death") || sfmenu == null) {
- sfmenu = new DeathMenu();
- }
- // How to Play 1
- } else if (menu == HELP_MENU_1) {
- if (!sfmenu.getMenuName().equals("help_1") || sfmenu == null) {
- sfmenu = new HelpOne();
- }
- // How to Play 2
- } else if (menu == HELP_MENU_2) {
- if (!sfmenu.getMenuName().equals("help_2") || sfmenu == null) {
- sfmenu = new HelpTwo();
- }
- // No Menu
- } else if (menu == NO_MENU) {
- if (sfmenu != null) {
- sfmenu = null;
- }
- }
- // Render Menu
- if (menu != NO_MENU) {
- sfmenu.drawMenu(g);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement