I'm using SFML's C Binding, and I'm trying to get input from the keyboard.
while (sfRenderWindow_IsOpened(App))
{
while (sfRenderWindow_GetEvent(App, &Event))
{
Input = sfRenderWindow_GetInput(App);
if (Event.Type == sfEvtClosed)
sfRenderWindow_Close(App);
if (Event.Type == sfEvtKeyPressed) {
if (sfInput_IsKeyDown(Input, sfKeyCode.sfKeyA)) {
sfRenderWindow_Close(App);
}
}
I have the above code right now, but looking at the C++ tutorials, and the API, I have a feeling that I should either use Event.Type == sfEvtKeyPressed OR sfInput_IsKeyDown. This leads me to two questions:
1) Which way should I use in a game loop?
2) If it is using Event.Type == sfEvtKeyPressed, what code do I use to check the contents of Event for a key?
Thanks for your time!
I've been trying everything and I'm guessing it isn't too hard but it isn't hitting me.