* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <argp.h>
#include <math.h>
#include <SDL.h>
#include <SDL_image.h>
#include "sprite.h"
#include "sound.h"
+#ifdef WIN32
+#define SetAlpha(surf, flag, alpha)
+#endif
+
// ************************************* VARS
// SDL_Surface global variables
SDL_Surface
}
// Load the banners
- NULLERROR(surf_b_variations = load_image("variations.png"));
- NULLERROR(surf_b_on = load_image("on.png"));
- NULLERROR(surf_b_rockdodger = load_image("rockdodger.png"));
+ NULLERROR(surf_b_variations = load_image("b_variations.png"));
+ NULLERROR(surf_b_on = load_image("b_on.png"));
+ NULLERROR(surf_b_rockdodger = load_image("b_rockdodger.png"));
- NULLERROR(surf_b_game = load_image("game.png"));
- NULLERROR(surf_b_over = load_image("over.png"));
+ NULLERROR(surf_b_game = load_image("b_game.png"));
+ NULLERROR(surf_b_over = load_image("b_over.png"));
// Load the life indicator (small ship) graphic.
NULLERROR(surf_life = load_image("life.png"));
case HIGH_SCORE_ENTRY:
play_tune(TUNE_HIGH_SCORE_ENTRY);
- if(!process_score_input()) { // done inputting name
-
- // Change state to briefly show high scores page
- state = HIGH_SCORE_DISPLAY;
- state_timeout = 200;
-
- // Write the high score table to the file
- write_high_score_table();
-
- play_tune(TUNE_TITLE_PAGE);
- }
// FALL THROUGH TO
case HIGH_SCORE_DISPLAY:
// Display de list o high scores mon.
void
gameloop() {
- Uint8 *keystate = SDL_GetKeyState(NULL);
+ SDL_Event e;
+ Uint8 *keystate;
float tmp;
for(;;) {
- SDL_PumpEvents();
+ while(SDL_PollEvent(&e)) {
+ switch(e.type) {
+ case SDL_QUIT: return;
+ case SDL_KEYUP:
+ if(e.key.keysym.sym == SDLK_ESCAPE
+ || e.key.keysym.sym == SDLK_q)
+ return;
+ break;
+ case SDL_KEYDOWN:
+ if(state == HIGH_SCORE_ENTRY)
+ if(!process_score_input(&e.key.keysym)) {
+ // Write the high score table to the file
+ write_high_score_table();
+ // continue to display the scores briefly
+ state = HIGH_SCORE_DISPLAY;
+ state_timeout = 200;
+ play_tune(TUNE_TITLE_PAGE);
+ }
+ break;
+ }
+ }
keystate = SDL_GetKeyState(NULL);
if(!paused) {
state = HIGH_SCORE_DISPLAY;
state_timeout = 400;
}
-
- if(state != HIGH_SCORE_ENTRY && (keystate[SDLK_q] || keystate[SDLK_ESCAPE]))
- return;
-
}
}
int
main(int argc, char **argv) {
- init_opts();
- argp_parse(&argp, argc, argv, 0, 0, 0);
+ if(!parse_opts(argc, argv)) return 1;
if(init()) {
printf ("ta: '%s'\n",initerror);