[Add] Preleminary pause menu.

This commit is contained in:
Allanis 2013-02-19 23:23:15 +00:00
parent 1ecf7c1e54
commit 100c605d6b

View File

@ -3,6 +3,7 @@
#include "player.h" #include "player.h"
#include "pause.h" #include "pause.h"
#include "toolkit.h" #include "toolkit.h"
#include "menu.h"
#include "input.h" #include "input.h"
#define KEY_PRESS ( 1.) #define KEY_PRESS ( 1.)
@ -24,7 +25,8 @@ const char* keybindNames[] = { "accel", "left", "right", "reverse", // Movement.
"primary", "target", "target_nearest", "face", "board", // Combat. "primary", "target", "target_nearest", "face", "board", // Combat.
"secondary", "secondary_next", // Secondary weapons. "secondary", "secondary_next", // Secondary weapons.
"target_planet", "land", // Navigation. "target_planet", "land", // Navigation.
"mapzoomin", "mapzoomout", "screenshot", "pause", "end" }; // Misc. "mapzoomin", "mapzoomout", "screenshot", "pause", "menu", // Misc.
"end" }; // Must terminate at the end.
// From player.c // From player.c
extern double player_turn; extern double player_turn;
extern double player_acc; extern double player_acc;
@ -59,6 +61,8 @@ void input_setDefault(void) {
input_setKeybind("mapzoomout", KEYBIND_KEYBOARD, SDLK_DOWN, 0); input_setKeybind("mapzoomout", KEYBIND_KEYBOARD, SDLK_DOWN, 0);
input_setKeybind("screenshot", KEYBIND_KEYBOARD, SDLK_F12, 0); input_setKeybind("screenshot", KEYBIND_KEYBOARD, SDLK_F12, 0);
input_setKeybind("pause", KEYBIND_KEYBOARD, SDLK_F1, 0); input_setKeybind("pause", KEYBIND_KEYBOARD, SDLK_F1, 0);
input_setKeybind("menu", KEYBIND_KEYBOARD, SDLK_ESCAPE, 0);
} }
// Initialization/exit functions (does not assign keys). // Initialization/exit functions (does not assign keys).
@ -218,6 +222,11 @@ static void input_key(int keynum, double value, int abs) {
} else pause(); } else pause();
} }
} }
// Opens a menu.
else if(KEY("menu")) {
if(value == KEY_PRESS)
menu_small();
}
} }
// --Events-- // --Events--
@ -270,13 +279,6 @@ static void input_keydown(SDLKey key) {
input_key(i, KEY_PRESS, 0); input_key(i, KEY_PRESS, 0);
return; return;
} }
// Fire Escape.
SDL_Event quit;
if(key == SDLK_ESCAPE) {
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
}
} }
// Key up. // Key up.