SpaceInvaders  1.0
Ebauche d'une réalisation d'un space invader
myconst_ac_v2.h
1 #pragma once
2 
12 #include "MyType_AC.h"
13 
14 
15 
16 namespace SpaceInvader_AC
17 {
18  //Constantes de couleur
22  const std::string KReset ("0");
23 
27  const std::string KNoir ("30");
31  const std::string KRouge ("31");
32 
36  const std::string KVert ("32");
37 
41  const std::string KJaune ("33");
42 
46  const std::string KBleu ("34");
47 
51  const std::string KMAgenta ("35");
52 
56  const std::string KCyan ("36");
57 
58  // Constantes pour les touches
62  const char KRight = 'x'; // déplacement vers la droite
63 
67  const char KLeft = 'w'; // Déplacement vers la gauche
68 
72  const char KShoot = ' '; // Lancer de torpille
73 
74  // Constantes liées à l'envahisseur
78  const std::string KInvadersColor (KJaune); // Couleur de l'envahisseur
79 
83  const char KInsideInvader = 'W'; // caractèrere formant l'envahisseur
84 
88  const char KMissile = 'T'; // missile
89 
93  const unsigned KInvadersSize = 5; // nombre de caractères qui forment l'envahisseur
94 
98  const unsigned KMissileRatio = 2; // nombre de fois où l'envahisseur tire un missile par rapport à son déplacement
99 
100  // Constantes liées au joueur
104  const std::string KMyColor (KVert); // Ma couleur
105 
109  const char KInsideMe = 'A'; // caractèrere formant mon vaisseau
110 
114  const char KTorpedo = '|'; // caractèrere formant ma torpille
115 
119  const unsigned KMySize = 4; // nombre de caractères qui forment mon vaisseau
120 
121 
125  const unsigned KRatioMeInvaders = 4; // Nombre de fois où c'est le tour du joueur pour un tour de l'envahisseur
126 
127 
128  // Constantes liées à l'eapace (l'écran)
132  const char KEmpty = ' '; // case vide de l'écran
136  const unsigned KSizeLine = 10; // Nombre de lignes de l'écran (de l'espace)
137 
141  const unsigned KSizeSpace = 10; // Nombre de colonnes de l'écran (de l'espace)
142 
146  const unsigned KBegInvader = 0; // Numéro de colonne où commence l'envahisseur
147 
151  const unsigned KBegMe = KSizeLine / 2; // Numéro de colonne où commence le joueur
152 
153  const std::vector <std::string> KVParamChar {"KInsideInvader", "KMissile", "KInsideMe", "KTorpedo", "KRight", "KLeft", "KShoot", "KEmpty"};
154  const std::vector <std::string> KVParamString {"KMyColor", "KInvadersColor"};
155  const std::vector <std::string> KVParamUnsigned {"KSizeLine", "KSizeSpace", "KBegInvader", "KInvadersSize", "KMissileRatio", "KMySize", "KRatioMeInvaders", "KBegMe"};
156 
157  const std::map <std::string, char> MapParamCharDefault
158  {
159  {KVParamChar [0], 'W'}, //KInsideInvader
160  {KVParamChar [1], 'T'}, //KMissile
161  {KVParamChar [2], 'A'}, //KInsideMe
162  {KVParamChar [3], '|'}, //KTorpedo
163  {KVParamChar [4], 'x'}, //KRight
164  {KVParamChar [5], 'w'}, //KLeft
165  {KVParamChar [6], ' '}, //KShoot
166  {KVParamChar [7], ' '} //KEmpty
167  };
168 
169  const std::map <std::string, unsigned> MapParamUnsignedDefault
170  {
171  {KVParamUnsigned [0], 10}, //KSizeLine
172  {KVParamUnsigned [1], 10}, //KSizeSpace
173  {KVParamUnsigned [2], 0}, //KBegInvader
174  {KVParamUnsigned [3], 2}, //KMissileRatio
175  {KVParamUnsigned [4], 5}, //KRatioMeInvaders
176  {KVParamUnsigned [5], 4}, //KMySize
177  {KVParamUnsigned [6], 4}, //KRatioMeInvaders
178  {KVParamUnsigned [7], 1} //KBegMe
179  };
180 
181 
182  const std::map <std::string, std::string> MapParamStringDefault
183  {
184  {KVParamString [0], "KVert"}, //KMyColor
185  {KVParamString [1], "KJaune"} //KInvadersColor
186  };
187 
188  const SpaceInvader_AC::CMyParam KMyParamsDefault
189  {
190  {
191  {KVParamChar [0], 'W'}, //KInsideInvader
192  {KVParamChar [1], 'T'}, //KMissile
193  {KVParamChar [2], 'A'}, //KInsideMe
194  {KVParamChar [3], '|'}, //KTorpedo
195  {KVParamChar [4], 'x'}, //KRight
196  {KVParamChar [5], 'w'}, //KLeft
197  {KVParamChar [6], ' '}, //KShoot
198  {KVParamChar [7], ' '} //KEmpty
199  },
200  {
201  {KVParamUnsigned [0], 10}, //KSizeLine
202  {KVParamUnsigned [1], 10}, //KSizeSpace
203  {KVParamUnsigned [2], 0}, //KBegInvader
204  {KVParamUnsigned [3], 2}, //KMissileRatio
205  {KVParamUnsigned [4], 5}, //KRatioMeInvaders
206  {KVParamUnsigned [5], 4}, //KMySize
207  {KVParamUnsigned [6], 4}, //KRatioMeInvaders
208  {KVParamUnsigned [7], 1} //KBegMe
209  },
210  {
211  {KVParamString [0], "KVert"}, //KMyColor
212  {KVParamString [1], "KJaune"} //KInvadersColor
213  }
214  };
215 
219  const std::string KEmptyLine (KMyParamsDefault.MapParamUnsigned.at("KSizeLine"), KEmpty); // Une ligne vide de la matrice
220 }//namespace
const std::string KNoir("30")
Alias mettant en noir la couleur du texte du terminal.
const std::string KBleu("34")
Alias mettant en bleu la couleur du texte du terminal.
const unsigned KMySize
Nombre de caractères qui forment mon vaisseau.
Definition: MyConst_AC.h:115
const char KEmpty
Alias vers une case vide à l&#39;écran.
Definition: MyConst_AC.h:128
const std::string KEmptyLine(KSizeLine, KEmpty)
Alias vers une ligne vide de l&#39;esapce.
const char KTorpedo
Caractèrere formant ma torpille.
Definition: MyConst_AC.h:110
const unsigned KSizeSpace
Nombre de colonnes de l&#39;écran (de l&#39;espace).
Definition: MyConst_AC.h:137
const std::string KMAgenta("35")
Alias mettant en mangenta la couleur du texte du terminal.
const unsigned KRatioMeInvaders
Nombre de fois où c&#39;est le tour du joueur pour un tour de l&#39;envahisseur.
Definition: MyConst_AC.h:121
const std::string KInvadersColor(KJaune)
Couleur de l&#39;envahisseur.
const unsigned KBegMe
Numéro de colonne où commence le joueur.
Definition: MyConst_AC.h:147
const char KInsideMe
Caractèrere formant mon vaisseau.
Definition: MyConst_AC.h:105
Fichier décrivant l&#39;ensemble des alias vers les types utilisés dans le jeu.
const char KInsideInvader
Caractèrere formant l&#39;envahisseur.
Definition: MyConst_AC.h:79
const std::string KVert("32")
Alias mettant en vert la couleur du texte du terminal.
const unsigned KSizeLine
Nombre de lignes de l&#39;écran (de l&#39;espace).
Definition: MyConst_AC.h:132
const std::string KReset("0")
Alias remetant la couleur du texte du terminal à sa valeur par défaut.
Definition: myconst_ac_v2.h:16
const std::string KMyColor(KVert)
Couleur liée à mes objets (vaisseaux et tropilles).
const char KShoot
Alias vers la touche servant à lancer une torpille.
Definition: MyConst_AC.h:68
const char KMissile
Caractèrere formant le missile.
Definition: MyConst_AC.h:84
const unsigned KInvadersSize
Nombre de caractères qui forment l&#39;envahisseur.
Definition: MyConst_AC.h:89
const char KLeft
Alias vers la touche servant à se déplacer à gauche.
Definition: MyConst_AC.h:63
const std::string KRouge("31")
Alias mettant en rouge la couleur du texte du terminal.
const char KRight
Alias vers la touche servant à se déplacer à droite.
Definition: MyConst_AC.h:58
const std::string KJaune("33")
Alias mettant en jaune la couleur du texte du terminal.
const unsigned KBegInvader
Numéro de colonne où commence l&#39;envahisseur.
Definition: MyConst_AC.h:142
const std::string KCyan("36")
Alias mettant en cyan la couleur du texte du terminal.
const unsigned KMissileRatio
Nombre de fois où l&#39;envahisseur tire un missile par rapport à son déplacement.
Definition: MyConst_AC.h:94