Ejemplo n.º 1
0
        /// <summary>
        /// Add an entry to the menu, while keeping in consideration of the current scaling and
        /// height values.
        /// </summary>
        /// <param name="newEntryValue">The string value for the new menu entry.</param>
        public void AddEntry(string newEntryValue)
        {
            float newEntryPositionY = location.Y + (fontSize * titleScaling.Y) + titlePadding +
                                      ((stringManager.GetNumberOfStrings() - 1) * (fontSize * entryScaling.Y + entryPadding));
            float      newEntryPositionX = location.X;
            GameString stringToAdd       = new GameString(new Vector2(newEntryPositionX, newEntryPositionY), Color.White, newEntryValue);

            stringToAdd.scale = entryScaling;
            stringManager.Add(stringToAdd);

            SelectNthEntry(1, -1);  // If an entry is added, there is atleast one option to highlight
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new menu in the middle
        /// </summary>
        /// <param name="titleValue">The title for the new menu.</param>
        /// <param name="initialLocation">The starting location of the menu.</param>
        public Menu(string titleValue, Vector2 initialLocation)
        {
            fontSize = 15;
            entryPadding = 5;
            titlePadding = 15;
            currentlySelectedEntry = 0;
            defaultEntryColor = Color.White;
            selectedEntryColor = Color.Yellow;

            stringManager = new GameStringManager();
            location = initialLocation;
            defaultPosition = initialLocation;
            GameString titleGameString = new GameString(location, defaultEntryColor, titleValue);
            stringManager.Add(titleGameString);
            titleScaling = new Vector2(1.0f, 1.0f);
            entryScaling = new Vector2(1.0f, 1.0f);
            topScrollThreshold = 0.2;
            bottomScrollThreshold = 0.8;
            visible = true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new menu in the middle
        /// </summary>
        /// <param name="titleValue">The title for the new menu.</param>
        /// <param name="initialLocation">The starting location of the menu.</param>
        public Menu(string titleValue, Vector2 initialLocation)
        {
            fontSize               = 15;
            entryPadding           = 5;
            titlePadding           = 15;
            currentlySelectedEntry = 0;
            defaultEntryColor      = Color.White;
            selectedEntryColor     = Color.Yellow;

            stringManager   = new GameStringManager();
            location        = initialLocation;
            defaultPosition = initialLocation;
            GameString titleGameString = new GameString(location, defaultEntryColor, titleValue);

            stringManager.Add(titleGameString);
            titleScaling          = new Vector2(1.0f, 1.0f);
            entryScaling          = new Vector2(1.0f, 1.0f);
            topScrollThreshold    = 0.2;
            bottomScrollThreshold = 0.8;
            visible = true;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds a new string to the manager's list.
 /// </summary>
 /// <param name="input">
 /// The new string to add to the list.
 /// </param>
 public void Add(GameString input)
 {
     strings.Add(input);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Add an entry to the menu, while keeping in consideration of the current scaling and
        /// height values.
        /// </summary>
        /// <param name="newEntryValue">The string value for the new menu entry.</param>
        public void AddEntry(string newEntryValue)
        {
            float newEntryPositionY = location.Y + (fontSize * titleScaling.Y) + titlePadding +
                                      ((stringManager.GetNumberOfStrings() - 1) * (fontSize * entryScaling.Y + entryPadding));
            float newEntryPositionX = location.X;
            GameString stringToAdd = new GameString(new Vector2(newEntryPositionX, newEntryPositionY), Color.White, newEntryValue);
            stringToAdd.scale = entryScaling;
            stringManager.Add(stringToAdd);

            SelectNthEntry(1, -1);  // If an entry is added, there is atleast one option to highlight
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Adds a new string to the manager's list.
 /// </summary>
 /// <param name="input">
 /// The new string to add to the list.
 /// </param>
 public void Add(GameString input)
 {
     strings.Add(input);
 }