Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( y == 0 )
- {
- //fix using some kind of 'forecast' of what y could be
- }
- void Engine::line(int ax, int ay, int bx, int by, int color)
- {
- int i = 0;
- if(ax < bx)
- i = 1;
- if(ax > bx)
- i = -1;
- int dx = bx - ax;
- int dy = by - ay;
- for (int x = ax; x != bx; x+=i)
- {
- int y = ay + (by - ay) * (x - ax)/(bx - ax);
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleTextAttribute(hConsole, color);
- Engine::gotoxy(x,y); printf("%c", 219);
- }
- }
Add Comment
Please, Sign In to add comment