C++ how to move Text with ncurses.h?
stackoverflow guys. i started stackoverflow bad. sorry for my wrong attitude (that's why I didn't get an answer)
but luckily I managed to get the result I wanted! I can be of help for you! in the documentation it won't say, but through a while () loop I managed to do it!
int main()
{
initscr();
int x = -1;
while (x < 22)
{
x++;
refresh();
mvprintw(0, x, " C++ colori", 10);
Sleep(300);
}
//other my code
}
before putting refresh ();
which is important to update, then mvprintw()
which is like a cout << /*from <iostream> library*/
but with mv (mv is move()
) ... which is what I wanted !! the first attribute is the Y
which are the vertical, and the second attribute is the X
that is to move in the same horizontal line.
all separated by commas, attention: I put the x
as a variable and not as a number because I made it move through the while loop.
after put the string of characters, remember: put a space before if not you have a result like this
❌output: CCCCCCCCCCCCCC++ colori
with a space before, it appears to be invisible, so it works.
☑️output: C++ colori
after I put Sleep(/*milliseconds*/);
remember to put the <windows.h>
library
10 is the number of characters, I know you could have done better by automating it with char [] =" your string "
and make the program count, but it was was a beta.
===========
remember: if you don't put endwin ();
at the end of the loop what you saw in the GIF will happen. on all your next normal code. here my first Bug