Single Player Result Screen

origin
stpohle 22 years ago
parent 4616c80e90
commit 7bdcc64815

@ -1,4 +1,4 @@
/* $Id: font.c,v 1.6 2003/07/22 18:29:08 stpohle Exp $ */ /* $Id: font.c,v 1.7 2003/07/25 23:46:25 stpohle Exp $ */
// Using Fonts in SDL // Using Fonts in SDL
#include <string.h> #include <string.h>
@ -73,3 +73,10 @@ void font_free() {
} }
}; };
void font_drawbold (int x, int y, char *text, int size, int bold) {
font_draw (x - bold, y, text, size);
font_draw (x + bold, y, text, size);
font_draw (x, y - bold, text, size);
font_draw (x, y + bold, text, size);
};

@ -15,6 +15,7 @@ extern _font font[3];
extern void font_setcolor (unsigned char r, unsigned char g, unsigned char b, int size); extern void font_setcolor (unsigned char r, unsigned char g, unsigned char b, int size);
extern void font_draw (int x, int y, char *text, int size); extern void font_draw (int x, int y, char *text, int size);
extern void font_drawbold (int x, int y, char *text, int size, int bold);
extern void font_load (); extern void font_load ();
extern void font_free (); extern void font_free ();

@ -1,4 +1,5 @@
/* game.c - procedures for the game. */ /* $Id: game.c,v 1.44 2003/07/25 23:46:25 stpohle Exp $
game.c - procedures for the game. */
#include <string.h> #include <string.h>
#include <SDL.h> #include <SDL.h>
@ -287,23 +288,84 @@ void game_showresult () {
char text[255]; char text[255];
SDL_Event event; SDL_Event event;
Uint8 *keys; Uint8 *keys;
int done = 0, keypressed = 0, x, y; int done = 0, keypressed = 0, x, y, i, p;
menu_displaytext ("Loading..", "Please Wait", 32, 128, 32);
dest.x = dest.y = 0;
dest.w = gfx.res.x;
dest.h = gfx.res.y;
gfx_load_players (64, 64);
draw_logo (); draw_logo ();
strcpy (text, "Game Result"); strcpy (text, "Game Result");
x = (gfx.res.x - (font[2].size.x * strlen (text)) - 64) / 2; x = (gfx.res.x - (font[2].size.x * strlen (text)) - 64) / 2;
y = 64; y = 0;
font_setcolor (128, 128, 0, 2); font_setcolor (128, 128, 0, 2);
font_draw (x - 2, y, text, 2); font_drawbold (x, y, text, 2, 2);
font_draw (x + 2, y, text, 2);
font_draw (x, y - 2, text, 2);
font_draw (x, y + 2, text, 2);
font_setcolor (255, 255, 128, 2); font_setcolor (255, 255, 128, 2);
font_draw (x, y, text, 2); font_draw (x, y, text, 2);
y += font[2].size.x;
for (i = 1, p = 0; p < MAX_PLAYERS; p++)
if (PS_IS_alife (bman.players[p].state))
i++;
if (i == 1)
strcpy (text, "Game Over");
else
strcpy (text, "Draw Game");
x = (gfx.res.x - (font[2].size.x * strlen (text)) - 64) / 2;
font_setcolor (128, 128, 0, 2);
font_drawbold (x, y, text, 2, 2);
font_setcolor (255, 255, 128, 2);
font_draw (x, y, text, 2);
y += font[2].size.x + 8;
strcpy (text, "Hit [CTRL], [RETURN] or [STRG]");
x = (gfx.res.x - (font[1].size.x * strlen (text)) - 64) / 2;
font_setcolor (128, 128, 0, 1);
font_drawbold (x, gfx.res.y - font[1].size.y - 2, text, 1, 1);
font_setcolor (255, 255, 128, 1);
font_draw (x, gfx.res.y - font[1].size.y - 2, text, 1);
for (i = 1, p = 0; p < MAX_PLAYERS; p++) {
if (PS_IS_used (bman.players[p].state)) {
if (!i) {
i = 1;
x = (gfx.res.x / 2) + 16;
}
else if (i) {
i = 0;
y = y + 80;
x = 16;
}
font_setcolor (128, 128, 128, 0);
font_drawbold (x + 80, y + 4, bman.players[p].name, 0, 2);
if (PS_IS_alife (bman.players[p].state))
font_setcolor (255, 255, 0, 0);
else
font_setcolor (196, 196, 196, 0);
font_draw (x + 80, y + 4, bman.players[p].name, 0);
sprintf (text, "%3d", bman.players[p].wins);
font_draw (x + 80 + (LEN_PLAYERNAME+2) * font[0].size.x, y + 4, text, 0);
sprintf (text, "%3d", bman.players[p].points);
font_draw (x + 80 + (LEN_PLAYERNAME+5) * font[0].size.x, y + 4, text, 0);
dest.x = x;
dest.y = y;
src.w = dest.w = bman.players[p].gfx->ani.w;
src.h = dest.h = bman.players[p].gfx->ani.h;
src.x = bman.players[p].gfx->ani.w * down;
src.y = 0;
}
}
gfx_blitdraw (); gfx_blitdraw ();
SDL_Flip (gfx.screen); SDL_Flip (gfx.screen);
gfx_free_players ();
while (!done) { while (!done) {
/* do the keyboard handling */ /* do the keyboard handling */

Loading…
Cancel
Save