Example #1
0
        private void FillGrid(GridCell gridCell)
        {
            Color changeColor = gridCell.Color;

            GridCheckStruct[,] checkStruct = new GridCheckStruct[(int)FrameManager.ActiveFrame.Grid.Peek().GridSize.X, (int)FrameManager.ActiveFrame.Grid.Peek().GridSize.Y];

            InitializeGridCheckStructArrayArray(checkStruct);

            checkStruct[(int)gridCell.ID.X, (int)gridCell.ID.Y].Change = true;

            FindFillCells(ref changeColor, ref checkStruct);

            FillCells(checkStruct);
        }
Example #2
0
        /// <summary>
        /// Returns the GridCell that the mouse is over.
        /// </summary>
        /// <param name="mousePosition"></param>
        /// <returns></returns>
        private GridCell getMouseOverGridCell(Point mousePosition)
        {
            GridCell gc = new GridCell(new Vector2(0, 0), Color.White, new Vector2(0, 0));

            for (int x = 0; x < FrameManager.ActiveFrame.Grid.Peek().GridSize.X; x++)
            {
                for (int y = 0; y < FrameManager.ActiveFrame.Grid.Peek().GridSize.Y; y++)
                {
                    if (FrameManager.ActiveFrame.Grid.Peek().Cells[x, y].Bounds.Contains(mousePosition))
                        return FrameManager.ActiveFrame.Grid.Peek().Cells[x, y];
                }
            }

            return gc;
        }
Example #3
0
        private void BuildGrid()
        {
            Cells = new GridCell[(int)GridSize.X, (int)GridSize.Y];

            for (int x = 0; x < GridSize.X; x++)
            {
                for (int y = 0; y < GridSize.Y; y++)
                {
                    Cells[x, y] = new GridCell(new Vector2((int)Position.X + (x * Globals.Scale), (int)Position.Y + (y * Globals.Scale)), Color.White, new Vector2(x,y));
                }
            }
        }