diff --git a/SDL#4/err.log b/SDL#4/err.log index 3d134be..56f111f 100644 --- a/SDL#4/err.log +++ b/SDL#4/err.log @@ -290,344 +290,45 @@ Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom Grass collided with Mario from bottom Grass collided with Mario from bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom -Grass collided with Mario from left +Grass collided with Mario from right bottom Grass collided with Mario from bottom Grass collided with Mario from bottom @@ -656,52 +357,24 @@ Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom Grass collided with Mario from bottom Grass collided with Mario from bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom -Grass collided with Mario from left -bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom @@ -750,8 +423,17 @@ Grass collided with Mario from right bottom Grass collided with Mario from right bottom +Grass collided with Mario from right +bottom Grass collided with Mario from bottom Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from right +bottom +Grass collided with Mario from right +bottom Grass collided with Mario from right bottom Grass collided with Mario from right @@ -857,7 +539,6 @@ Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom -green-shell collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom @@ -959,3 +640,301 @@ Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +green-shell collided with Mario from left +green-shell collided with Mario from left +green-shell collided with Mario from left +green-shell collided with Mario from left +green-shell collided with Mario from left +Grass collided with Mario from bottom +green-shell collided with Mario from left +green-shell collided with Mario from left +green-shell collided with Mario from left +green-shell collided with Mario from left +green-shell collided with Mario from left +green-shell collided with Mario from left +green-shell collided with Mario from left +green-shell collided with Mario from left +Grass collided with Mario from bottom +green-shell collided with Mario from left +Grass collided with Mario from bottom +green-shell collided with Mario from left +Grass collided with Mario from bottom +Grass collided with Mario from bottom +green-shell collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from left +bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +Grass collided with Mario from bottom +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW +mario collide with WINDOW diff --git a/SDL#4/exe b/SDL#4/exe index 666143d..da49bfa 100755 Binary files a/SDL#4/exe and b/SDL#4/exe differ diff --git a/SDL#4/main.cpp b/SDL#4/main.cpp index 346b5e4..750a7dd 100644 --- a/SDL#4/main.cpp +++ b/SDL#4/main.cpp @@ -2,7 +2,6 @@ // On cree un sdl-toplevel statique static xManager *mgr = NULL; -static bool running = true; static xMarioMario *mario = NULL; @@ -90,7 +89,7 @@ int main(int argc, char* argv[]) { - /* [n-1] Boucle infinie + /* [n-2] Boucle infinie =========================================================*/ // Gestion des evenements @@ -110,7 +109,8 @@ int main(int argc, char* argv[]) { // Boucle de traitement mgr->update(); mgr->manageFps(FPS); - while(running){ + mgr->state = 0; + while(mgr->state==0){ // Gestion des evenements @@ -150,7 +150,16 @@ int main(int argc, char* argv[]) { } - + /* [n-1] Gestion de l'arret + =========================================================*/ + if( mgr->state == 2 ){ + mgr->clearAll(); // On vire tout + mgr->setBackground(0, 0, 0); // Fond noir + mgr->setImage("src/game_over.jpg"); // Image GAME OVER + + mgr->update(); // Mise a jour du rendu + sleep(3); // Attente 3 sec + } @@ -177,7 +186,7 @@ int main(int argc, char* argv[]) { */ void quitEventHandler(SDL_Event *e){ cout << "Exiting program" << endl; - running = false; + mgr->state = 1; } diff --git a/SDL#4/main.o b/SDL#4/main.o index c93d08e..53d1b5e 100644 Binary files a/SDL#4/main.o and b/SDL#4/main.o differ diff --git a/SDL#4/src/game_over.jpg b/SDL#4/src/game_over.jpg new file mode 100644 index 0000000..5090e1e Binary files /dev/null and b/SDL#4/src/game_over.jpg differ diff --git a/SDL#4/todo.md b/SDL#4/todo.md index 8136d78..6eb3958 100644 --- a/SDL#4/todo.md +++ b/SDL#4/todo.md @@ -1,15 +1,15 @@ A FAIRE ======= -- [ ] Erreur accrochage quand saut sur un coin - [ ] Verifier toute la trajectoire pour move() - [x][ ] Gestion du saut unique ou double (limitation) EN COURS ======== -- [...] Gestion sprites de mario en fonction mouvement +- [ ] Erreur accrochage quand saut sur un coin FAIT ==== +- [x] Game Over quand on tombe - [x] Gestion des briques cassables quand collision - [?] Liberation memoire car lag - [x] Gestion du nombre de saut avant de casser Brick ou MysteryBloc diff --git a/SDL#4/xMario/xMarioMario.cpp b/SDL#4/xMario/xMarioMario.cpp index 60984b5..f03cb89 100644 --- a/SDL#4/xMario/xMarioMario.cpp +++ b/SDL#4/xMario/xMarioMario.cpp @@ -57,6 +57,12 @@ void xMarioMario::moveFromVelocity(){ after = this->move(_velocity[0], _velocity[1]); + + if( _velocity[0] != after[2] ) + cout << "col. on X : " << _velocity[0] << endl; + if( _velocity[1] != after[3] ) + cout << "col. on Y : " << _velocity[1] << endl; + /* (2) On modifie la velocite en fonction des collisions */ _velocity[0] = (double) after[2]; _velocity[1] = (double) after[3]; @@ -93,8 +99,6 @@ void xMarioMario::moveFromVelocity(){ // TROUBLE if( !this->onFloor() ) _velocity[1] += _gravity; - - cout << "ON FLOOR: " << this->onFloor() << endl; // TROUBLE // TROUBLE // TROUBLE diff --git a/SDL#4/xSDL/xManager.cpp b/SDL#4/xSDL/xManager.cpp index b26d55c..4396059 100644 --- a/SDL#4/xSDL/xManager.cpp +++ b/SDL#4/xSDL/xManager.cpp @@ -242,7 +242,11 @@ bool xManager::hit(xSprite* current, int movex, int movey){ || (a.x+a.w > _winrect.x+_winrect.w ) // Inclus a gauche || (a.y < _winrect.y ) // Inclus en haut || (a.y+a.h > _winrect.y+_winrect.h ) // Inclus en bas - ){ + ){ + // Si on tombe, on meurt + if( a.y+a.h > _winrect.y+_winrect.h ) + state = 2; + cerr << _indexes[xIndex] << " collide with WINDOW" << endl; _mutex_hit.unlock(); return true; @@ -393,6 +397,16 @@ void xManager::pull(xSprite* sprite){ +/* [CLEARALL] Supprime toutes les sprites +=========================================================*/ +void xManager::clearAll(){ + _indexes.erase( _indexes.begin(), _indexes.end() ); + _sprites.erase( _sprites.begin(), _sprites.end() ); +} + + + + /* [MANAGEFTP] Gestion de la vitesse de boucle =========================================================*/ diff --git a/SDL#4/xSDL/xManager.h b/SDL#4/xSDL/xManager.h index 2c908f4..0fb26ed 100644 --- a/SDL#4/xSDL/xManager.h +++ b/SDL#4/xSDL/xManager.h @@ -22,6 +22,7 @@ void push(string index, xSprite* sprite); void pull(string index); void pull(xSprite *sprite); + void clearAll(); // Supprime toutes les sprites void update(); @@ -33,6 +34,14 @@ void manageEvents(SDL_Event* event); + + // Boucle infinie + int state; + // 0 -> Boucle infinie + // 1 -> Arret jeu + // 2 -> mort + + // DEBUG void debug(); @@ -65,8 +74,6 @@ mutex _mutex_pull; mutex _mutex_update; mutex _mutex_hit; - - // DEBUG SDL_Rect _debug;