-
Notifications
You must be signed in to change notification settings - Fork 7
/
status.c
102 lines (73 loc) · 2.44 KB
/
status.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
* IceBreaker
* Copyright (c) 2000-2020 Matthew Miller <[email protected]>
*
* <http://www.mattdm.org/icebreaker/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <SDL.h>
#include "icebreaker.h"
#include "text.h"
#include "globals.h"
#include "hiscore.h"
#include "laundry.h"
#include "status.h"
#include "themes.h"
void updatestatuslives(int lives)
{
SDL_Rect tmprect;
char tmptext[30]; // should be plenty big.
tmprect.h=CHARHEIGHT*2; tmprect.w=LIVESW;
tmprect.x=LIVESX; tmprect.y=STATUSY;
SDL_FillRect(screen,&tmprect,color.background);
snprintf(tmptext,30,"LIVES: %d",lives);
puttext(LIVESX,STATUSY,2,color.normaltext,tmptext);
soil(tmprect);
}
void updatestatuscleared(int clear)
{
SDL_Rect tmprect;
char tmptext[30]; // should be plenty big.
tmprect.h=CHARHEIGHT*2; tmprect.w=CLEAREDW;
tmprect.x=CLEAREDX; tmprect.y=STATUSY;
SDL_FillRect(screen,&tmprect,color.background);
snprintf(tmptext,30, "CLEARED: %d%%",clear);
puttext(CLEAREDX,STATUSY,2,color.normaltext,tmptext);
soil(tmprect);
}
void updatestatusscore(long score)
{
SDL_Rect tmprect;
char tmptext[30]; // should be plenty big.
tmprect.h=CHARHEIGHT*2; tmprect.w=SCOREW;
tmprect.x=SCOREX; tmprect.y=STATUSY;
SDL_FillRect(screen,&tmprect,color.background);
snprintf(tmptext,30, "SCORE: %ld",score);
puttext(SCOREX,STATUSY,2,color.normaltext,tmptext);
soil(tmprect);
}
extern void updatehiscorebox()
{
SDL_Rect tmprect;
char tmptext[100]; // should be plenty big.
tmprect.x=LIVESX; tmprect.y=BOTTOMSTATUSY;
tmprect.h=CHARHEIGHT*3;; tmprect.w=WIDTH-(CHARWIDTH*2*4)-MARGINRIGHT-4-LIVESX-2;
SDL_FillRect(screen,&tmprect,color.background);
snprintf(tmptext,100,"HIGH SCORE: %ld (%s)",hiscoreval[0],hiscorename[0]);
puttext(tmprect.x,tmprect.y+3,2,color.normaltext,tmptext);
soil(tmprect);
}