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


C# IRenderable.GetImage方法代码示例

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


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

示例4: EnqueueForRendering

        /// <summary>
        /// Enqueues an object to be rendered on the next scene of the game
        /// </summary>
        /// <param name="obj">The object to be rendered on the next scene</param>
        public void EnqueueForRendering(IRenderable obj)
        {
            char[,] image = obj.GetImage();

            for (int i = 0; i < image.GetLength(0); i++)
            {
                for (int j = 0; j < image.GetLength(1); j++)
                {
                    if (image[i, j] != ' ' &&
                        obj.X + j >= 0 && obj.X + j < this.image.GetLength(1) &&
                        obj.Y + i >= 0 && obj.Y + i < this.image.GetLength(0))
                    {
                        this.image[obj.Y + i, obj.X + j] = image[i, j];
                    }
                }
            }
        }
开发者ID:stiliyanvukadinov,项目名称:TelerikAcademy-1,代码行数:21,代码来源:ConsoleRenderer.cs

示例5: EnqueueForRender

        public void EnqueueForRender(IRenderable obj)
        {
            char objImage = obj.GetImage();

            Vector2D position = obj.GetPosition() - this.origin;
            if (position.X >= 0 && position.X < renderContextMatrixCols &&
                position.Y >= 0 && position.Y < renderContextMatrixRows)
            {
                renderContextMatrix[position.Y, position.X] = objImage;
            }
        }
开发者ID:Bezideiko,项目名称:OOP,代码行数:11,代码来源:ConsoleRenderer.cs


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