Store user data in $HOME
[kball.git] / src / stats.cpp
blob8a8cb5c36aecd48eef144f97a101bebf50d2be8b
1 // -----------------------------------------------
2 // stats.cpp
3 // -----------------------------------------------
4 // Statistics of gameplay for KBall
5 // -----------------------------------------------
6 // By Kronoman
7 // Copyright (c) 2004
8 // In loving memory of my father
9 // -----------------------------------------------
11 #include "stats.h"
13 CGameStats::CGameStats()
15 reset();
18 CGameStats::~CGameStats()
20 // nothing to do
23 void CGameStats::reset()
25 h = s = m = score = blost = 0;
28 void CGameStats::print(BITMAP *bmp, int y, int color, int bg, FONT *f)
30 //textprintf_ex(bmp, f, 0, y+=text_height(f)*2, color, bg, "Statistics");
32 textprintf_centre_ex(bmp, f, bmp->w/2, y+=text_height(f), color, bg, "TOTAL TIME");
33 textprintf_centre_ex(bmp, f, bmp->w/2, y+=text_height(f), color, bg, "%4d:%02d:%02d", h,m,s);
35 textprintf_centre_ex(bmp, f, bmp->w/2, y+=text_height(f)*2, color, bg, "TOTAL SCORE");
36 textprintf_centre_ex(bmp, f, bmp->w/2, y+=text_height(f), color, bg, "%010ld", score);
38 textprintf_centre_ex(bmp, f, bmp->w/2, y+=text_height(f)*2, color, bg, "BALLS LOST");
39 textprintf_centre_ex(bmp, f, bmp->w/2, y+=text_height(f), color, bg, "%3d", blost);
42 void CGameStats::add_time(int h1, int m1, int s1)
44 s += s1;
46 m += s / 60;
47 s = s % 60;
49 m += m1;
51 h += m / 60;
52 m = m % 60;
54 h += h1;