I'm somewhat of a new programmer. I know some java and C++(console apps only), but i've been reading the tutorials on codemii.com, and they've been extremely helpful in getting me stated. So far i understand the first few(up till file management, but i have no need for that now.) so i'm trying to see if i can make a game from what I know. So here's just the first a few probably easy questions:
How do you position text at a certain part of the screen? I know you use printf() to output text, but that just goes down the screen, is there anyway to position it at a certain part of the screen, and have it overwrite whatever was there before, such as a score display?
How do you position text?
Re: How do you position text?
The console understands VT terminal escape codes, which mean that writing some special codes the printf will change the cursor position or the color of the text.
For example, to position the cursor on row 2, column 0
printf("\x1b[2;0H");
Or you can can use variables to make a generic goto function
printf ("\x1b[%d;%dH", row, column );
For example, to position the cursor on row 2, column 0
printf("\x1b[2;0H");
Or you can can use variables to make a generic goto function
printf ("\x1b[%d;%dH", row, column );
Who is online
Users browsing this forum: No registered users and 2 guests