MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/share/gtk-doc/html/libgnome/libgnome-gnome-score.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>gnome-score</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GNOME Library Reference Manual">
<link rel="up" href="ch01s03.html" title="Displaying help and external info">
<link rel="prev" href="libgnome-gnome-url.html" title="gnome-url">
<link rel="next" href="ch01s04.html" title="Miscellaneous">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="libgnome.html" title="GNOME Library (libgnome)">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="libgnome-gnome-url.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01s03.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNOME Library Reference Manual</th>
<td><a accesskey="n" href="ch01s04.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2820885" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2821013" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="libgnome-gnome-score"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2820885"></a><span class="refentrytitle">gnome-score</span>
</h2>
<p>gnome-score &#8212; Tracking best scores for games</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;libgnome/libgnome.h&gt;


<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>        <a href="libgnome-gnome-score.html#gnome-score-init">gnome_score_init</a>                (const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *gamename);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>        <a href="libgnome-gnome-score.html#gnome-score-log">gnome_score_log</a>                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"
>gfloat</a> score,
                                             const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *level,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a> higher_to_lower_score_order);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>        <a href="libgnome-gnome-score.html#gnome-score-get-notable">gnome_score_get_notable</a>         (const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *gamename,
                                             const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *level,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> ***names,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"
>gfloat</a> **scores,
                                             time_t **scoretimes);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2821013"></a><h2>Description</h2>
<p>
The routines in this module provide a simple way to keep track of users' scores
in a game.
</p>
<p>
In order to acommodate file ownership permissions, the game application should
be installed setgid <em class="wordasword">games</em> and the scoretable should
only be writable by the <em class="wordasword">games</em> group. The program
should call <a href="libgnome-gnome-score.html#gnome-score-init"><code class="function">gnome_score_init()</code></a> as soon as possible inside the <code class="function">main()</code> routine.
This will open a pair of pipes to a child process which can read and write the
score table and then will drop the group privileges of the main program back to
the user's normal group id.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2821068"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2821078"></a><h3>
<a name="gnome-score-init"></a>gnome_score_init ()</h3>
<a class="indexterm" name="id2821093"></a><pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>        gnome_score_init                (const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *gamename);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gnome_score_init</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
GNOME games should call this routine as the first statement
in <code class="function">main()</code> if they have been installed setgid to the "games" group. It
performs the intialization required to later record information in the
scores table and then drops the groups privileges.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>gamename</code></em>&#160;:</span></td>
<td> Identifies the game name.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <code class="literal">0</code> on success, returns <code class="literal">-1</code> on failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2821201"></a><h3>
<a name="gnome-score-log"></a>gnome_score_log ()</h3>
<a class="indexterm" name="id2821216"></a><pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>        gnome_score_log                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"
>gfloat</a> score,
                                             const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *level,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a> higher_to_lower_score_order);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gnome_score_log</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Logs a score entry for the user. You should call this every time a game
ends.  This function takes care of working out whether the user's score made
it into the ten best scores and, if so, records it in the table.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>score</code></em>&#160;:</span></td>
<td> The score achieved by the user in this game
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>level</code></em>&#160;:</span></td>
<td> The level on which the score was obtained
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>higher_to_lower_score_order</code></em>&#160;:</span></td>
<td> Set to <a
href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if high scores are better than
low scores.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <code class="literal">0</code> on failure or the status from the gnome-score helper
program.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2821358"></a><h3>
<a name="gnome-score-get-notable"></a>gnome_score_get_notable ()</h3>
<a class="indexterm" name="id2821373"></a><pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>        gnome_score_get_notable         (const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *gamename,
                                             const <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> *level,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"
>gchar</a> ***names,
                                             <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gfloat"
>gfloat</a> **scores,
                                             time_t **scoretimes);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gnome_score_get_notable</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Fetches the most notable players on <em class="parameter"><code>gamename</code></em> at level <em class="parameter"><code>level</code></em>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>gamename</code></em>&#160;:</span></td>
<td>   The name of the game we want to fetch information from.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>level</code></em>&#160;:</span></td>
<td>      The level for which we want to pull information.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>names</code></em>&#160;:</span></td>
<td>      An array of strings is returned at the address pointed here
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>scores</code></em>&#160;:</span></td>
<td>     An array of gfloats is returned at the address pointed here
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>scoretimes</code></em>&#160;:</span></td>
<td> An array of time_t is returned at the address pointed here
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The number of scores returned.  The <em class="parameter"><code>names</code></em>, <em class="parameter"><code>scores</code></em> and <em class="parameter"><code>scoretime</code></em>
pointers point to regions that were allocated with <a
href="/usr/share/gtk-doc/html/glib/glib-Memory-Allocation.html#g-malloc"
><code class="function">g_malloc()</code></a> with the
contents.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>