I have a "GUI" and need that it recognizes "keyboard"
On having touched the letter "S" I need that it is opened " QUITGAME (0);
On having touched the letter "N" I need that one comes back to the game.
I hope that my question is understood.
Thanks to all!. ???
I would do it like that
function repeatedly_execute() {
if (gYOURGUI.Visible == true)
{
if (IsKeyPressed (eKeyS) == true) QuitGame(0);
if (IsKeyPressed (eKeyN) == true) gYOURGUI.Visible == false;
}
}
You don't have to use repeatedly_execute. In fact it's probably less efficient than just using on_key_press since you're duplicating a check done internally. Do something like this:
function on_key_press(eKeyCode keycode) {
if (IsGamePaused()) { // game is paused, ignore most keys
if (gYourgui.Visible) {
if (keycode == 'S') QuitGame(0);
else if (keycode == 'N') gYourgui.Visible = false;
}
// else..other GUIs that need to pause the game but intercept keypresses
}
// ...the rest of your normal keypresses here
}