Class ButtonFactory


  • public class ButtonFactory
    extends java.lang.Object
    Contains Static methods used to create various buttons. Each method takes just a singe texturePrefix which gets turned into full texture names by appending either '_active' or '_inactive' to the end of it.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String activeSuffix  
      private static int boatSelectionButtonCount
      Static variable used to keep track of how many times the boatSelect method is called.
      private static java.lang.String inactiveSuffix  
      private static int mainMenuButtonCount
      Static variable used to keep track of how many times the mainMenu method is called
      private static int pauseButtonCount
      Static variable used to keep track of how many times the pause method is called
    • Constructor Summary

      Constructors 
      Constructor Description
      ButtonFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Button help​(java.lang.String texturePrefix)
      Creates the 'back 'button in the HelpScreen.
      static Button mainMenu​(java.lang.String texturePrefix)
      Creates the buttons on the MainMenuScreen.
      static Button pause​(java.lang.String texturePrefix)
      Creates the buttons on the PauseScreen.
      static Button select​(java.lang.String texturePrefix)
      Creates the buttons on the BoatSelectScreen.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pauseButtonCount

        private static int pauseButtonCount
        Static variable used to keep track of how many times the pause method is called
      • boatSelectionButtonCount

        private static int boatSelectionButtonCount
        Static variable used to keep track of how many times the boatSelect method is called.
      • mainMenuButtonCount

        private static int mainMenuButtonCount
        Static variable used to keep track of how many times the mainMenu method is called
    • Constructor Detail

      • ButtonFactory

        public ButtonFactory()
    • Method Detail

      • pause

        public static Button pause​(java.lang.String texturePrefix)
        Creates the buttons on the PauseScreen. yOffset is how far off the bottom edge of the screen the first button is. spacing is how much space there is between the bottom of one button and the bottom of another. pauseButtonCount increments automatically, so the buttons get spaced correctly without needing to provide exact coordinates for each.
        Parameters:
        texturePrefix - The first part of the name of the texture.
        Returns:
        the instance of Button.
      • help

        public static Button help​(java.lang.String texturePrefix)
        Creates the 'back 'button in the HelpScreen. Button is created at 0,0.
        Parameters:
        texturePrefix - The first part of the name of the texture.
        Returns:
        the instance of Button.
      • select

        public static Button select​(java.lang.String texturePrefix)
        Creates the buttons on the BoatSelectScreen. xOffset is how far off the left edge of the screen the first button is. spacing is how much space there is between the left edge of one button and the left edge of another. boatSelectionButtonCount increments just like it does in mainMenu().
        Parameters:
        texturePrefix - The first part of the name of the texture.
        Returns:
        the instance of Button.
      • mainMenu

        public static Button mainMenu​(java.lang.String texturePrefix)
        Creates the buttons on the MainMenuScreen. yOffset is how far off the bottom edge of the screen the first button is. spacing is how much space there is between the bottom of one button and the bottom of another. mainMenuButtonCount increments automatically, so the buttons get spaced correctly without needing to provide exact coordinates for each.
        Parameters:
        texturePrefix - The first part of the name of the texture.
        Returns:
        the instance of Button.