Доработка логики DrawObjects

This commit is contained in:
malimova 2023-10-15 23:57:12 +04:00
parent 1d0a18b4b7
commit 52950b54cb

View File

@ -119,15 +119,15 @@ namespace AirBomber
private void DrawObjects(Graphics g)
{
int heightObjCount = _pictureHeight / _placeSizeHeight;
int widthObjCount = _pictureWidth / _placeSizeWidth; // Добавляем вычисление ширины
int widthObjCount = _pictureWidth / _placeSizeWidth;
for (int i = 0; i < _collection.Count; i++)
{
T? type = _collection.Get(i);
if (type != null)
{
int row = i / widthObjCount; // Ряд - сначала сверху вниз
int col = widthObjCount - 1 - (i % widthObjCount); // Столбец - справа налево
int row = i / widthObjCount;
int col = widthObjCount - 1 - (i % widthObjCount);
type.SetPosition(col * _placeSizeWidth, row * _placeSizeHeight);
type?.DrawPlane(g);