当前位置: 首页>>代码示例>>C#>>正文


C# IRenderable.GetTopLeft方法代码示例

本文整理汇总了C#中IRenderable.GetTopLeft方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderable.GetTopLeft方法的具体用法?C# IRenderable.GetTopLeft怎么用?C# IRenderable.GetTopLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRenderable的用法示例。


在下文中一共展示了IRenderable.GetTopLeft方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnqueueForRendering

        public void EnqueueForRendering(IRenderable unit)
        {
            char[,] unitImage = unit.GetImage();

            int imageRows = unitImage.GetLength(0);
            int imageCols = unitImage.GetLength(1);

            MatrixCoords unitTopLeft = unit.GetTopLeft();

            int lastRow = Math.Min(unitTopLeft.Row + imageRows, Rows);
            int lastCol = Math.Min(unitTopLeft.Col + imageCols, Cols);

            for (int row = unit.GetTopLeft().Row; row < lastRow; row++)
            {
                for (int col = unit.GetTopLeft().Col; col < lastCol; col++)
                {
                    if (row >= 0 && row < Rows && col >= 0 && col < Cols)
                    {
                        matrixToPrint[row, col] = unitImage[row - unit.GetTopLeft().Row, col - unit.GetTopLeft().Col];
                    }
                }
            }
        }
开发者ID:purlantov,项目名称:OOP-William-Faulkner,代码行数:23,代码来源:Renderer.cs

示例2: EnqueueForRendering

        public void EnqueueForRendering(IRenderable obj)
        {
            char[,] objImage = obj.GetImage();

            int imageRows = objImage.GetLength(0);
            int imageCols = objImage.GetLength(1);

            MatrixCoords objTopLeft = obj.GetTopLeft();

            int lastRow = Math.Min(objTopLeft.Row + imageRows, this.renderContextMatrixRows);
            int lastCol = Math.Min(objTopLeft.Col + imageCols, this.renderContextMatrixCols);

            for (int row = obj.GetTopLeft().Row; row < lastRow; row++)
            {
                for (int col = obj.GetTopLeft().Col; col < lastCol; col++)
                {
                    if (row >= 0 && row < renderContextMatrixRows &&
                        col >= 0 && col < renderContextMatrixCols)
                    {
                        renderContextMatrix[row, col] = objImage[row - obj.GetTopLeft().Row, col - obj.GetTopLeft().Col];
                    }
                }
            }
        }
开发者ID:unbelt,项目名称:Telerik,代码行数:24,代码来源:ConsoleRenderer.cs

示例3: EnqueueForRendering

        // this method adds an object for visualization.
        public void EnqueueForRendering(IRenderable obj)
        {
            char[,] objImage = obj.GetImage();

            int imageRows = objImage.GetLength(0);
            int imageCols = objImage.GetLength(1);

            MatrixCoords objTopLeft = obj.GetTopLeft(); // we extract the top left point from the object itself.

            int lastRow = Math.Min(objTopLeft.Row + imageRows, this.renderContextMatrixRows); // prevents us from getting out of the console.
            int lastCol = Math.Min(objTopLeft.Col + imageCols, this.renderContextMatrixCols); // prevents us from getting out of the console.

            for (int row = obj.GetTopLeft().Row; row < lastRow; row++)
            {
                for (int col = obj.GetTopLeft().Col; col < lastCol; col++)
                {
                    if (row >= 0 && row < renderContextMatrixRows &&
                            col >= 0 && col < renderContextMatrixCols)
                    {
                        renderContextMatrix[row, col] = objImage[row - obj.GetTopLeft().Row, col - obj.GetTopLeft().Col];
                    }
                }
            }
        }
开发者ID:hinkah,项目名称:CharlesDikensTeam,代码行数:25,代码来源:ConsoleRenderer.cs


注:本文中的IRenderable.GetTopLeft方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。