-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrolleurjeu.cpp
More file actions
33 lines (29 loc) · 866 Bytes
/
controlleurjeu.cpp
File metadata and controls
33 lines (29 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "controlleurjeu.h"
ControlleurJeu::ControlleurJeu(Partie* part)
{
InitControlleur(part);
}
void ControlleurJeu::InitControlleur(Partie *part){
m_Partie = part;
m_Affichage = new AffichageJeu(part, m_Partie->getCarte()->getTailleX(),m_Partie->getCarte()->getTailleY());
m_Affichage->registerListener(this);
m_Affichage->afficherMessage("Initialisation controlleur...");
while(!m_Affichage->renduIteration()){
}
}
void ControlleurJeu::keyPressed(int key){
switch ( key ){
case GLFW_KEY_DOWN:
m_Partie->deplacer(0, -1);
break;
case GLFW_KEY_UP:
m_Partie->deplacer(0, +1);
break;
case GLFW_KEY_LEFT:
m_Partie->deplacer(-1, 0);
break;
case GLFW_KEY_RIGHT:
m_Partie->deplacer(+1, 0);
break;
}
}