Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.Xna.Framework.Graphics;
- using System.Collections;
- using Microsoft.Xna.Framework;
- namespace MainMenu
- {
- class MenuDefinition
- {
- GraphicsDevice graphics;
- public GraphicsDevice Graphics
- {
- get { return graphics; }
- set { graphics = value; }
- }
- ArrayList buttonList = new ArrayList();
- public ArrayList ButtonList
- {
- get { return buttonList; }
- set { buttonList = value; }
- }
- SpriteFont fonte;
- public SpriteFont Fonte
- {
- get { return fonte; }
- set { fonte = value; }
- }
- Dictionary<String, Texture2D> assets;
- public MenuDefinition(GraphicsDevice g, SpriteFont f, Dictionary<String, Texture2D> a)
- {
- graphics = g;
- assets = a;
- Texture2D t;
- fonte = f;
- //Construir o botão de Jogar:
- assets.TryGetValue("play", out t);
- Button btnJogar = new Button(t, new Rectangle(graphics.Viewport.Width / 2 - 50,
- graphics.Viewport.Height / 2 - 51,
- 100,
- 102), Game1.GameState.GameOpt);
- buttonList.Add(btnPlay);
- assets.TryGetValue("sair", out t);
- Button btnSair = new Button(t, new Rectangle(graphics.Viewport.Width / 2 + 75,
- graphics.Viewport.Height / 2 + 76,
- 100,
- 102), Game1.GameState.Exit);
- buttonList.Add(btnExit);
- }
- public void Update(GameTime gameTime, Vector2 position, Game1 game1)
- {
- Rectangle rect = new Rectangle((int)position.X, (int)position.Y, 5, 5);
- foreach (Button b in buttonList)
- {
- if (rect.Intersects(b.Rectangle))
- {
- }
- }
- }
- public void Draw(SpriteBatch spriteBatch)
- {
- Rectangle titleRect = new Rectangle((graphics.Viewport.Width - 751) / 2, 20, 751, 125);
- Texture2D t;
- assets.TryGetValue("Teste", out t);
- //spriteBatch.Draw(t, titleRect, Color.White);
- // Fim
- foreach (Button b in buttonList)
- {
- //spriteBatch.Draw(b.Texture, b.Rectangle, Color.White);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement