Example #1
0
        public MainWindow()
        {
            InitializeComponent();
            World.nCols = 14;
            World.nRows = 30;

            this.Height = World.nRows * World.CELL_SIZE;
            this.Width  = World.nCols * World.CELL_SIZE;

            World.Init(this);
            World.InitWindowGrid();
            World.Visualize();
        }
Example #2
0
        internal static void Reset()
        {
            for (int i = 0; i < nRows; i++)
            {
                for (int j = 0; j < nCols; j++)
                {
                    Grid[i, j].Color  = Brushes.Black;
                    Grid[i, j].Filled = false;
                }
            }
            for (int i = 0; i < PreviewSize; i++)
            {
                for (int j = 0; j < PreviewSize; j++)
                {
                    previewLabels[i, j].Background = Brushes.Black;
                }
            }
            ActiveObject     = null;
            NextActiveObject = null;

            Visualize();

            secCounter       = 0;
            NextActiveObject = null;
            Points           = 0;
            IntervalLength   = 200;
            Destroyed_Rows   = 0;

            GameLost = false;
            Level    = 0;

            mw.MESSAGE.Text       = "Press space to start";
            mw.MESSAGE.Visibility = Visibility.Visible;
            mw.MESSAGE.FontSize   = 25;
            mw.MESSAGE.Foreground = Brushes.Orange;

            Timer.Tick           -= TimeStep;
            TimeMeasurement.Tick -= UpdateTime;
            Timer           = null;
            TimeMeasurement = null;

            World.Init(mw);
        }