public override void LoadContent(GraphicsDevice graphics, SpriteBatch sprite_batch, ContentManager content)
        {
            rectangle_texture = new Texture2D(graphics, 1, 1);
            rectangle_texture.SetData(new Color[] { Color.White });
            rounded_rect_back = content.Load<Texture2D>("Map-Square-Background");
            undo_button_texture = content.Load<Texture2D>("Map-Button-Undo");
            turn_done_texture = content.Load<Texture2D>("Map-Button-TurnDone");
            leave_map_texture = content.Load<Texture2D>("Map-Button-LeaveMap");
            arial_16px_regular = content.Load<SpriteFont>("Arial-16px-Regular");
            arial_12px_regular = content.Load<SpriteFont>("Arial-12px-Regular");

            int button_size = 32;
            int buffer_size = 6;
            //turn_done_button = new DrawableRectangle(rectangle_texture, new Rectangle(690, 440, 100, 30), Color.Green);
            turn_done_button = new DrawableRectangle(turn_done_texture,
                new Rectangle(788 - button_size, 468 - button_size, button_size, button_size), Color.Green);
            turn_done_button.OnMouseLeftClick += OnTurnDoneClick;
            turn_done_button.OnMouseInside += OnButtonInside;
            turn_done_button.OnMouseOutside += OnButtonOutside;
            //undo_button = new DrawableRectangle(rectangle_texture, new Rectangle(580, 440, 100, 30), Color.Orange);
            undo_button = new DrawableRectangle(undo_button_texture,
                new Rectangle(788 - buffer_size - button_size * 2, 468 - button_size, button_size, button_size), Color.Yellow);
            undo_button.OnMouseLeftClick += OnUndoClick;
            undo_button.OnMouseInside += OnButtonInside;
            undo_button.OnMouseOutside += OnButtonOutside;
            //leave_map_button = new DrawableRectangle(rectangle_texture, new Rectangle(675, 400, 115, 30), Color.Red);
            leave_map_button = new DrawableRectangle(leave_map_texture,
                new Rectangle(788 - buffer_size * 2 - button_size * 3, 468 - button_size, button_size, button_size), Color.Red);
            leave_map_button.OnMouseLeftClick += OnLeaveMapClick;
            leave_map_button.OnMouseInside += OnButtonInside;
            leave_map_button.OnMouseOutside += OnButtonOutside;
            button_hover = null;

            Haxxit.Maps.Map map = display_map_state.Map;
            foreach (Haxxit.Maps.Point p in map.Low.IterateOverRange(map.High))
            {
                if (map.NodeIsType<Haxxit.Maps.ProgramHeadNode>(p))
                {
                    head_nodes[p] = DrawProgramHead(p, map.GetNode<Haxxit.Maps.ProgramHeadNode>(p));
                }
            }
        }
 public void OnButtonInside(DrawableRectangle rectangle)
 {
     //button_hover = new DrawableRectangle(rectangle.texture, rectangle.Area, Color.White * 0.5f);
     string tooltip = "";
     if (rectangle == turn_done_button)
         tooltip = "Ends your turn.";
     else if (rectangle == undo_button)
         tooltip = "Undo previous action.";
     else if (rectangle == leave_map_button)
         tooltip = "Leave (exit) the current map.";
     button_hover = new ButtonHover(rectangle, rectangle_texture, arial_12px_regular, tooltip);
 }
 public void OnButtonOutside(DrawableRectangle rectangle)
 {
     MouseState mouse_state = Mouse.GetState();
     if(!undo_button.Area.Contains(mouse_state.X, mouse_state.Y)
        && !leave_map_button.Area.Contains(mouse_state.X, mouse_state.Y)
        && !turn_done_button.Area.Contains(mouse_state.X, mouse_state.Y))
         button_hover = null;
 }
 public void OnButtonOutside(DrawableRectangle rectangle)
 {
     MouseState mouse_state = Mouse.GetState();
     if(selectProgramButton == null)
     {
         if(!cancelButton.Area.Contains(mouse_state.X, mouse_state.Y))
         {
             buttonHover = null;
         }
     }
     else if (!selectProgramButton.Area.Contains(mouse_state.X, mouse_state.Y)
              && !cancelButton.Area.Contains(mouse_state.X, mouse_state.Y))
     {
         buttonHover = null;
     }
 }
 public void OnButtonInside(DrawableRectangle rectangle)
 {
     string tooltip = "";
     if (rectangle == selectProgramButton)
         tooltip = "Select this program for spawning.";
     else if (rectangle == cancelButton)
         tooltip = "Leave (exit) the spawn program dialog.";
     buttonHover = new ButtonHover(rectangle, rectangle_texture, arial_12px_regular, tooltip);
 }
        public override void LoadContent(GraphicsDevice graphics, SpriteBatch sprite_batch, ContentManager content)
        {
            rectangle_texture = new Texture2D(graphics, 1, 1);
            rectangle_texture.SetData(new Color[] { Color.White });
            selectTexture = content.Load<Texture2D>("Map-Button-TurnDone");
            cancelTexture = content.Load<Texture2D>("Map-Button-LeaveMap");
            overlay = new DrawableRectangle(rectangle_texture, new Rectangle(0, 0, 800, 480), Color.Black * 0.5f);
            popup_window = new DrawableRectangle(rectangle_texture, new Rectangle(350, 20, 400, 350), Color.DarkBlue);
            commandInfoBox = new DrawableRectangle(rectangle_texture, new Rectangle(10, 385, 650, 60), Color.DarkBlue);
            cancelButton = new DrawableRectangle(cancelTexture, new Rectangle(740, 400, 32, 32), Color.Red);
            cancelButton.OnMouseLeftClick += OnCancelClick;
            cancelButton.OnMouseInside += OnButtonInside;
            cancelButton.OnMouseOutside += OnButtonOutside;
            buttonHover = null;

            arial_16px_regular = content.Load<SpriteFont>("Arial-16px-Regular");
            arial_14px_regular = content.Load<SpriteFont>("Arial-14px-Regular");
            arial_12px_regular = content.Load<SpriteFont>("Arial-12px-Regular");
            arial_10px_regular = content.Load<SpriteFont>("Arial-10px-Regular");

            List<Haxxit.Programs.ProgramFactory> programs = new List<Haxxit.Programs.ProgramFactory>();
            programs.Add(null); // For "None" option
            foreach (Haxxit.Programs.ProgramFactory program in programs.Concat(map.CurrentPlayer.GetPrograms()))
            {
                Rectangle program_location = new Rectangle(popup_window.Area.X + 10,
                    popup_window.Area.Y + program_rectangles.Count * 72 + 48, popup_window.Area.Width - 20, 60);
                DrawableRectangle program_rectangle = new DrawableRectangle(rectangle_texture, program_location, Color.White * 0.2f);
                program_rectangle.OnMouseLeftClick += OnProgramSelect;
                program_rectangles.Add(new Tuple<Haxxit.Programs.ProgramFactory, DrawableRectangle>(program, program_rectangle));
                totalPrograms++;
            }

            // If there are enough programs that we'll need to support scrolling...
            if (totalPrograms > 4)
            {
                scrollUpTexture = content.Load<Texture2D>("ArrowUp");
                scrollUpButton = new DrawableRectangle(rectangle_texture, new Rectangle(750, 20, 50, 50), Color.White);
                scrollUpButton.OnMouseLeftClick += OnScrollUp;

                scrollDownTexture = content.Load<Texture2D>("ArrowDown");
                scrollDownButton = new DrawableRectangle(rectangle_texture, new Rectangle(750, 320, 50, 50), Color.White);
                scrollDownButton.OnMouseLeftClick += OnScrollDown;

                scrollGripTexture = content.Load<Texture2D>("ScrollGrip");
                scrollBar = new DrawableRectangle(rectangle_texture, new Rectangle(760, 70, 30, 250), Color.DimGray);
                scrollGrip = new DrawableRectangle(rectangle_texture, new Rectangle(760, 70, 30, 50), Color.White);
                aboveGrip = new DrawableRectangle(rectangle_texture, new Rectangle(760, 70, 30, 0), Color.Red);
                aboveGrip.OnMouseLeftClick += OnScrollUp;
                belowGrip = new DrawableRectangle(rectangle_texture, new Rectangle(760, 120, 30, 200), Color.Green);
                belowGrip.OnMouseLeftClick += OnScrollDown;

                // Determine scroll grip positions for future use
                scrollGripPositions = new int[totalPrograms - 3];
                int startingPosition = scrollGrip.Area.Location.Y;
                int endingPosition = startingPosition + scrollBar.Area.Height - scrollGrip.Area.Height;
                interval = (endingPosition - startingPosition) / (totalPrograms - 4);
                for (int i = 0; i < totalPrograms - 3; i++)
                {
                    scrollGripPositions[i] = startingPosition + interval * i;
                }
            }
        }
        public override void LoadContent(GraphicsDevice graphics, SpriteBatch sprite_batch, ContentManager content)
        {
            display_map_state.LoadContent(graphics, sprite_batch, content);
            rectangle_texture = new Texture2D(graphics, 1, 1);
            rectangle_texture.SetData(new Color[] { Color.White });
            rounded_rect_border = content.Load<Texture2D>("Map-Square-Border");
            finished_texture = content.Load<Texture2D>("Map-Button-TurnDone");
            leave_map_texture = content.Load<Texture2D>("Map-Button-LeaveMap");
            arial_16px_regular = content.Load<SpriteFont>("Arial-16px-Regular");
            arial_12px_regular = content.Load<SpriteFont>("Arial-12px-Regular");

            int button_size = 32;
            int buffer_size = 6;
            finished_button = new DrawableRectangle(finished_texture,
                new Rectangle(788 - button_size, 468 - button_size, button_size, button_size), Color.Green);
            finished_button.OnMouseLeftClick += OnFinishedClick;
            finished_button.OnMouseInside += OnButtonInside;
            finished_button.OnMouseOutside += OnButtonOutside;
            leave_map_button = new DrawableRectangle(leave_map_texture,
                new Rectangle(788 - buffer_size - button_size * 2, 468 - button_size, button_size, button_size), Color.Red);
            leave_map_button.OnMouseLeftClick += OnLeaveMapClick;
            leave_map_button.OnMouseInside += OnButtonInside;
            leave_map_button.OnMouseOutside += OnButtonOutside;
            button_hover = null;

            Haxxit.Maps.Map map = display_map_state.Map;
            foreach (Haxxit.Maps.Point p in map.Low.IterateOverRange(map.High))
            {
                if (map.NodeIsType<Haxxit.Maps.SpawnNode>(p)
                    && map.GetNode<Haxxit.Maps.SpawnNode>(p).Player == map.CurrentPlayer)
                {
                    DrawableRectangle spawn =
                        new DrawableRectangle(rounded_rect_border, display_map_state.HaxxitPointToXnaRectangle(p), Color.White);
                    spawn.OnMouseLeftClick += OnSpawnClick;
                    spawns.Add(p, spawn);
                }
            }
        }
 public void OnButtonInside(DrawableRectangle rectangle)
 {
     //button_hover = new DrawableRectangle(rectangle.texture, rectangle.Area, Color.White * 0.5f);
     string tooltip = "";
     if (rectangle == finished_button)
         tooltip = "Finished spawning programs.";
     else if (rectangle == leave_map_button)
         tooltip = "Leave (exit) the current map.";
     button_hover = new ButtonHover(rectangle, rectangle_texture, arial_12px_regular, tooltip);
 }