Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

singleton pacman et board début correction #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion IMACMan/include/Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ class Board {
void displayLives(Pacman *p);
};

Board* Board::board = nullptr;
//Board* Board::board = nullptr;
#endif //IMACGL_BOARD_H
3 changes: 2 additions & 1 deletion IMACMan/include/Pacman.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ class Pacman : public Personnage{

};

Pacman* Pacman::pacman = nullptr;
//Pacman* Pacman::pacman = nullptr;

#endif //IMACGL_PACMAN_H
2 changes: 1 addition & 1 deletion IMACMan/src/Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int Board::getTime() const {
return time;
}

static Board* Board::getInstBoard(){
Board* Board::getInstBoard(){
if (!board)
board = new Board(9,500);
return board;
Expand Down
9 changes: 8 additions & 1 deletion IMACMan/src/Pacman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int Pacman::getPoints(){
}

Pacman *Pacman::getInstPac() {
if(!pacman){
if(!pacman){
pacman = new Pacman();
}
return pacman;
Expand Down Expand Up @@ -124,6 +124,13 @@ int Pacman::keyPressed(glimac::SDLWindowManager windowManager) {
if(windowManager.isKeyPressed(SDLK_LEFT)){
return 4;
}

if(windowManager.isKeyPressed(SDLK_p)){
std::cout << "Pause" << std::endl;
getchar();
}


return 0;
}

Expand Down