本文整理汇总了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];
}
}
}
}
示例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];
}
}
}
}
示例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];
}
}
}
}
示例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];
}
}
}
}
示例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;
}
}