/* SFont: a simple font library that uses special images as fonts
Copyright (C) 2003 Karl Bartel
- License: GPL or LGPL (at your choice)
WWW: http://www.linux-games.com/sfont/
This program is free software; you can redistribute it and/or modify
/* SFont: a simple font-library that uses special bitmaps as fonts
Copyright (C) 2003 Karl Bartel
- License: GPL or LGPL (at your choice)
WWW: http://www.linux-games.com/sfont/
This program is free software; you can redistribute it and/or modify
#include <SDL.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
// Delcare one variable of this type for each font you are using.
// To load the fonts, load the font image into YourFont->Surface
// and call SFont_InitFont(YourFont);
void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y,
const char *text);
-#ifdef __cplusplus
-}
-#endif
-
#endif /* SFONT_H */
extern SFont_Font *g_font;
-int cur_score; // which score we're currently entering.
+int cur_score = -1; // which score we're currently entering.
void
read_high_score_table()
SFont_Write(s, g_font, x, y, t);
snprintscore(t, 1024, g_scores[i].score);
SFont_Write(s, g_font, x+50, y, t);
- snprintf(t, 1024, "%s", g_scores[i].name);
+ if(i == cur_score) snprintf(t, 1024, "%s_", g_scores[i].name);
+ else snprintf(t, 1024, "%s", g_scores[i].name);
SFont_Write(s, g_font, x+180, y, t);
}
}
while(SDL_PollEvent(&e) && e.type == SDL_KEYDOWN) {
c = e.key.keysym.unicode;
k = e.key.keysym.sym;
- if(k == SDLK_BACKSPACE && n > 0) name[n--]=0;
- else if(e.key.keysym.sym == SDLK_RETURN) {
- SDL_EnableUNICODE(0);
- return false;
+ 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;
}
- else name[n++] = c;
}
return true;
}