예제 #1
0
        public void Draw(RenderWindow window, Hold hold)
        {
            if (hold.currentPiece != PieceType.Empty)
            {
                List <Vector2i> pieceToDraw = PieceTypeUtils.GetPieceTypeBlocks(hold.currentPiece);

                float xOffset = hold.currentPiece == PieceType.I ? 1.5f : hold.currentPiece == PieceType.O ? 1.5f : 2.0f;
                float yOffset = hold.currentPiece == PieceType.I ? 4.0f : 3.5f;

                foreach (Vector2i position in pieceToDraw)
                {
                    Sprite sprite = new Sprite();
                    sprite.Texture  = AssetPool.blockTextures[(int)hold.currentPiece];
                    sprite.Position = new Vector2f(
                        AssetPool.holdSprite.Position.X + AssetPool.blockSize.X * (xOffset + position.X),
                        AssetPool.holdSprite.Position.Y + AssetPool.blockSize.Y * (yOffset + position.Y));

                    window.Draw(sprite);
                }
            }
        }
예제 #2
0
        public void Draw(RenderWindow window, PieceQueue pieceQueue)
        {
            float yHeightModifier = 0;

            foreach (PieceType pieceType in pieceQueue.Get())
            {
                float xOffset = pieceType == PieceType.I ? 1.5f : pieceType == PieceType.O ? 1.5f : 2.0f;
                float yOffset = pieceType == PieceType.I ? 3.0f : 2.5f;

                foreach (Vector2i position in PieceTypeUtils.GetPieceTypeBlocks(pieceType))
                {
                    Sprite sprite = new Sprite();
                    sprite.Texture  = AssetPool.blockTextures[(int)pieceType];
                    sprite.Position = new Vector2f(
                        AssetPool.queueSprite.Position.X + AssetPool.blockSize.X * (position.X + xOffset),
                        AssetPool.queueSprite.Position.Y + AssetPool.blockSize.Y * (position.Y + yOffset) + yHeightModifier);

                    window.Draw(sprite);
                }

                yHeightModifier += AssetPool.blockSize.Y * 3;
            }
        }