/// <summary> /// Allows the screen to create the hit bounds for a particular menu entry. /// </summary> protected virtual Rectangle GetMenuEntryHitBounds(LevelEntry entry) { // the hit bounds are the entire width of the screen, and the height of the entry // with some additional padding above and below. return(new Rectangle( (int)entry.Position.X, (int)entry.Position.Y, entry.GetWidth(this), entry.GetHeight(this))); }
/// <summary> /// Allows the screen the chance to position the menu entries. By default /// all menu entries are lined up in a vertical list, centered on the screen. /// </summary> protected virtual void UpdateMenuEntryLocations() { // Make the menu slide into place during transitions, using a // power curve to make things look more interesting (this makes // the movement slow down as it nears the end). float transitionOffset = (float)Math.Pow(TransitionPosition, 2); // start at Y = 175; each X value is generated per entry // update each menu entry's location in turn for (int i = 0; i < levelEntries.Count; i++) { LevelEntry lvlEntry = levelEntries[i]; Vector2 position = new Vector2(110f, 125f); Vector2 entryPos = GetNewEntryPosition(i); position = new Vector2(position.X + entryPos.X * (lvlEntry.GetWidth(this) + 50), position.Y + entryPos.Y * lvlEntry.GetHeight(this)); if (ScreenState == ScreenState.TransitionOn) { position.X -= transitionOffset * 256; Debug.WriteLine("transitioning"); } else { position.X += transitionOffset * 512; Debug.WriteLine("Not transitioning"); } // set the entry's position lvlEntry.Position = position; // move down for the next entry the size of this entry plus our padding //position.Y += lvlEntries.GetHeight(this) + (menuEntryPadding * 2); } }
/// <summary> /// Allows the screen to create the hit bounds for a particular menu entry. /// </summary> protected virtual Rectangle GetMenuEntryHitBounds(LevelEntry entry) { // the hit bounds are the entire width of the screen, and the height of the entry // with some additional padding above and below. return new Rectangle( (int)entry.Position.X, (int)entry.Position.Y, entry.GetWidth(this), entry.GetHeight(this)); }