Space Sheep Xtreme Turbo Penguin Edition
GameView.h
Aller à la documentation de ce fichier.
1 #ifndef GAME_VIEW_H
2 #define GAME_VIEW_H
3 
11 #include <SFML/Graphics.hpp>
12 #include <SFML/Audio.hpp>
13 #include <map>
14 #include <vector>
15 #include "GraphicElement.h"
16 #include "MovableElement.h"
17 #include "TypeEnnemi.h"
18 #include "constantes.h"
19 #include "Interface.h"
20 
21 class GameModel;
22 
30 class GameView {
31  private :
32  int my_w, my_h;
33 
34  sf::RenderWindow *my_window;
35  sf::Image *my_background_image;
36  sf::Image *my_background_parallax;
37  sf::Image *my_ship_image;
38  sf::Image *my_shoot_image;
39  sf::Image *my_boom_image;
40  sf::Image *my_revive_image;
41  sf::Image *my_bonus_image;
42  std::map<TypeEnnemi* const, sf::Image*> my_ennemies_images; //Map qui contient les images des ennemis en fonction de leur type
43  std::map<TypeTir* const, sf::Image*> my_tirs_images;
44 
45  GraphicElement my_background_sprite, my_background_sprite2;
46  GraphicElement my_background_parallax_sprite, my_background_parallax_sprite2;
47 
48  Interface my_hud;
49  std::string my_strings[NB_STRINGS];
50  int my_langue;
51 
52  //map qui contient tout les sprites;
53  std::map<MovableElement * const, GraphicElement *> my_elementToGraphicElement;
54 
55  //sons
56  sf::SoundBuffer *my_titlethemeBuffer;
57  sf::SoundBuffer *my_deathmonsterBuffer;
58  sf::SoundBuffer *my_deathbossBuffer;
59  sf::SoundBuffer *my_nextLevelBuffer;
60  sf::SoundBuffer *my_gameoverBuffer;
61  sf::SoundBuffer *my_shotBuffer;
62 
63  sf::Music my_maintheme;
64  sf::Sound my_titletheme;
65  sf::Sound my_deathmonster;
66  sf::Sound my_deathboss;
67  sf::Sound my_nextLevel;
68  sf::Sound my_gameover;
69  sf::Sound my_shotsound;
70 
71  int my_soundLevel;
72  int my_soundpack;
73 
74  GameModel *my_model;
75 
76  sf::Clock my_clock; // Clock qui sert pour le tir
77 
78  public :
79 
87  GameView(int w, int h, int bpp);
88 
92  ~GameView();
93 
94 
99  void setModel(GameModel * model);
100 
101 
105  void updateLanguage();
106 
110  void updateVolume();
111 
115  void updateSound();
116 
117 
121  void bgscroll();
122 
128  void explosion(GraphicElement &elem, Ennemi* adr);
129 
130 
134  void draw();
135 
139  void Display();
140 
149  void transition(std::string text, float t);
150 
155  void synchronize();
156 
161  bool treatEvents(bool &quit);
162 
163 
167  int pause();
168 
169 
173  void intro();
174 
178  int menu();
179 
186  void options(bool &quit, int &difficulty, int &initialLives);
187 
193  void viewHighscores(bool &quit);
194 
198  void askName();
199 
200 
201 };
202 
203 
204 #endif