He saw last time that when we printed out tell the world that it printed out in the top left the screen
much like cows outworks we even see the cursor as the outputs of your runs in the world and the cursor
position here.
So far nothing seems all that exciting but the most important part of curses output is that you can
change the cursor position directly unlikes out.
So close this and we say
move
Dean 10 k.
So we move these moves change the cursor position position.
So this changes cursor session.
Initially the cursor position is at the top left of the screen.
So in terms of coordinates the top left corner is at 0 0 and y goes down and X goes to the right.
So we run this
we see that we actually moved our Hello World string down 15.
So this 15 here is actually the Y.
And we moved it 10 over so 15 units down and 10 yards to the right.
One thing to note about move is that the first argument is for the y direction and second argument is
for the ruction love to keep that in mind since usually we think X first then why it's opposite here.
Now whenever we draw we draw relative to the cursor position we just set K and see the new cursor position
now is right here.
So it went down and tend to write in however many characters this is over.
So this makes trying very flexible.
It's a little bit annoying to always call or move first and then call print w.
So curses actually combine them into one nice shorthand function that we can use so instead of always
calling move then branch we can instead do this say this is out you can say in the print you and just
like before we can say 15 years change it 20 and 15 is a low
that you're right and this
C actually went down 20 and over 15.
And so just like the move in print but in one call it makes it really nice.
OK.
So one thing to note about the strings that we're using are here is close this.
So this string is actually not a C++ string.
There are C strings.
OK.
So this is one of the reasons why I try to use the strings first.
So if we're going to use our C++ string say this string is Cloudstreet here
spring so if you want do you have a string.
What do you call easy string variant.
Hello string.
Sorry stirrer.
This.
Nach gay
like so
that again say we wanted to draw in the direct middle of the screen and there are built in variables
and curses that will tell us how many rows and how many columns the window it's OK.
So if we want to directly draw this string in in the middle of the screen we could say this say lines
which is the lines is number rows.
Our day.
And this is a built in variable that curses provides us.
OK so that winds are two in this if you want to know how many columns we say columns this too.
And if you want to be in the middle say hello string length or two
ran this middle.
It's pretty cool.
And you should never set lines or columns directly because they are not really things we should be changing.
So instead we should only ever read from them.
And I want show you one more way we can actually get how many lines and columns window is or how big
the window is.
Right.
And then through another cursus function call get Max x y.
So we need two variables is a window next X is zero.
Sarge window Max why is that zero.
And we'll call a function so call get max y x.
And we'll use this thing called standard screen and Stimme screen is provided to us by after we call
and it's green.
So that's one of the things the screen does is actually give us this kind of is.
This is actually our window that we're drawing.
And analysts say standard screen so we give it the window which is our default window that we're using
and we see a window.
Max why is it always y x x y we know x x K and then we can say window x y to an edge window x x.
And this again c it's still in the middle of the screen.
So there's one other kind of drawing function that we're going to need and that is to draw just a single
character and we can do that by using a function called Ad character.
And this just add a character acts like this or actions stop or.
And if you're just
see that it actually draws the character.
And just like with the print W function there's also the kind of move variant or add character in do
that by saying in the character
15 in the y in tune x influence see that it moved down 15 and 10 to the right way.
The most that still there is this cursor.
It's kind of annoying to see especially if we want a game so you can actually get rid of it by saying
curse and set you set that false actually makes the cursor invisible.
OK so if you were on this
this see that there's no more cursor.
So it's really nice for games.
Says close this and there's one other.
One last thing we did one single need and that is if you remember that we had a clear screen function
before all curses also has a clear spring function and it's called clear that and clear will actually
clear the entire screen.
So if we run this again we should see that
see that nothing more ANCs cleared the actual character that we were drawn.
So that's kind of it for output from you know in the next lecture.
I want to go over some input.