removed message fades on windows
#include "sprite.h"
#include "sound.h"
#include "sprite.h"
#include "sound.h"
+#ifdef WIN32
+#define SetAlpha(surf, flag, alpha)
+#endif
+
// ************************************* VARS
// SDL_Surface global variables
SDL_Surface
// ************************************* VARS
// SDL_Surface global variables
SDL_Surface
case HIGH_SCORE_ENTRY:
play_tune(TUNE_HIGH_SCORE_ENTRY);
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.
// FALL THROUGH TO
case HIGH_SCORE_DISPLAY:
// Display de list o high scores mon.
for(;;) {
while(SDL_PollEvent(&e)) {
for(;;) {
while(SDL_PollEvent(&e)) {
- if(e.type == SDL_QUIT) return;
+ 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);
}
keystate = SDL_GetKeyState(NULL);
state = HIGH_SCORE_DISPLAY;
state_timeout = 400;
}
state = HIGH_SCORE_DISPLAY;
state_timeout = 400;
}
-
- if(state != HIGH_SCORE_ENTRY && (keystate[SDLK_q] || keystate[SDLK_ESCAPE]))
- return;
-
-process_score_input(void)
+process_score_input(SDL_keysym *key)
- int c,k,n;
- SDL_Event e;
name = g_scores[g_easy][cur_score].name;
n = strlen(name);
name = g_scores[g_easy][cur_score].name;
n = strlen(name);
- while(SDL_PollEvent(&e) && e.type == SDL_KEYDOWN) {
- c = e.key.keysym.unicode;
- k = e.key.keysym.sym;
- if(k == SDLK_BACKSPACE) {
- if(n > 0) name[--n]=0;
- } else {
- if(k == SDLK_RETURN) {
- SDL_EnableUNICODE(0);
- cur_score = -1;
- return false;
- } else name[n++] = c;
- }
+ if(key->sym == SDLK_BACKSPACE) {
+ if(n > 0) name[--n]=0;
+ } else {
+ if(key->sym == SDLK_RETURN) {
+ SDL_EnableUNICODE(0);
+ cur_score = -1;
+ return false;
+ } else name[n++] = key->unicode;
void display_scores(SDL_Surface *s, uint32_t x, uint32_t y);
int new_high_score(int score);
int insert_score(int score);
void display_scores(SDL_Surface *s, uint32_t x, uint32_t y);
int new_high_score(int score);
int insert_score(int score);
-int process_score_input(void);
+int process_score_input(SDL_keysym *key);