Line 39: |
Line 39: |
| public class MyUserInterface : IClickableMenu | | public class MyUserInterface : IClickableMenu |
| { | | { |
− | // Some of the constants you'll use to relatively lay out all the UI elements | + | // 2. Some of the constants you'll use to relatively lay out all the UI elements |
| int UIWidth = 632; | | int UIWidth = 632; |
| int UIHeight = 600; | | int UIHeight = 600; |
Line 45: |
Line 45: |
| int YPos = (Game1.viewport.Height / 2) - UIHeight; | | int YPos = (Game1.viewport.Height / 2) - UIHeight; |
| | | |
− | // Declare all the UI elements | + | // 3. Declare all the UI elements |
| ClickableComponent TitleLabel; | | ClickableComponent TitleLabel; |
| ... | | ... |
Line 53: |
Line 53: |
| base.initialize(XPos, YPos, UIWidth, UIHeight); | | base.initialize(XPos, YPos, UIWidth, UIHeight); |
| | | |
− | // initialize and lay out all the declared UI components | + | // 4. initialize and lay out all the declared UI components |
| TitleLabel = new ClickableComponent(new Rectangle(XPos + 200, YPos + 96, UIwidth - 400, 64), "Some Title"); | | TitleLabel = new ClickableComponent(new Rectangle(XPos + 200, YPos + 96, UIwidth - 400, 64), "Some Title"); |
| ... | | ... |
| } | | } |
| | | |
− | // The method invoked when the player left-clicks on the menu. | + | // 5. The method invoked when the player left-clicks on the menu. |
| public override void receiveLeftClick(int x, int y, bool playSound = true) | | public override void receiveLeftClick(int x, int y, bool playSound = true) |
| { | | { |
Line 70: |
Line 70: |
| ... | | ... |
| | | |
− | // Render the UI that has been set up to the screen. | + | // 6. Render the UI that has been set up to the screen. |
| // Gets called automatically every render tick when this UI is active | | // Gets called automatically every render tick when this UI is active |
| public override void draw(SpriteBatch b) | | public override void draw(SpriteBatch b) |