Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Microsoft.Xna.Framework.Graphics;
  6. using System.Collections;
  7. using Microsoft.Xna.Framework;
  8.  
  9. namespace MainMenu
  10. {
  11.     class MenuDefinition
  12.     {
  13.         GraphicsDevice graphics;
  14.  
  15.         public GraphicsDevice Graphics
  16.         {
  17.             get { return graphics; }
  18.             set { graphics = value; }
  19.         }
  20.  
  21.         ArrayList buttonList = new ArrayList();
  22.  
  23.         public ArrayList ButtonList
  24.         {
  25.             get { return buttonList; }
  26.             set { buttonList = value; }
  27.         }
  28.  
  29.         SpriteFont fonte;
  30.  
  31.         public SpriteFont Fonte
  32.         {
  33.             get { return fonte; }
  34.             set { fonte = value; }
  35.         }                    
  36.  
  37.         Dictionary<String, Texture2D> assets;
  38.      
  39.  
  40.         public MenuDefinition(GraphicsDevice g, SpriteFont f, Dictionary<String, Texture2D> a)
  41.         {
  42.             graphics = g;
  43.             assets = a;          
  44.  
  45.             Texture2D t;
  46.             fonte = f;
  47.            
  48.             //Construir o botão de Jogar:
  49.             assets.TryGetValue("play", out t);
  50.             Button btnJogar = new Button(t, new Rectangle(graphics.Viewport.Width / 2 - 50,
  51.                                                           graphics.Viewport.Height / 2 - 51,
  52.                                                           100,
  53.                                                           102), Game1.GameState.GameOpt);
  54.             buttonList.Add(btnPlay);
  55.  
  56.  
  57.              assets.TryGetValue("sair", out t);
  58.             Button btnSair = new Button(t, new Rectangle(graphics.Viewport.Width / 2 + 75,
  59.                                                          graphics.Viewport.Height / 2 + 76,
  60.                                                          100,
  61.                                                          102), Game1.GameState.Exit);
  62.  
  63.             buttonList.Add(btnExit);
  64.        
  65.         }
  66.  
  67.         public void Update(GameTime gameTime, Vector2 position, Game1 game1)
  68.         {
  69.             Rectangle rect = new Rectangle((int)position.X, (int)position.Y, 5, 5);
  70.             foreach (Button b in buttonList)
  71.             {
  72.                 if (rect.Intersects(b.Rectangle))
  73.                 {
  74.  
  75.                 }
  76.  
  77.             }
  78.            
  79.         }
  80.  
  81.         public void Draw(SpriteBatch spriteBatch)
  82.         {
  83.                  
  84.             Rectangle titleRect = new Rectangle((graphics.Viewport.Width - 751) / 2, 20, 751, 125);
  85.             Texture2D t;
  86.             assets.TryGetValue("Teste", out t);
  87.             //spriteBatch.Draw(t, titleRect, Color.White);
  88.             // Fim
  89.  
  90.             foreach (Button b in buttonList)
  91.             {
  92.                 //spriteBatch.Draw(b.Texture, b.Rectangle, Color.White);
  93.             }
  94.            
  95.         }
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement