- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
#include "Windows.h"
void line::draw()
{
CmdWinGUI::draw();
uint8_t modB = 0; //modeByte
COORD tempSt = lineStart;
COORD tempEn = lineEnd;
SHORT dX = abs(lineEnd.X - lineStart.X);
SHORT dY = abs(lineEnd.Y - lineStart.Y);
SHORT sX = lineStart.X < lineEnd.X ? 1 : -1;
SHORT sY = lineStart.Y < lineEnd.Y ? 1 : -1;
SHORT dErr = dX - dY;
SHORT dErr2 = 0;
if (scan)
{
SetConsoleCursorPosition(hCon, lineStart);
for (uint8_t a = 0;a <= lineEnd.X-lineStart.X;++a)
{
modB = lineAtrBuffer[a];
SetConsoleTextAttribute(hCon, modB);
printf("%c", lineSymBuffer[a]);
}
if (isChanged)
this->editFlagSwitch();
return;
}
for (;;)
{
SetConsoleCursorPosition(hCon, tempSt);
printf("%c", lineSym);
if (tempSt.X == tempEn.X&&tempSt.Y == tempEn.Y)
break;
dErr2 = dErr * 2;
if (dErr2 > -dY)
{
dErr -= dY;
tempSt.X += sX;
}
if (dErr2 < dX)
{
dErr += dX;
tempSt.Y += sY;
}
}
if (isChanged)
this->editFlagSwitch();
}
KPblCA 13.01.2024 21:13 # 0