public void EnqueueForDrawing(IDrawable obj) { char[,] objImage = obj.GetBody(); int imageRows = objImage.GetLength(0); int imageCols = objImage.GetLength(1); int XPos = obj.GetCoordinates().XPosition; int YPos = obj.GetCoordinates().YPosition; if (obj is GameObject) { GameObject thisObj = obj as GameObject; ConsoleColor color = thisObj.Color; for (int row = 0; row < objImage.GetLength(0); row++) { for (int col = 0; col < objImage.GetLength(1); col++) { if (YPos + row < visibleRows && YPos >= 0) { ConsoleBuffer.Draw(objImage[row, col].ToString(), XPos + col, YPos + row, (short)thisObj.Color); } } } } else { for (int row = 0; row < objImage.GetLength(0); row++) { for (int col = 0; col < objImage.GetLength(1); col++) { if (YPos + row < visibleRows && YPos >= 0) { ConsoleBuffer.Draw(objImage[row, col].ToString(), XPos + row, YPos, 4); } } } } }
public void EnqueueForDrawing(IDrawable obj) { char[,] objImage = obj.GetBody(); int imageRows = objImage.GetLength(0); int imageCols = objImage.GetLength(1); int XPos = obj.GetCoordinates().XPosition; int YPos = obj.GetCoordinates().YPosition; if (obj is GameObject) { GameObject thisObj = obj as GameObject; ConsoleColor color = thisObj.Color; for (int row = 0; row < objImage.GetLength(0); row++) { for (int col = 0; col < objImage.GetLength(1); col++) { if (YPos + row < visibleRows && YPos >= 0) { ConsoleBuffer.Draw(objImage[row, col].ToString(), XPos + col, YPos + row, (short)thisObj.Color); } } } } else { for (int row = 0; row < objImage.GetLength(0); row++) { for (int col = 0; col < objImage.GetLength(1); col++) { if (YPos + row < visibleRows && YPos >= 0) { ConsoleBuffer.Draw(objImage[row, col].ToString(), XPos + row, YPos, 4); } } } } }
public void EnqueueForDrawing(IDrawable obj) { char[,] objImage = obj.GetBody(); int imageRows = objImage.GetLength(0); int imageCols = objImage.GetLength(1); Coordinates objTopLeft = obj.GetCoordinates(); int lastRow = Math.Min(objTopLeft.YPosition + imageRows, this.renderContextMatrixRows); int lastCol = Math.Min(objTopLeft.XPosition + imageCols, this.renderContextMatrixCols); for (int row = obj.GetCoordinates().YPosition; row < lastRow; row++) { for (int col = obj.GetCoordinates().XPosition; col < lastCol; col++) { if (row >= 0 && row < renderContextMatrixRows && col >= 0 && col < renderContextMatrixCols) { renderContextMatrix[row, col] = objImage[row - obj.GetCoordinates().YPosition, col - obj.GetCoordinates().XPosition]; } } } }
public void EnqueueForDrawing(IDrawable obj) { char[,] objImage = obj.GetBody(); int imageRows = objImage.GetLength(0); int imageCols = objImage.GetLength(1); Coordinates objTopLeft = obj.GetCoordinates(); int lastRow = Math.Min(objTopLeft.YPosition + imageRows, this.renderContextMatrixRows); int lastCol = Math.Min(objTopLeft.XPosition + imageCols, this.renderContextMatrixCols); for (int row = obj.GetCoordinates().YPosition; row < lastRow; row++) { for (int col = obj.GetCoordinates().XPosition; col < lastCol; col++) { if (row >= 0 && row < renderContextMatrixRows && col >= 0 && col < renderContextMatrixCols) { renderContextMatrix[row, col] = objImage[row - obj.GetCoordinates().YPosition, col - obj.GetCoordinates().XPosition]; } } } }