Else take a look at input for courses.
So there's a similar function to our C in that can get one character from the input and Bouverie seen
it.
It's called.
You get character get CH S.H. like this.
So this will actually read one character from the input.
So let's take a look at how to use this example.
So say we had Julian Colquitt set false initially in the character store while not quit.
You will set the input to this good character and if the input is a cue then we'll set quit to be false.
Or true sir.
In it.
So it's kind of read this and see what happens.
So if I type in here a c whatever and then I finally typed Q It will actually exit the curses window.
And that's kind of what is this.
And when does it kind of returns the terminal to its original state.
Right.
So it actually got it.
But if you noticed it runs more time for you if we type something we'll see the characters here.
I'm just typing randomly and we see a character who's kind of appearing on the screen.
Well in our interactive games you don't want that to really happen.
So how to make it so that when you type something it doesn't appear we can say no echo like this.
So now if you run right into it again I'm typing can't see what I'm typing stuff but it's not working
ok or it's not appear on the screen.
But still if I press Q it'll it.
So that's kind of nice to get rid of the echo of the characters you type.
There's one more important thing and that is we've noticed that this character will block and even kind
of prove it to you.
I'll say M.V. all it's fresh here in the French w
I'll just print it
20:20.
Hello everyone.
OK.
So if I run this you'll see that it never printed the M.V. print function.
Hello everyone.
OK.
So it never actually printed this.
So that means that this character is actually blocking.
So if I type something it will actually show the hello everyone that we had for.
You type again and again it just keep showing that which And actually exit OK.
So that really means that this character kind of blocks the well everything's kind of blocked until
good character works.
So we can actually fix that.
And we could say you know the way
and no delay takes the windows no s d c r and then whether or not we want to do this or no delay.
So it's true.
So don't want delays.
True means no delay and that will actually cause good character to not block any so actually.
So you can actually still input but it kind of it'll check to see if you actually got any input if you
didn't it'll kind of just keep going and then loop back and then again backtrack again.
OK so let's see that kind of work.
So now we should see if we run it we should actually see Hello everyone being printed.
Stu so it actually printed it's not waiting for us to input it character anymore.
OK so that's going to be very useful for our interactive games.
So if I type something that happens type quit it still works it quits the way one nerves.
One last thing we look at here and that is if you notice we can't actually use the arrow keys for input
right now.
And that could be useful for our games.
A lot of these Iraqis.
So you can actually fix that by seeing pad
baps in using STDs are insane.
True.
And this war actually enables
keyboard or arrow keys.
So there's one other problem though and that is if this good character actually doesn't return characters
or turns integer.
So we should be using it here.
And you actually compare.
This is actually like I think I've mentioned this much earlier.
We were talking about characters.
This is actually an integer.
It's quote Q here.
So we should be using integers for input character.
And now let's actually use the arrow keys so the arrow keys are actually defined by this key and underscore
down here.
There's also key up key like
in key right.
So we'll probably want to use that for our games.
So now if I run this
and if I press the arrow key down it'll actually quit.
So that's kind of how to enable the.
So that's kind of it for inputs in the next lecture.
I want to go over a complete example and show you how to really how to put it all together into something
that we can base our games off of you in the next lecture.