Even using SEO and for all our output needs up until this point.
However see out isn't really well-suited to games.
For example we couldn't draw you the very right most of the screen very easily.
You have to draw a lot of whitespace first and then draw what you wanted.
So instead of using See outs and want to use a different way of drawing that's more flexible and more
well-suited to games.
We just installed the curses library last time and that's what we're going to be using.
So curses allows us more flexibility on how we draw out our output and also how we get input as well.
It keeps with the ASCII character aesthetic that we're used to.
But allows us to draw the tax at any point the SCREATON you can think of it as having the screen be
a two dimensional array and we can place characters at any location.
In addition Pearse's allows more flexibility with her input.
You noticed that scene will block the program from running the next instruction until the user input
something and presses enter.
This is limits the gains we can make to only turn based games like we've been doing but with curses
we can make it so we don't lock put in.
Instead we can pool periodically free.
Now be able to make interactive games.
So let me show you just a simple hello world example using curses.
So we've already set up our project so if you haven't done that yet watch the last lecture.
And also for myself set up the run configurations for Mac again for Windows users.
You often do the external tools method that I showed
so her saying we need to do is teach cursive.
So you are using init our screen and that's the very first thing this initializes the terminal in curses
mode to do anything uncurse is really cool this first.
Now we can kind of really start using it.
Next thing I want to do is say print W and say hello
or old
so so so this will actually print to the curses window.
And the next thing you do is Refresh Refresh method.
When we print using the print w the data is actually written to like a hidden window which hasn't been
played yet.
So in order to show what we printed we must call the refreshment.
OK.
Just remember if you know if you don't see something show up that you printed.
You have to call refresh a in wanted to call this next function.
Character get c h.
And this really just will for us get one character from the user.
OK this is really just to help us pause so doesn't kind of quit right away.
We'll be using and explaining and get character a bit later too.
So the last thing I need to do is call and win.
And so this cleans up everything that in its green did for hey we must always call and win last.
Every time we use curses it will restore our terminal console to its original state.
Otherwise we may see some weird problems with our terminal.
So let's run this means we yet.
There you go.
Hello world.
And cursor see no text that we drew so far it's nothing exciting.
We could have done this out before but in the next lecture I want to really start diving deep and show
you why we're using curses instead of standard input and output.