3 // SuperTux (Statistics module)
4 // Copyright (C) 2004 Ricardo Cruz <rick2@aeiou.pt>
5 // Copyright (C) 2006 Ondrej Hosek <ondra.hosek@gmail.com>
6 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef SUPERTUX_STATISTICS_H
23 #define SUPERTUX_STATISTICS_H
26 #include "lisp/lisp.hpp"
27 #include "lisp/writer.hpp"
28 #include "video/surface.hpp"
29 #include "video/drawing_context.hpp"
31 /** This class is a layer between level and worldmap to keep
32 * track of stuff like scores, and minor, but funny things, like
33 * number of jumps and stuff */
37 int coins; /**< coins collected */
38 int total_coins; /**< coins in level */
39 int badguys; /**< badguys actively killed */
40 int total_badguys; /**< (vincible) badguys in level */
41 float time; /**< seconds needed */
44 Statistics(); /**< Creates new statistics, call reset() before counting */
47 /// read statistics from lisp file
48 void parse(const lisp::Lisp& lisp);
49 /// write statistics to lisp file
50 void write(lisp::Writer& writer);
52 void draw_worldmap_info(DrawingContext& context); /**< draw worldmap stat HUD */
53 void draw_message_info(DrawingContext& context, std::string title); /**< draw stats at level start */
54 void draw_endseq_panel(DrawingContext& context, Statistics* best_stats, Surface* backdrop); /**< draw panel shown during level's end sequence */
56 void reset(); /**< Set stats (but not totals) to zero */
57 void merge(Statistics& stats); /**< Given another Statistics object finds the best of each one */
58 void operator+=(const Statistics& o); /**< Add two Statistics objects */
61 Timer timer; /**< for draw_worldmap_info: time until switching to next stat */
62 int display_stat; /**< for draw_worldmap_info: which stat is currently displayed */
65 #endif /*SUPERTUX_STATISTICS_H*/