Example #1
0
        public void drawPolyomino(Canvas canvas, Vector2 location, double minoSize, bool ghost)
        {
            foreach (Vector2 v in Minos)
            {
                Mino m = new Mino(v + location, this);
                m.drawMino(canvas, minoSize, ghost);
            }

            return;
        }
Example #2
0
        public bool fallingPolyominoDescend(bool replaceIfInvalid)
        {
            if (!tryFallingPosition(new Vector2(FallingPolyominoLocation.X, FallingPolyominoLocation.Y - 1)))
            {
                if (replaceIfInvalid)
                {
                    foreach (Vector2 v in FallingPolyomino.Minos)
                    {
                        Mino toAdd = new Mino(new Vector2(v.X + FallingPolyominoLocation.X, v.Y + FallingPolyominoLocation.Y), FallingPolyomino);
                        SettledMinos.Add(toAdd);
                    }
                    tryClearLines(0, Width - 1);

                    getNextPolyomino();
                }
                return false;
            }
            return true;
        }
Example #3
0
        public void drawPolyomino( Canvas canvas, double minoSize, double locx, double locy, bool ghost )
        {
            foreach (Vector2 v in Minos)
            {
                double x = v.X * minoSize + locx;
                double y = -v.Y * minoSize + locy;

                // todo slow garbage making
                Mino m = new Mino(new Vector2(int.MaxValue, int.MaxValue ), this) ;
                m.drawMino(canvas, minoSize, x, y, ghost);
            }
        }