gnome-score

Name

gnome-score — Tracking score for games

Synopsis


#include <gnome.h>


gint        gnome_score_init                (const gchar *gamename);
gint        gnome_score_log                 (gfloat score,
                                             gchar *level,
                                             gboolean higher_to_lower_score_order);
gint        gnome_score_get_notable         (gchar *gamename,
                                             gchar *level,
                                             gchar ***names,
                                             gfloat **scores,
                                             time_t **scoretimes);

Description

The routines in this module provide a simple way for games to for keeping track of the user's score in a game.

The programmer needs to call gnome_score_init() with the name of the game prior to accessing any of the other gnome_score functions. gnome_score_log() should then be called every time the user ends a round. To get a list of the most notable scores, you call the gnome_score_get_notable() routine.

Details

gnome_score_init ()

gint        gnome_score_init                (const gchar *gamename);

GNOME Games should call this routine as the first statement in main() if they have been installed setgid to the games() group.

gamename : Identifies the game name.Returns : 0 on success, returns -1 on failure. group privileges are dropped regardless of the status returned.


gnome_score_log ()

gint        gnome_score_log                 (gfloat score,
                                             gchar *level,
                                             gboolean higher_to_lower_score_order);

Logs a score entry for the user.

score : the score achieved by the user in this gamelevel : level on which the score was obtainedhigher_to_lower_score_order : biggers is better or notReturns :0 on failure or the status from the gnome-score helper program.


gnome_score_get_notable ()

gint        gnome_score_get_notable         (gchar *gamename,
                                             gchar *level,
                                             gchar ***names,
                                             gfloat **scores,
                                             time_t **scoretimes);

Fetches the most notable players on gamename at level level.

gamename : the name of the game we want to fetch information from.level : the level from which we want to pull information.names : an array of strings is returned at the address pointed herescores : an array of gfloats is returned at the address pointed herescoretimes : an array of time_t is returned at the address pointed hereReturns :the number of scores returned. names, scores and scoretime point to regions that were allocated with g_malloc() with the contents.