Hi!
I have a huge problem with drawing my frame in win32 console. At the coordinates (79,24) I have to draw a LEFTUP part of the frame (I hope you understand what i mean). My code draws the LEFTUP part but after it draws it program jumps into the new line and everything is moved.
This is my frame:
Code:
RIGHTDOWN part->(|-)-------------------------------------(-|)<- LEFTDOWN part
| |
| |
| |
| |
| |
| |
| |
RIGHTUP part-> (|-)-------------------------------------(-|)<- LEFTUP part
And here's my code:
Code:
// constants for drawing a frame
# define RIGHTDOWN 218
# define RIGHTUP 192
# define LEFTDOWN 191
# define LEFTUP 217
# define HORIZONTAL 196
# define VERTICAL 179
# define VERTICALRIGHT 195
# define VERTICALLEFT 180
void Frame ()
{
int i = 0, j = 0, k = 0, l = 0, x, y, length, height;
x = 0;
y = 0;
length = 80;
height = 25;
// drawing a frame
gotoxy (x, y);
printf ("%c", RIGHTDOWN);
for (i = 0; i < length-2; i++)
{
gotoxy (x+1+i, y);
printf ("%c", HORIZONTAL);
if (i == length-3)
{
gotoxy (x+length, y);
printf ("%c", LEFTDOWN);
for (j = 0; j < height-2; j++)
{
gotoxy (x, y+1+j);
if (j == 0)
{
printf ("%c", VERTICAL);
for (l = 0; l < length-2; l++) // drawing spaces
{
printf (" ");
}
printf ("%c", VERTICAL);
}
if (j == 1) // drawing title line
{
printf ("%c", VERTICALRIGHT);
for (k = 0; k < length-2; k++)
{
printf ("%c", HORIZONTAL);
}
printf ("%c", VERTICALLEFT);
}
else // drawing other parts of the frame
{
if (j != 0)
{
printf ("%c", VERTICAL);
for (l = 0; l < length-2; l++) // drawing spaces
{
printf (" ");
}
printf ("%c", VERTICAL);
}
}
}
gotoxy (x, y+height);
printf ("%c", RIGHTUP);
for (j = 0; j < length-2; j++)
{
gotoxy (x+1+j, y+height);
printf ("%c", HORIZONTAL);
}
}
}
gotoxy (length-1, height-1);
printf ("%c", LEFTUP);
}