Fix for the problem that SDL applications exited
[AROS-Contrib.git] / Games / lbreakout2 / client / chart.h
blobea5146da91ddba8ad587bd547475c70b3011cffb
1 /***************************************************************************
2 chart.h - description
3 -------------------
4 begin : Mon Sep 24 2001
5 copyright : (C) 2001 by Michael Speck
6 email : kulkanie@gmx.net
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
19 ====================================================================
20 Highscore chart entry
21 ====================================================================
23 typedef struct {
24 char name[32];
25 int level;
26 int score;
27 int new_entry; /* newly entered the highscore */
28 } Chart_Entry;
30 ====================================================================
31 Levelset highscore chart.
32 ====================================================================
34 enum { CHART_ENTRY_COUNT = 10 };
35 typedef struct {
36 Chart_Entry entries[CHART_ENTRY_COUNT + 1]; /* last entry is space holder for new entry */
37 char *name;
38 } Set_Chart;
41 ====================================================================
42 Load highscore. If it doesn't exist try to create it in HI_DIR if
43 this fails fall back to ~/.lbreakout and create highscore there.
44 ====================================================================
46 void chart_load();
48 ====================================================================
49 Delete resources
50 ====================================================================
52 void chart_delete();
54 ====================================================================
55 Save chart in directory it was loaded from.
56 ====================================================================
58 void chart_save();
60 ====================================================================
61 Check if this player entered the highscore chart and update it.
62 ====================================================================
64 void chart_add( Set_Chart *chart, char *name, int level, int score );
66 ====================================================================
67 Sort chart with stable algorithm (bubble sort's ok) by wanted
68 value.
69 ====================================================================
71 enum { SORT_BY_LEVEL = 0, SORT_BY_SCORE };
72 void chart_sort( Set_Chart *chart, int type );
74 ====================================================================
75 Draw highscores centered in regio x,y,w,h
76 ====================================================================
78 void chart_show( Set_Chart *chart, int x, int y, int w, int h );
80 ====================================================================
81 Draw highscores centered in regio x,y,w,h but in a more compact way
82 (no title). Also don't use chart_pos (except for x).
83 ====================================================================
85 void chart_show_compact( Set_Chart *chart, int x, int y, int w, int h );
87 ====================================================================
88 Clear all new_entry flags (done before new players are added
89 to chart when game over).
90 ====================================================================
92 void chart_clear_new_entries();
94 ====================================================================
95 Query set chart by this name or if not found create a new one
96 by this name.
97 ====================================================================
99 Set_Chart* chart_set_query( const char *name );
101 ====================================================================
102 Query chart by id. If id is invalid return 0.
103 ====================================================================
105 Set_Chart* chart_set_query_id( int id );