1 /*****************************************************************************
2  *
3  *  Copyright (C) 2003 C�dric Br�gardis <cedric.bregardis@free.fr>
4  *
5  *  This file is part of BRIQUOLO
6  *
7  *  BRIQUOLO is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  BRIQUOLO is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with BRIQUOLO; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  *****************************************************************************/
22 #ifndef _TABLEAUJEU
23 #define _TABLEAUJEU
24 
25 #include <set>
26 #include "ElementTableau.h"
27 #include "Balle.h"
28 #include "Plateau.h"
29 #include "Bonus.h"
30 #include "Generateur.h"
31 #include "TableauBase.h"
32 #include <MOGL_Temporisation.h>
33 
34 using namespace std;
35 
36 class TableauJeu: public TableauBase
37 {
38   // **** Types locaux � la classe ****
39   public:
40     typedef set<Balle *> Set_Balle;
41     typedef set<Plateau *> Set_Plateau;
42     typedef set<Bonus *> Set_Bonus;
43     typedef set<Generateur *> Set_Generateur;
44   // **********************************
45 
46   protected:
47     Set_Balle _SetBalle;
48     Set_Plateau _SetPlateau;
49     Set_Bonus _SetBonus;
50     Set_Generateur _SetGenerateur, _SetGenerateurADetruire; // Les g�n�rateur � d�truire
51     Camera * _Camera;
52 
53     const float _ProbaBonus;
54 
55     Struct_Collision _CollisionBord(Balle * p_Balle);
56     Bonus * _CreerBonus();
57     MOGL_Temporisation *  _TemporisationFinTableau;
58     MOGL_Temporisation *  _TemporisationDepartBalle;
59     bool _FinTableau;
60     bool _BallePartie;
61     int _NombreVie;
62     float _VibrationX, _VibrationY;
63     float _CummulDep;
64 
65   protected: // ACTION
66     void _OnFinTemporisation();
67     void _OnDepartBalle();
68 
69   public: //SIGNAUX
70     MOGL_Signal0 FinTableau;
71     MOGL_Signal0 FinBalle;
72 
73   public:
74     TableauJeu(MOGL_Fenetre * p_Fenetre);
75     ~TableauJeu();
76 
77     void AjouterBalle(Balle * p_Balle);
78     bool RetirerBalle(Balle * p_Balle);
79 
80     void AjouterPlateau(Plateau * p_Plateau);
81     bool RetirerPlateau(Plateau * p_Plateau);
82 
83     void DeplacerPlateaux(float p_Distance);
84     void Maj();
85 
86     void AjouterGenerateur(Generateur * p_Generateur);
87 
88     void CreerBonus(float p_X, float p_Y);
89 
90     void OnFinGenerateur(Generateur * p_Generateur);
91     Camera * GetCamera();
92     Set_ElementTableau * GetSetElementTableau();
93     Set_Balle * GetSetBalle();
94     Set_Plateau * GetSetPlateau();
95     Set_Bonus * GetSetBonus();
96     Set_Generateur * GetSetGenerateur();
97 
98     int GetNombreVie() const;
99     void SetNombreVie(int p_NombreVie);
100 
101     void DepartTableau();
102 
103     void ClavierUp(SDL_keysym * key);
104     void ClavierDown(SDL_keysym * key);
105     void DeplacementSouris(SDL_MouseMotionEvent * p_Event);
106     void BoutonSourisDown(SDL_MouseButtonEvent * p_Event);
107     void SetVibration(float pVibrationX, float pVibrationY);
108 };
109 
110 #endif
111