Debian Codegraph @

src/game.h

raw symbols SCIP
1 // (_||_/
2 // ( ) Game class
3 // ( o 0 )
4 //-OOO°--(_)---°OOO---------------------------------------
5 // Copyright (C) 2006 By Dominique Roux-Serret
6 // .OOOo oOOO. [email protected]
7 //-( )------( )---------------------------------------
8 // ( ( ) / Copyright (C) 2023 By Johnny Jazeix
9 // (_) (_/ [email protected]
10
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 or version 3 of the License.
14
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19
20 // You should have received a copy of the GNU General Public License along
21 // with this program; if not, write to the Free Software Foundation, Inc.,
22 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
24 #ifndef GAME_DOM_
25 #define GAME_DOM_
26
27 #include "preference.h"
28 #include "loco.h"
29
30 class Audio;
31 class Menu;
32 class Gamepad;
33
34 /*** Définition de la class ***/
35 /******************************/
36 class Game
37 {
38 public:
39 explicit Game(Audio &sounds, Gamepad &gamepad);
40 ~Game() = default;
41
42 void setMenu(Menu *menu) { m_menu = menu; }
43 /*** Fonctions ***/
44 /*****************/
45 eMenu SDLMain(); // Boucle principale
46 bool Load(int NivN); // Charge un tableau
47 bool DrawLevel(int NivN); // Dessine le niveau
48
49 void TourneFleche(); // Fait tourner la fleche d'un simple clic.
50 void BufTouche(int Touche); // Met une nouvelle touche dans le buffet
51 int TestFleche(int Haut, int Bas, int Gauche, int Droite); // Test la direction de sortie de la fleche
52 void AfficheEcran(); // Fait l'affichage d'un ecran de jeu
53
54 private:
55 /*** Variables ***/
56 bool Pause { false }; // Si en pose
57
58 long DureeJeu { 0 }; // Horloge de durée du jeu
59
60 int Key { 0 }; // Mémorise la touche enfoncée
61 int Touche[4]; // Direction demandée
62 int T[LT * HT]; // Pointe sur le tableau
63
64 bool Help { true }; // Si doit affiche les fleches d'aide
65
66 Audio &m_sounds;
67 Gamepad &m_gamepad;
68 Menu *m_menu { nullptr };
69
70 Loco Lo; // Gère la locomotive
71 };
72 #endif