1 /* Pongix - clone of the "Pong" video game with net support
2  * Copyright (C) 2005 - Hugo Ruscitti (see AUTHORS file)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
17  */
18 
19 #include "marcador.h"
20 #include "util.h"
21 #include "mundo.h"
22 
marcador_iniciar(void)23 Marcador * marcador_iniciar (void)
24 {
25 	Marcador * data;
26 
27 	data = (Marcador *) malloc (sizeof (Marcador));
28 
29 	if (data == NULL)
30 	{
31 		printf ("No se puede crear el m�dulo Marcador\n");
32 		return NULL;
33 	}
34 
35 	return data;
36 }
37 
marcador_sumar(Marcador * data,int jugador)38 void marcador_sumar (Marcador * data, int jugador)
39 {
40 	if (jugador == 1)
41 		data->puntos1 ++;
42 	else
43 		data->puntos2 ++;
44 }
45 
marcador_terminar(Marcador * data)46 void marcador_terminar (Marcador * data)
47 {
48 	free (data);
49 }
50 
marcador_imprimir(Marcador * data,struct mundo * mundo)51 void marcador_imprimir (Marcador * data, struct mundo * mundo)
52 {
53 	fuente_printf (mundo->fuente, 10, 0, "%d", data->puntos1);
54 	fuente_printf (mundo->fuente, 600, 0, "%d", data->puntos2);
55 }
56 
marcador_reiniciar(Marcador * data)57 void marcador_reiniciar (Marcador * data)
58 {
59 	data->puntos1 = 0;
60 	data->puntos2 = 0;
61 }
62