00001
00002
00009
00010
#include "affichage.h"
00011
#include "ctrl_entite.h"
00012
#include "ctrl_particule.h"
00013
#include "ctrl_fenetre.h"
00014
#include "entite_arme.h"
00015
#include "entite_bonus.h"
00016
#include "entite_ennemi.h"
00017
#include "entite_joueur.h"
00018
#include "xml_score.h"
00019
#include "window_sdl.h"
00020
#include <sstream>
00021
00022
CAffichage* CAffichage::m_pInstance = 0;
00023
00024 CAffichage::CAffichage ()
00025 {
00026 m_pInstance = 0;
00027 m_iFpsCompte = 0;
00028 m_iFpsNiveau = 0;
00029 m_iFps = 0;
00030 m_FpsTimer.
Init ();
00031
00032
00033
char* szExtList = (
char*) glGetString (GL_EXTENSIONS);
00034
00035
00036
00037
00038
if (!strstr (szExtList,
"GL_ARB_point_sprite"))
00039 {
00040
00041 m_bPointSprite =
false;
00042 fprintf (stderr,
"L'extension OpenGL 'GL_ARB_point_sprite', n'est pas supporté ...\n");
00043 fprintf (stderr,
"Veuillez installer les derniers pilotes de votre carte graphique.\n");
00044 }
00045
else
00046 {
00047
00048 m_bPointSprite =
true;
00049 }
00050
00051
00052 glClearColor (0.0f, 0.0f, 0.1f, 0.0f);
00053 glShadeModel (GL_FLAT);
00054
00055
Debut ();
00056
Fin ();
00057
00058
00059 m_Font.
ChargerTexture (FICHIER_TEXTURE_FONT);
00060 }
00061
00062
00063
00064 CAffichage*
CAffichage::Instance ()
00065 {
00066
if (m_pInstance == 0)
00067 m_pInstance =
new CAffichage;
00068
return m_pInstance;
00069 }
00070
00071 void CAffichage::Kill ()
00072 {
00073
00074
if (m_pInstance != 0)
00075 {
00076
delete m_pInstance;
00077 m_pInstance = 0;
00078 }
00079 }
00080
00081
00082
00083
00084
00085
00086 void CAffichage::Entite ()
const
00087
{
00088
if (m_bPointSprite)
00089 EntitePoint ();
00090
else
00091 EntiteQuad ();
00092 }
00093
00094
00095
void CAffichage::EntitePoint ()
const
00096
{
00097
const CEntityManager *pControleurEntite =
CEntityManager::Instance ();
00098
00099
00100 glEnable (GL_TEXTURE_2D);
00101
00102 glEnable (GL_POINT_SPRITE_ARB);
00103
00104 glEnable (GL_BLEND);
00105
00106 glEnable (GL_CULL_FACE);
00107
00108
00109 glTexEnvf (GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
00110
00111 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00112
00113
00114
00115
00116
00117
for (
int EntiteType =
ENTITE_MIN; EntiteType <
ENTITE_MAX; EntiteType++)
00118 {
00119
for (
int i = 0; i <
CTRL_ENTITE_NOMBRE; i++)
00120 {
00121
00122
const CEntite* pEntite = pControleurEntite->
GetEntiteParIndex (i);
00123
if (pEntite)
00124 {
00125
if (pEntite->
GetType () == EntiteType)
00126 {
00127
00128
00129 pEntite->
GetTexture ()->
Bind ();
00130
00131 glPointSize (pEntite->
GetTaille ());
00132
00133 glBegin (GL_POINTS);
00134 glColor4f (1.0f, 1.0f, 1.0f, 1.0f);
00135 glVertex2fv (pEntite->
GetPosition ());
00136 glEnd ();
00137
00138
00139
if (pEntite->
GetType () ==
ENTITE_JOUEUR)
00140 {
00141
const CEntiteJoueur* pJoueur = static_cast<const CEntiteJoueur*> (pEntite);
00142 glBlendFunc (GL_SRC_ALPHA, GL_ONE);
00143
00144 pJoueur->
GetTextureBouclier ()->
Bind ();
00145 glPointSize (pEntite->
GetTaille () *
BOUCLIER_TAILLE);
00146 glBegin (GL_POINTS);
00147 glColor4f (pJoueur->
GetCouleur () (gtl::R), pJoueur->
GetCouleur () (gtl::G), pJoueur->
GetCouleur () (gtl::B), pJoueur->
GetBouclier () / 100.f);
00148 glVertex2fv (pJoueur->
GetPosition ());
00149 glEnd ();
00150 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00151 }
00152 }
00153 }
00154 }
00155 }
00156
00157 glDisable (GL_CULL_FACE);
00158 glDisable (GL_BLEND);
00159 glDisable (GL_POINT_SPRITE_ARB);
00160 glDisable (GL_TEXTURE_2D);
00161 }
00162
00163
00164
void CAffichage::EntiteQuad ()
const
00165
{
00166
const CEntityManager *pControleurEntite =
CEntityManager::Instance ();
00167
00168
00169 glEnable (GL_TEXTURE_2D);
00170
00171 glEnable (GL_BLEND);
00172
00173 glEnable (GL_CULL_FACE);
00174
00175
00176 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00177
00178
00179
00180
00181
00182
for (
int EntiteType =
ENTITE_MIN; EntiteType <
ENTITE_MAX; EntiteType++)
00183 {
00184
for (
int i = 0; i <
CTRL_ENTITE_NOMBRE; i++)
00185 {
00186
00187
const CEntite* pEntite = pControleurEntite->
GetEntiteParIndex (i);
00188
if (pEntite)
00189 {
00190
if (pEntite->
GetType () == EntiteType)
00191 {
00192
CVecteur Position = pEntite->
GetPosition ();
00193
float fTaille = pEntite->
GetTaille () / 2;
00194
00195
00196 pEntite->
GetTexture ()->
Bind ();
00197
00198 glBegin (GL_QUADS);
00199 glColor4f (1.0f, 1.0f, 1.0f, 1.0f);
00200 glTexCoord2f (1, 1); glVertex2fv (Position +
CVecteur (-fTaille, -fTaille));
00201 glTexCoord2f (0, 1); glVertex2fv (Position +
CVecteur (fTaille, -fTaille));
00202 glTexCoord2f (0, 0); glVertex2fv (Position +
CVecteur (fTaille, fTaille));
00203 glTexCoord2f (1, 0); glVertex2fv (Position +
CVecteur (-fTaille, fTaille));
00204 glEnd ();
00205
00206 fTaille *=
BOUCLIER_TAILLE;
00207
if (pEntite->
GetType () ==
ENTITE_JOUEUR)
00208 {
00209
const CEntiteJoueur* pJoueur = static_cast<const CEntiteJoueur*> (pEntite);
00210 glBlendFunc (GL_SRC_ALPHA, GL_ONE);
00211
00212 pJoueur->
GetTextureBouclier ()->
Bind ();
00213 glBegin (GL_QUADS);
00214 glColor4f (pJoueur->
GetCouleur () (gtl::R), pJoueur->
GetCouleur () (gtl::G), pJoueur->
GetCouleur () (gtl::B), pJoueur->
GetBouclier () / 100.f);
00215 glTexCoord2f (1, 1); glVertex2fv (Position +
CVecteur (-fTaille, -fTaille));
00216 glTexCoord2f (0, 1); glVertex2fv (Position +
CVecteur (fTaille, -fTaille));
00217 glTexCoord2f (0, 0); glVertex2fv (Position +
CVecteur (fTaille, fTaille));
00218 glTexCoord2f (1, 0); glVertex2fv (Position +
CVecteur (-fTaille, fTaille));
00219 glEnd ();
00220 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00221 }
00222 }
00223 }
00224 }
00225 }
00226
00227 glDisable (GL_CULL_FACE);
00228 glDisable (GL_BLEND);
00229 glDisable (GL_TEXTURE_2D);
00230 }
00231
00232
00233
00234
00235
00236
00237 void CAffichage::Particule ()
const
00238
{
00239
if (m_bPointSprite)
00240 ParticulePoint ();
00241
else
00242 ParticuleQuad ();
00243 }
00244
00245
00246
void CAffichage::ParticulePoint ()
const
00247
{
00248
const CParticleManager *pControleurParticule =
CParticleManager::Instance ();
00249
00250
00251 glEnable (GL_TEXTURE_2D);
00252
00253 glEnable (GL_POINT_SPRITE_ARB);
00254
00255 glEnable (GL_BLEND);
00256
00257 glEnable (GL_CULL_FACE);
00258
00259
00260 glTexEnvf (GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
00261
00262 glBlendFunc (GL_SRC_ALPHA, GL_ONE);
00263
00264
for (
unsigned int i = 0; i <
CTRL_GENERATEUR_PARTICULE_NOMBRE; i++)
00265 {
00266
const CParticleSystem *pGenerateurParticule = pControleurParticule->
GetGenerateurParIndex (i);
00267
if (!pGenerateurParticule)
00268
continue;
00269
00270
00271 pGenerateurParticule->
GetTexture ()->
Bind ();
00272
00273 glPointSize (pGenerateurParticule->
GetTaille ());
00274
00275 glBegin (GL_POINTS);
00276
for (
unsigned int j = 0; j <
PARTICULE_NOMBRE; j++)
00277 {
00278
const CParticule *pParticule = pGenerateurParticule->
GetParticuleParIndex (j);
00279
if (!pParticule)
00280
continue;
00281
CCouleur Couleur = pGenerateurParticule->
GetCouleur ();
00282 glColor4f (Couleur (gtl::R), Couleur (gtl::G), Couleur (gtl::B), pParticule->
GetTransparence ());
00283
CVecteur Position = pParticule->
GetPosition ();
00284 glVertex2fv (Position);
00285 }
00286 glEnd ();
00287 }
00288
00289 glDisable (GL_CULL_FACE);
00290 glDisable (GL_BLEND);
00291 glDisable (GL_POINT_SPRITE_ARB);
00292 glDisable (GL_TEXTURE_2D);
00293 }
00294
00295
00296
void CAffichage::ParticuleQuad ()
const
00297
{
00298
const CParticleManager *pControleurParticule =
CParticleManager::Instance ();
00299
00300
00301 glEnable (GL_TEXTURE_2D);
00302
00303 glEnable (GL_BLEND);
00304
00305 glEnable (GL_CULL_FACE);
00306
00307
00308
00309
00310
00311 glBlendFunc (GL_SRC_ALPHA, GL_ONE);
00312
00313
for (
unsigned int i = 0; i <
CTRL_GENERATEUR_PARTICULE_NOMBRE; i++)
00314 {
00315
const CParticleSystem *pGenerateurParticule = pControleurParticule->
GetGenerateurParIndex (i);
00316
if (!pGenerateurParticule)
00317
continue;
00318
00319
00320 pGenerateurParticule->
GetTexture ()->
Bind ();
00321
float fTaille = pGenerateurParticule->
GetTaille () / 2;
00322
00323 glBegin (GL_QUADS);
00324
for (
unsigned int j = 0; j <
PARTICULE_NOMBRE; j++)
00325 {
00326
const CParticule *pParticule = pGenerateurParticule->
GetParticuleParIndex (j);
00327
if (!pParticule)
00328
continue;
00329
CCouleur Couleur = pGenerateurParticule->
GetCouleur ();
00330
CVecteur Position = pParticule->
GetPosition ();
00331
00332 glColor4f (Couleur (gtl::R), Couleur (gtl::G), Couleur (gtl::B), pParticule->
GetTransparence ());
00333 glTexCoord2f (0, 0); glVertex2fv (Position +
CVecteur (-fTaille, -fTaille));
00334 glTexCoord2f (1, 0); glVertex2fv (Position +
CVecteur (fTaille, -fTaille));
00335 glTexCoord2f (1, 1); glVertex2fv (Position +
CVecteur (fTaille, fTaille));
00336 glTexCoord2f (0, 1); glVertex2fv (Position +
CVecteur (-fTaille, fTaille));
00337 }
00338 glEnd ();
00339 }
00340
00341 glDisable (GL_CULL_FACE);
00342 glDisable (GL_BLEND);
00343 glDisable (GL_TEXTURE_2D);
00344 }
00345
00346
00347
00348
00349
00350
00351 void CAffichage::MenuPrincipal (
unsigned int uiCurseur,
bool bJeuCree)
00352 {
00353
int x =
FENETRE_LARGEUR / 2 - 128;
00354
int y =
FENETRE_HAUTEUR / 2;
00355 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00356
if (bJeuCree)
00357 m_Font.
Print (
x,
y + 16 * 4,
MENU_TEXTE_REPRENDRE);
00358 m_Font.
Print (
x,
y + 16 * 3,
MENU_TEXTE_COMMENCER);
00359 m_Font.
Print (
x,
y + 16 * 2,
MENU_TEXTE_SCORES);
00360 m_Font.
Print (
x,
y + 16 * 1,
MENU_TEXTE_QUITTER);
00361 m_Font.
Print (
x - 32,
y + 16 * uiCurseur,
">");
00362 }
00363
00364
00365 void CAffichage::MenuCommencer (
unsigned int uiCurseur,
unsigned int m_uiNombreJoueur,
const std::string & szNom1,
const std::string & szNom2)
00366 {
00367
int x =
FENETRE_LARGEUR / 2 - 128;
00368
int y =
FENETRE_HAUTEUR / 2;
00369
00370 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00371 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 + 32,
"COMMENCER PARTIE");
00372 m_Font.
Print (
x,
y + 16 * 3 - 48,
"Nombre de joueurs : %d", m_uiNombreJoueur);
00373 m_Font.
Print (
x,
y + 16 * 2 - 48,
"Joueur 1 : %s", szNom1.c_str ());
00374
if (m_uiNombreJoueur == 2)
00375 m_Font.
Print (
x,
y + 16 * 1 - 48,
"Joueur 2 : %s", szNom2.c_str ());
00376 m_Font.
Print (
FONT_POSITION_CENTRE,
y + 16 * 0 - 48,
"Commencer");
00377 m_Font.
Print (
x - 32,
y + 16 * (uiCurseur - 1) - 48,
">");
00378 }
00379
00380
00381 void CAffichage::MenuScore ()
00382 {
00383
00384
CXMLScore XMLScore;
00385 XMLScore.
Charger (
FICHIER_XML_SCORE);
00386
const std::multiset<SScore, std::greater<SScore> > & ListeScores = XMLScore.
GetListeScores ();
00387
00388 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00389 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 + 32,
"HIGH SCORES");
00390
00391
00392 std::multiset<SScore, std::greater<SScore> >::const_iterator it_set;
00393
int i = 0;
00394
for (it_set = ListeScores.begin (); it_set != ListeScores.end () && i < 10; it_set++, i++)
00395 {
00396
unsigned int uiScoreTotal = 0;
00397
00398 std::ostringstream m_szLigne;
00399
for (std::list<SJoueur>::const_iterator it_list = it_set->m_Joueur.begin (); it_list != it_set->m_Joueur.end (); it_list++)
00400 {
00401 m_szLigne << it_list->m_szNom;
00402 m_szLigne <<
":";
00403 m_szLigne << it_list->m_uiScore;
00404 m_szLigne <<
" ";
00405 uiScoreTotal += it_list->m_uiScore;
00406 }
00407 m_Font.
Couleur (1.f, 1.f, 1.f);
00408 m_Font.
Print (
FENETRE_LARGEUR * 3 / 8,
FENETRE_HAUTEUR / 2 - 16 * i, m_szLigne.str ().c_str ());
00409
00410 std::ostringstream m_szTotal;
00411 m_szTotal << uiScoreTotal;
00412 m_Font.
Couleur (0.f, 1.f, 0.f);
00413 m_Font.
Print (
FENETRE_LARGEUR * 2 / 8,
FENETRE_HAUTEUR / 2 - 16 * i, m_szTotal.str ().c_str ());
00414 }
00415 }
00416
00417
00418 void CAffichage::MenuChargement ()
00419 {
00420 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 + 32,
"CHARGEMENT ...");
00421 m_iFpsNiveau = 0;
00422 }
00423
00424
00425 void CAffichage::MenuChargementErreur ()
00426 {
00427 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 + 32,
"ERREUR");
00428 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 + 0,
"Le fichier './data/niveau.xml' n'est pas valide");
00429 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 16,
"Consulter le fichier 'stderr.txt' pour plus d'informations");
00430 }
00431
00432
00433 void CAffichage::MenuImageFond (
CTexture *pTexture)
const
00434
{
00435 glEnable (GL_TEXTURE_2D);
00436
00437 pTexture->
Bind ();
00438
00439 glBegin (GL_QUADS);
00440 glColor3f (1.0f, 1.0f, 1.0f);
00441 glTexCoord2f (0, 0); glVertex2f (0, 0);
00442 glTexCoord2f (1, 0); glVertex2f (
FENETRE_LARGEUR, 0);
00443 glTexCoord2f (1, 1); glVertex2f (
FENETRE_LARGEUR,
FENETRE_HAUTEUR);
00444 glTexCoord2f (0, 1); glVertex2f (0,
FENETRE_HAUTEUR);
00445 glEnd ();
00446 }
00447
00448
00449
00450
00451
00452
00453
void CAffichage::Fps ()
00454 {
00455
if (m_iFpsNiveau == 0)
00456 m_JeuTimer.
Init ();
00457
00458 m_iFpsNiveau++;
00459 m_iFpsCompte++;
00460
if (m_FpsTimer.
GetTime () > 1.0f)
00461 {
00462 m_FpsTimer.
Init ();
00463 m_iFps = m_iFpsCompte;
00464 m_iFpsCompte = 0;
00465 }
00466
00467 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00468 m_Font.
Print (0, 16,
"%d FPS", m_iFps);
00469 m_Font.
Print (0, 0,
"Moyenne : %4.0f FPS", m_iFpsNiveau / m_JeuTimer.
GetTime ());
00470 }
00471
00472
00473 void CAffichage::HUDDefaite (
unsigned int uiJoueur1,
const char* szJoueur1,
unsigned int uiJoueur2,
const char* szJoueur2)
00474 {
00475 Fps ();
00476
00477 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00478 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 + 32,
"DEFAITE ...");
00479 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 0,
"Les forces de l'ignoble Zglu vous ont vaincu");
00480 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 32,
"%s : %d - %s : %d", szJoueur1, uiJoueur1, szJoueur2, uiJoueur2);
00481 m_Font.
Couleur (0.0f, 1.0f, 0.0f);
00482 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 48,
"Total : %d points", uiJoueur1 + uiJoueur2);
00483 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00484 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 96,
"Appuyer sur 'echap' pour retourner au menu");
00485 }
00486
00487
00488 void CAffichage::HUDDefaite (
unsigned int uiJoueur1,
const char* szJoueur1)
00489 {
00490 Fps ();
00491
00492 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00493 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 + 32,
"DEFAITE ...");
00494 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 0,
"Les forces de l'ignoble Zglu vous ont vaincu");
00495 m_Font.
Couleur (0.0f, 1.0f, 0.0f);
00496 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 48,
"%s : %d points", szJoueur1, uiJoueur1);
00497 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00498 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 96,
"Appuyer sur 'echap' pour retourner au menu");
00499 }
00500
00501
00502 void CAffichage::HUDVictoire (
unsigned int uiJoueur1,
const char* szJoueur1,
unsigned int uiJoueur2,
const char* szJoueur2)
00503 {
00504 Fps ();
00505
00506 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00507 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 + 32,
"VICTOIRE !");
00508 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 0,
"Vous avez vaincu les forces de l'ignoble Zglu");
00509 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 32,
"%s : %d - %s : %d", szJoueur1, uiJoueur1, szJoueur2, uiJoueur2);
00510 m_Font.
Couleur (0.0f, 1.0f, 0.0f);
00511 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 48,
"Total : %d points", uiJoueur1 + uiJoueur2);
00512 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00513 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 96,
"Appuyer sur 'echap' pour retourner au menu");
00514 }
00515
00516
00517 void CAffichage::HUDVictoire (
unsigned int uiJoueur1,
const char* szJoueur1)
00518 {
00519 Fps ();
00520
00521 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00522 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 + 32,
"VICTOIRE !");
00523 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 0,
"Vous avez vaincu les forces de l'ignoble Zglu");
00524 m_Font.
Couleur (0.0f, 1.0f, 0.0f);
00525 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 48,
"%s : %d points", szJoueur1, uiJoueur1);
00526 m_Font.
Couleur (1.0f, 1.0f, 1.0f);
00527 m_Font.
Print (
FONT_POSITION_CENTRE,
FENETRE_HAUTEUR / 2 - 96,
"Appuyer sur 'echap' pour retourner au menu");
00528 }
00529
00530
00531 void CAffichage::HUDJeu (
unsigned int uiNiveau,
unsigned int uiJoueur1,
const char* szJoueur1,
unsigned int uiJoueur2,
const char* szJoueur2)
00532 {
00533
int iChiffres = 2;
00534
int iScore = uiJoueur2;
00535
while (iScore /= 10)
00536 iChiffres++;
00537
00538 Fps ();
00539
00540 m_Font.
Couleur (0.0f, 1.0f, 0.0f);
00541 m_Font.
Print (
FONT_POSITION_CENTRE_HAUT,
"Niveau %d - Scores : %d", uiNiveau + 1, uiJoueur1 + uiJoueur2);
00542 m_Font.
Couleur (0.5f, 0.5f, 1.0f);
00543 m_Font.
Print (0,
FENETRE_HAUTEUR - 16,
"%s", szJoueur1);
00544 m_Font.
Print (0,
FENETRE_HAUTEUR - 32,
"%d", uiJoueur1);
00545 m_Font.
Couleur (1.0f, 0.5f, 0.5f);
00546 m_Font.
Print (
FENETRE_LARGEUR - 12 * (strlen (szJoueur2) + 1),
FENETRE_HAUTEUR - 16,
"%s", szJoueur2);
00547 m_Font.
Print (
FENETRE_LARGEUR - 12 * iChiffres,
FENETRE_HAUTEUR - 32,
"%d", uiJoueur2);
00548 }
00549
00550
00551 void CAffichage::HUDJeu (
unsigned int uiNiveau,
unsigned int uiJoueur1,
const char* szJoueur1)
00552 {
00553 Fps ();
00554
00555 m_Font.
Couleur (0.0f, 1.0f, 0.0f);
00556 m_Font.
Print (
FONT_POSITION_CENTRE_HAUT,
"Niveau %d", uiNiveau + 1);
00557 m_Font.
Couleur (0.5f, 0.5f, 1.0f);
00558 m_Font.
Print (0,
FENETRE_HAUTEUR - 16,
"%s", szJoueur1);
00559 m_Font.
Print (0,
FENETRE_HAUTEUR - 32,
"%d", uiJoueur1);
00560 }
00561
00562
00563
00564
00565
00566
00567 void CAffichage::Debut ()
const
00568
{
00569
00570 glClear (GL_COLOR_BUFFER_BIT);
00571
00572 glLoadIdentity ();
00573
00574
00575 glMatrixMode (GL_PROJECTION);
00576 glLoadIdentity ();
00577 glOrtho (0,
FENETRE_LARGEUR, 0,
FENETRE_HAUTEUR, -1, 1);
00578 glMatrixMode (GL_MODELVIEW);
00579 glLoadIdentity ();
00580 }
00581
00582 void CAffichage::Fin ()
const
00583
{
00584
00585
00586
CWindowSDL::Instance ()->
Swap ();
00587 }
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636