Debian Codegraph @

src/creditos.cc

raw symbols SCIP
1 /*
2 * Don Ceferino Hazaña - video game similary to Super Pang!
3 * Copyright (c) 2004, 2005 Hugo Ruscitti
4 * web site: http://www.loosersjuegos.com.ar
5 *
6 * This file is part of Don Ceferino Hazaña (ceferino).
7 * Written by Hugo Ruscitti <[email protected]>
8 *
9 * Don Ceferino Hazaña is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * Don Ceferino Hazaña is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25
26 ///etapas de la sección creditos
27 enum {INICIAL, WEB, GPL};
28
29
30 #include <SDL/SDL.h>
31 #include <string.h>
32
33 #include "menu.h"
34 #include "mundo.h"
35 #include "grafico.h"
36 #include "utils.h"
37 #include "int.h"
38
39 /*!
40 * \brief asigna los valores iniciales al menu creditos
41 */
42 creditos :: creditos(void)
43 {
44 f=0;
45 c=0;
46 delay=100;
47 etapa=INICIAL;
48 limite=86;
49
50 fila_letra=0;
51 columna_letra=0;
52 color=0;
53 }
54
55 creditos :: ~creditos(void)
56 {
57 SDL_FreeSurface(fondo);
58 }
59
60 /*!
61 * \brief genera la escena
62 *
63 * \return 1 en caso de error
64 */
65 int creditos :: iniciar(class mundo *_pmundo, int _modo_video, SDL_Surface *_screen)
66 {
67 SDL_Rect rect;
68
69 pmundo = _pmundo;
70 modo_video = _modo_video;
71 screen = _screen;
72
73 fondo = SDL_DisplayFormat(screen);
74
75 if (fondo == NULL)
76 {
77 printf(_("error: Can't copy screen: '%s'\n"), SDL_GetError());
78 return 1;
79 }
80
81
82 pmundo->libgrafico.ima_menu->imprimir(0, fondo, &rect, 0, 0, 1);
83 SDL_BlitSurface(fondo, NULL, screen, NULL);
84 cambiar_etapa(INICIAL);
85 imprimir_etapa ();
86
87 SDL_Flip(screen);
88 return 0;
89 }
90
91
92 /*!
93 * \brief actualizacón lógica
94 */
95 void creditos :: actualizar(void)
96 {
97 Uint8 * tecla;
98
99 tecla = SDL_GetKeyState(NULL);
100
101 if (tecla [SDLK_ESCAPE])
102 {
103 pmundo->audio.play (4);
104 pmundo->cambiar_escena (MENU);
105 }
106
107 if (tecla [SDLK_SPACE] && delay == 0)
108 {
109 delay = 100;
110
111 if (etapa == GPL)
112 {
113 pmundo->audio.play (4);
114 pmundo->cambiar_escena (MENU);
115 }
116 else
117 {
118 etapa ++;
119 pausa = 0;
120 fila_letra = 0;
121 columna_letra = 0;
122 c = 0;
123 f = 0;
124 cambiar_etapa (etapa);
125 pmundo->audio.play (5);
126 SDL_BlitSurface (fondo, NULL, screen, NULL);
127
128 imprimir_etapa ();
129 SDL_Flip (screen);
130 }
131 }
132
133 if (delay > 0)
134 delay --;
135 }
136
137 /*!
138 * \brief imprime un texto de creditos
139 */
140 void creditos :: imprimir(void)
141 {
142 static int etapa_anterior = -1;
143
144 if (etapa != etapa_anterior)
145 {
146 imprimir_etapa ();
147 etapa_anterior = etapa;
148 }
149 }
150
151
152 void creditos :: imprimir_etapa (void)
153 {
154 pmundo->fuente->myprintf (screen, 0, 0, NULL, NULL, false, CONSALTO, \
155 mensaje);
156
157 imprimir_pie ();
158 SDL_Flip (screen);
159 }
160
161
162 /*!
163 * \brief mensaje (space para continuar)
164 */
165 void creditos :: imprimir_pie(void)
166 {
167 pmundo->fuente->myprintf (screen, 320, 420, NULL, NULL, false, \
168 CENTRADO, _("(space to continue)"));
169 }
170
171
172 /*!
173 * \brief asigna una nueva etapa (ver enum)
174 */
175 void creditos :: cambiar_etapa(int nueva)
176 {
177 etapa = nueva;
178
179 switch (etapa)
180 {
181 case INICIAL:
182 strcpy(mensaje, _(\
183 "Developed by:\n Hugo Ruscitti\n\nGraphics by:\n Walter Velazquez\n\n"\
184 "Music by:\n Javier Da Silva"));
185 break;
186
187 case WEB:
188 strcpy(mensaje,\
189 _(\
190 "You can know more about what we are doing visiting the web site of the "\
191 "Losers Project:\n\nwww.losersjuegos.com.ar"));
192
193 break;
194
195 case GPL:
196 strcpy(mensaje,\
197 _(\
198 "License:\n\nThis program is free software and is distributed under the "\
199 "terms of the GPL license. Please read the file COPYING "\
200 "to obtain more information."));
201 break;
202
203
204 }
205 }
206
207
208 void creditos :: pausar(void)
209 {
210 }