Ver código fonte

Import old source files

DricomDragon 4 anos atrás
pai
commit
8f877cf119

+ 99 - 0
Headers/Point.cpp

@@ -0,0 +1,99 @@
+#include "Point.h"
+
+Point::Point(int rayon,Uint32 couleur)
+:m_rayon(rayon)
+{
+    m_pixel = SDL_CreateRGBSurface(SDL_HWSURFACE, 1, 1, 16, 0, 0, 0, 0);
+    SDL_FillRect(m_pixel,NULL,couleur);
+    if (!m_pixel)
+    {
+        std::cout << "Impossible de créer la surface dans l'objet Point " << SDL_GetError() << std::endl;
+    }
+}///Constructeur standard
+
+Point::Point(int rayon,Uint32 couleur,int transparence)
+:m_rayon(rayon)
+{
+    m_pixel = SDL_CreateRGBSurface(SDL_HWSURFACE, 1, 1, 16, 0, 0, 0, 0);
+    SDL_FillRect(m_pixel,NULL,couleur);
+    if (!m_pixel)
+    {
+        std::cout << "Impossible de créer la surface dans l'objet Point " << SDL_GetError() << std::endl;
+    }
+}///Constructeur +transparence
+
+Point::~Point()
+{
+    SDL_FreeSurface(m_pixel);
+    m_pixel=0;
+    std::cout << "Destruction du point effective. " << std::endl;
+}///Destructeur
+
+int Point::getRayon()
+{
+    return m_rayon;
+}///getRayon
+
+void Point::afficherPoint(SDL_Surface *screen,int const x, int const y)
+{
+    int distance(0);
+    SDL_Rect position;
+    for (int i(x-m_rayon); i<=x+m_rayon; i++)
+    {
+        for (int j(y-m_rayon); j<=y+m_rayon; j++)
+        {
+            distance = pow(i-x,2)+pow(j-y,2);
+            if (distance <= pow(m_rayon,2))
+            {
+                position.x=i;
+                position.y=j;
+                SDL_BlitSurface(m_pixel, 0, screen, &position);
+            }//test blit
+        }//for j
+    }//for i
+}///afficherPoint
+
+SDL_Surface* createPoint(int rayon,Uint32 couleur)
+{
+    return createCircle(rayon,couleur,0);
+}///createPoint
+
+
+SDL_Surface* createCircle(int rayOut,Uint32 couleur,int rayIn)
+{
+	// [1] Création des composants
+    int diametre(rayOut*2);
+    SDL_Surface* point = SDL_CreateRGBSurface(SDL_HWSURFACE, diametre, diametre, 16, 0, 0, 0, 0);
+    SDL_Surface* pixel = SDL_CreateRGBSurface(SDL_HWSURFACE, 1, 1, 16, 0, 0, 0, 0);
+    SDL_FillRect(pixel,NULL,couleur);
+
+    int distance(0);
+    int ext(rayOut*rayOut);
+	int ins(rayIn*rayIn);
+    SDL_Rect pos={0,0,0,0};
+	int x;
+	int y;
+
+    // [2] Traçage du cercle
+    for (x=-rayOut; x<rayOut; x++)
+    {
+        for (y=-rayOut; y<rayOut; y++)
+        {
+            distance = y*y+x*x;
+            if (distance <= ext && distance >= ins)
+            {
+				pos.x=x+rayOut;
+				pos.y=y+rayOut;
+                SDL_BlitSurface(pixel, 0, point, &pos);
+            }//test blit
+        }//for j
+    }//for i
+
+    // [3] Traitement transparence
+    SDL_SetColorKey(point,SDL_SRCCOLORKEY,SDL_MapRGB(point->format,0,0,0));
+
+    // [4] Renvoi
+    SDL_FreeSurface(pixel);
+    return point;
+
+}///createCircle

+ 47 - 0
Headers/Point.h

@@ -0,0 +1,47 @@
+#ifndef POINT_H_INCLUDED
+#define POINT_H_INCLUDED
+
+///Modifié le: 15/10/2013
+///Objet: fonction createPoint débuggée, new fonction createCircle
+///à faire:
+
+#include <iostream>
+#include <SDL.h>
+#include <cmath>
+
+/*
+===La classe Point===
+    +Définition:
+        La classe Point permet de créer un  point.
+    +Fonctions:
+        -Constructeur standard:
+            Ne prend que le rayon et la couleur en paramètre, mesure en nb de pixels.
+        -Constructeur amélioré:
+            Permet de définir en plus du rayon et de la couleur
+            le coefficient de transparence. (0=visible à 255=invsible)
+        -getRayon:
+            Permet d'obtenir le rayon.
+
+*/
+
+class Point
+{
+    public:
+    Point(int rayon,Uint32 couleur);
+    Point(int rayon,Uint32 couleur,int transparence);
+    ~Point();
+    int getRayon();
+    void afficherPoint(SDL_Surface *screen,int const x, int const y);
+
+    private:
+    //Attributs standards:
+    int const m_rayon;
+
+    //Attributs SDL:
+    SDL_Surface *m_pixel;
+};
+
+SDL_Surface* createPoint(int rayon,Uint32 couleur);
+SDL_Surface* createCircle(int rayOut,Uint32 couleur,int rayIn);
+
+#endif // POINT_H_INCLUDED

+ 234 - 0
Headers/Vecteur.cpp

@@ -0,0 +1,234 @@
+#include "Vecteur.h"
+
+Vecteur::Vecteur() : m_x(0.0), m_y(0.0), m_z(0.0)
+{
+
+}
+Vecteur::Vecteur(float x, float y, float z) : m_x(x), m_y(y), m_z(z)
+{
+
+}
+Vecteur::Vecteur(const Vecteur &vecteur) : m_x(vecteur.getX()), m_y(vecteur.getY()), m_z(vecteur.getZ())
+{
+
+}
+Vecteur::~Vecteur()
+{
+
+}
+float Vecteur::getX() const
+{
+    return m_x;
+}
+
+float Vecteur::getY() const
+{
+    return m_y;
+}
+
+float Vecteur::getZ() const
+{
+    return m_z;
+}
+
+
+// Setters
+
+void Vecteur::setVecteur(float x, float y, float z)
+{
+    m_x = x;
+    m_y = y;
+    m_z = z;
+}
+
+void Vecteur::setX(float x)
+{
+    m_x = x;
+}
+
+void Vecteur::setY(float y)
+{
+    m_y = y;
+}
+
+void Vecteur::setZ(float z)
+{
+    m_z = z;
+}
+void Vecteur::normaliser()
+{
+    // La fonction sqrt() permet de trouver la racine carré d'un nombre
+
+    float longueur (sqrt(m_x * m_x + m_y * m_y + m_z * m_z));
+
+
+    // Normalisation du vecteur
+
+    if(longueur != 0.0)
+    {
+        m_x /= longueur;
+        m_y /= longueur;
+        m_z /= longueur;
+    }
+}
+Vecteur& Vecteur::operator=(const Vecteur &vecteur)
+{
+    // Copie des valeurs
+
+    m_x = vecteur.m_x;
+    m_y = vecteur.m_y;
+    m_z = vecteur.m_z;
+
+
+    // Retour de l'objet
+
+    return *this;
+}
+Vecteur Vecteur::operator+(const Vecteur &vecteur)
+{
+    // Création d'un objet résultat
+
+    Vecteur resultat;
+
+
+    // Addition des coordonnées
+
+    resultat.m_x = m_x + vecteur.m_x;
+    resultat.m_y = m_y + vecteur.m_y;
+    resultat.m_z = m_z + vecteur.m_z;
+
+
+    // Retour de résultat
+
+    return resultat;
+}
+Vecteur Vecteur::operator-(const Vecteur &vecteur)
+{
+    // Création d'un objet résultat
+
+    Vecteur resultat;
+
+
+    // Soustraction des coordonnées
+
+    resultat.m_x = m_x - vecteur.m_x;
+    resultat.m_y = m_y - vecteur.m_y;
+    resultat.m_z = m_z - vecteur.m_z;
+
+
+    // Retour de résultat
+
+    return resultat;
+}
+Vecteur Vecteur::operator*(float multiplicateur)
+{
+    // Création d'un objet résultat
+
+    Vecteur resultat;
+
+
+    // Multiplication des coordonnées
+
+    resultat.m_x = m_x * multiplicateur;
+    resultat.m_y = m_y * multiplicateur;
+    resultat.m_z = m_z * multiplicateur;
+
+
+    // Retour du résultat
+
+    return resultat;
+}
+Vecteur Vecteur::operator/(float diviseur)
+{
+    // Création d'un objet résultat
+
+    Vecteur resultat;
+
+
+    // Multiplication des coordonnées
+
+    resultat.m_x = m_x / diviseur;
+    resultat.m_y = m_y / diviseur;
+    resultat.m_z = m_z / diviseur;
+
+
+    // Retour du résultat
+
+    return resultat;
+}
+Vecteur Vecteur::operator*(const Vecteur &vecteur)
+{
+    // Création d'un objet résultat
+
+    Vecteur resultat;
+
+
+    // Produit Vectoriel
+
+    resultat.m_x = (m_y * vecteur.m_z) - (m_z * vecteur.m_y);
+    resultat.m_y = (m_z * vecteur.m_x) - (m_x * vecteur.m_z);
+    resultat.m_z = (m_x * vecteur.m_y) - (m_y * vecteur.m_x);
+
+
+    // Retour de l'objet
+
+    return resultat;
+}
+void Vecteur::operator*=(const Vecteur &vecteur)
+{
+    *this = *this * vecteur;
+}
+void Vecteur::operator-=(const Vecteur &vecteur)
+{
+    *this = *this - vecteur;
+}
+void Vecteur::operator+=(const Vecteur &vecteur)
+{
+    *this = *this + vecteur;
+}
+void Vecteur::operator*=(float multiplicateur)
+{
+    *this = *this * multiplicateur;
+}
+void Vecteur::operator/=(float multiplicateur)
+{
+    *this = *this * multiplicateur;
+}
+float Vecteur::scalair(const Vecteur &vecteur)
+{
+    Vecteur v1(*this), v2(vecteur);
+    v1.normaliser();
+    v2.normaliser();
+    return v1.getX() * v2.getX() + v1.getY() * v2.getY() + v1.getZ() * v2.getZ();
+}
+bool Vecteur::operator==(const Vecteur &vecteur)
+{
+    if(m_x == vecteur.getX() && m_y == vecteur.getY() && m_z == vecteur.getZ())
+        return true;
+    else
+        return false;
+}
+bool Vecteur::operator!=(const Vecteur &vecteur)
+{
+    if(*this == vecteur)
+        return false;
+    else
+        return true;
+}
+double Vecteur::norme()
+{
+    return sqrt(m_x*m_x+m_y*m_y+m_z*m_z);
+}
+void Vecteur::rotateR(float angle)
+{
+    float tmp = m_x;
+    m_x = cos(angle)*m_x-sin(angle)*m_y;
+    m_y = sin(angle)*tmp+cos(angle)*m_y;
+}
+void Vecteur::rotateD(float angle)
+{
+    float _angle = angle*M_PI/180;
+    float tmp = m_x;
+    m_x = cos(_angle)*m_x-sin(_angle)*m_y;
+    m_y = sin(_angle)*tmp+cos(_angle)*m_y;
+}

+ 46 - 0
Headers/Vecteur.h

@@ -0,0 +1,46 @@
+#ifndef VECTEUR_H_INCLUDED
+#define VECTEUR_H_INCLUDED
+
+#include <cmath>
+
+class Vecteur
+{
+    public:
+
+    Vecteur();
+    Vecteur(float x, float y, float z = 0);
+    Vecteur(const Vecteur &vecteur);
+    ~Vecteur();
+    float getX() const;
+    float getY() const;
+    float getZ() const;
+    void setVecteur(float x, float y, float z);
+    void setX(float x);
+    void setY(float y);
+    void setZ(float z);
+    void normaliser();
+    Vecteur& operator=(const Vecteur &vecteur);
+    Vecteur operator+(const Vecteur &vecteur);
+    Vecteur operator-(const Vecteur &vecteur);
+    Vecteur operator*(float multiplicateur);
+    Vecteur operator/(float diviseur);
+    Vecteur operator*(const Vecteur &vecteur);
+    void operator*=(const Vecteur &vecteur);
+    void operator-=(const Vecteur &vecteur);
+    void operator+=(const Vecteur &vecteur);
+    void operator*=(float multiplicateur);
+    void operator/=(float multiplicateur);
+    float scalair(const Vecteur &vecteur);
+    bool operator==(const Vecteur &vecteur);
+    bool operator!=(const Vecteur &vecteur);
+    double norme();
+    void rotateR(float angle); // angle en radians
+    void rotateD(float angle); // angle en degrés
+
+private:
+    float m_x;
+    float m_y;
+    float m_z;
+};
+
+#endif // VECTEUR_H_INCLUDED

+ 51 - 0
Headers/transform.cpp

@@ -0,0 +1,51 @@
+#include "transform.h"
+
+SDL_Surface* transform(std::string const chaine, int const taille, SDL_Color couleur)
+{
+    // [1] Préparation du texte
+    TTF_Font *police(0);
+    police = TTF_OpenFont("Polices/droid.ttf",taille);
+
+    // [2] Assignation de la surface
+    SDL_Surface *texte(0);
+    texte = TTF_RenderText_Blended(police, chaine.c_str(),couleur);
+
+    // [3] Fermeture
+    TTF_CloseFont(police);
+
+    // [4] Retourne la surface
+    return texte;
+}
+
+SDL_Surface* transform(std::string const chaine, int const taille)
+{
+    SDL_Color couleurNoire = {0,0,0};
+    return transform(chaine,taille,couleurNoire);
+}
+
+SDL_Surface* transform(std::string const chaine)
+{
+    return transform(chaine,20);
+}
+
+std::string convertirEntierEnCaracteres(int numero)
+{
+    //[1]Préaparer
+    std::string resultat;
+    char caractere(0);
+
+    //[2]S'auto appeler
+    caractere=numero%10;
+    caractere=caractere+48;
+    numero/=10;
+
+    if (numero!=0)
+        resultat=convertirEntierEnCaracteres(numero);
+
+    resultat+=caractere;
+
+
+    //[3]Renvoi
+    return resultat;
+}///convertirEntierEnCaracteres(int numero)
+

+ 28 - 0
Headers/transform.h

@@ -0,0 +1,28 @@
+#ifndef TRANSFORM_H_INCLUDED
+#define TRANSFORM_H_INCLUDED
+
+///Modifié le: 10/10/2013
+///Objet: ajout de la fonction cpnvertirIntEnCaracteres
+
+#include <iostream>
+#include <string>
+
+#include <SDL.h>
+#include <SDL_ttf.h>
+
+/*
+===La fonction transform===
+    +Définition:
+        Elle permet de convertir un string en SDL_Surface. Attention ! Stocker la valeur retournée dans
+        un pointeur et n'oubliez pas le SDL_FreeSurface ! Sinon, risque de fuite de mémoire.
+
+*/
+
+SDL_Surface* transform(std::string const chaine, int const taille, SDL_Color couleur);
+SDL_Surface* transform(std::string const chaine, int const taille);
+SDL_Surface* transform(std::string const chaine);
+
+std::string convertirEntierEnCaracteres(int numero);
+
+
+#endif // TRANSFORM_H_INCLUDED

BIN
Images/boutonLevel.bmp


BIN
Images/boutonLevelB.bmp


BIN
Images/droite.bmp


BIN
Images/gauche.bmp


+ 103 - 0
Jeu/Balle.cpp

@@ -0,0 +1,103 @@
+#include "Balle.h"
+
+Balle::Balle(int rayon, Uint32 couleur, Level* niveau,
+             int xSpawn,int ySpawn,float resistance,float gravite,int xBut,int yBut)
+:m_puissance(1.1),m_resistance(resistance),m_attraction(0,gravite),
+m_position(0.0,0.0),m_resultante(0.0,-6.0),m_traction(0.0,0.0),
+m_spawn((xSpawn+0.5)*LG_BLOC,(ySpawn+0.5)*LG_BLOC),
+m_arrivee(xBut+NB_BLOC_HORIZON/2,yBut+NB_BLOC_VERTI/2),m_point(0),
+m_niveau(niveau)
+{
+    m_point = createPoint(rayon,couleur);
+
+    m_position=m_spawn;
+}///Constructeur
+
+Balle::~Balle()
+{
+    SDL_FreeSurface(m_point);
+}///Destructeur
+
+void Balle::demarrage(short dx, short dy)
+{
+    Vecteur ajout(dx*m_puissance,dy*m_puissance);
+    m_traction+=ajout;
+}///demarrage
+
+void Balle::arret(short dx, short dy)
+{
+    Vecteur ajout(dx*m_puissance,dy*m_puissance);
+    m_traction-=ajout;
+}///arret
+
+void Balle::calculMouvement()
+{
+    /// [1] Calcul de la resultante
+    m_resultante=m_resultante+m_traction+m_attraction;
+    m_resultante*=m_resistance;
+
+    /// [2] Collisions terrain
+    bool encore(true);
+
+    // [2.1] Vecteur parcoureur
+    Vecteur aller,norme,posTest;
+    norme=m_resultante;
+    norme.normaliser();
+    posTest=m_position;
+
+    // [2.2] Avancée testeuse
+    while ()
+    {
+        //On grandit le vecteur aller avec le norme tant qu'il est plus petit que resultante ou BOUM !
+    }//WHILE progression
+
+    /// [3] Attribution
+    m_position+=m_resultante;
+
+}///calculMouvement
+
+void Balle::dessiner(SDL_Surface* support)
+{
+    SDL_Rect position={(Sint16)(m_position.getX()-7),(Sint16)(m_position.getY()-7),0,0};
+    SDL_BlitSurface(m_point,0,support,&position);
+}///dessiner
+
+void Balle::statutConsole()
+{
+    std::cout << "Position ("<<m_position.getX()<<";"<<m_position.getY()<<")."<<std::endl;
+    std::cout << "Resultante ("<<m_resultante.getX()<<";"<<m_resultante.getY()<<")."<<std::endl;
+    std::cout << "Traction ("<<m_traction.getX()<<";"<<m_traction.getY()<<")."<<std::endl;
+    std::cout << "Spawn ("<<m_spawn.getX()<<";"<<m_spawn.getY()<<")."<<std::endl;
+    std::cout << "Arrivée ("<<m_arrivee.getX()<<";"<<m_arrivee.getY()<<")."<<std::endl;
+    std::cout << std::endl;
+
+}///statutConsole
+
+void Balle::respawn()
+{
+    m_position=m_spawn;
+    m_resultante.setX(0.0);
+    m_resultante.setY(-6.0);
+}///respawn
+
+/***===================={ Fonctions indépendantes }====================***/
+Balle* haveBall(Level* niveau)
+{
+    // [1] Création des paramètres
+    int xSpawn, ySpawn, xBut, yBut;
+    float resistance, gravite;
+
+    // [2] Acquisition des paramètres
+    niveau->lireParametres(xSpawn,ySpawn,resistance,gravite,xBut,yBut);
+
+    // [3] Création de la balle
+    Balle* perso(0);
+    perso=new Balle(7, 64512, niveau,//64 512 = orange en 16 bits
+                xSpawn,ySpawn,resistance,gravite,xBut,yBut);
+
+    // [4] Renvoi
+    return perso;
+}///haveBall
+
+
+

+ 98 - 0
Jeu/Balle.h

@@ -0,0 +1,98 @@
+#ifndef BALLE_H_INCLUDED
+#define BALLE_H_INCLUDED
+
+#include "Level.h"
+
+#include "../Headers/Vecteur.h"
+#include "../Headers/Point.h"
+
+///Balle.h
+///Date de modification: 8_12_2013
+///Objet: new solution pour collisons: vecteurs normalisés
+///Prochaine étape: debuger le système de collisions
+
+/*
+===La classe Balle===
+    +Définition:
+        La classe Balle permet de créer une entité qui rebondit sur les éléments du niveau
+        et qui peut être dirigée. Cette entité est également soumise à la gravité.
+    +Méthodes:
+        - Constructeur:
+            Permet de renseigner tous les paramètres: rayon, couleur et le niveau en cours.
+            Le pointeur sur le niveau permet de renseigner le point de spawn, la résistance
+            et la gravité et le point d'arrivée.
+
+        - demarrage:
+            Active un des 4 propulseurs. Converti ensuite par un vecteur à ajouter à la force totale.
+            +Arguments: deux entiers, utilisez les define pour nommer la direction du propulseur.
+
+        - arret:
+            Idem, mais le vecteur sera soustré.
+            +Arguments: deux entiers, utilisez les define pour nommer la direction du propulseur.
+
+        - calculMouvement:
+            Permet d'actualiser la position de la balle. A appeler à intervalles réguliers.
+
+        - dessiner:
+            Permet d'afficher la position de la balle.
+            *Argument: pointeur sur la surface de collage.
+
+        - statutConsole:
+            Permet d'afficher dans la console les infos et états de variables de la balle.
+
+        - respawn:
+            Permet de remettre la balle au point de départ.
+
+===La fonction haveBall===
+    +Définition:
+        Cette fonction sert à créer une balle dynamiquement à partir d'un pointeur sur niveau
+        pour la créer avec tous ses attributs constants, indiqués dans le fichier du niveau.
+        Elle utilise pour cela la fonction lireParametres de Level.h.
+    +Arguments:
+        Pointeur sur le niveau en cours.
+    +Renvoi:
+        Pointeur sur la balle créée.
+*/
+
+#define HAUT 0,-1
+#define DROITE 1,0
+#define BAS 0,1
+#define GAUCHE -1,0
+
+class Balle
+{
+    public:
+    Balle(int rayon, Uint32 couleur, Level* niveau,
+          int xSpawn,int ySpawn,float resistance,float gravite,int xBut,int yBut);
+    ~Balle();
+    void demarrage(short dx, short dy);//à renseigner par define
+    void arret(short dx, short dy);//idem
+    void calculMouvement();
+    void dessiner(SDL_Surface* support);
+    void statutConsole();
+    void respawn();
+
+    protected:
+    //Attributs physiques
+    float const m_puissance;//defaut: 1
+    float const m_resistance;//defaut: 0.5
+    Vecteur const m_attraction;//Force extérieure defaut: 1.5
+
+    //Attributs vectoriels
+    Vecteur m_position;//Contient les coordonnées de l'objet
+    Vecteur m_resultante;//Force finale, force précédente
+    Vecteur m_traction;//Force totale des propulseurs
+
+    Vecteur const m_spawn;
+    Vecteur const m_arrivee;
+
+    //Attribut SDL
+    SDL_Surface* m_point;
+
+    //Attribut de l'environnement
+    Level* m_niveau;
+};
+
+Balle* haveBall(Level* niveau);
+
+#endif // BALLE_H_INCLUDED

+ 192 - 0
Jeu/Level.cpp

@@ -0,0 +1,192 @@
+#include "Level.h"
+
+Level::Level(std::string nom, int numero, int tableau[NB_BLOC_VERTI][NB_BLOC_HORIZON])
+:m_nom(nom),m_numero(numero),m_reussi(false)
+{
+    // [1] Remplissage du tableau
+    std::cout <<"Le niveau '"<<nom<<"' numero "<<numero<<" fait "<<
+    NB_BLOC_HORIZON<<" par "<<NB_BLOC_VERTI<<" blocs."<<std::endl<<std::endl;
+    for (int i(0); i<NB_BLOC_HORIZON; i++)
+    {
+        for (int j(0); j<NB_BLOC_VERTI; j++)
+        {
+            m_tableau[j][i]=tableau[j][i];
+
+        }
+    }
+
+    // [2] Création des surfaces
+    m_bloc[0] = SDL_CreateRGBSurface(SDL_HWSURFACE, LG_BLOC, LG_BLOC, 16, 0, 0, 0, 0);
+    m_bloc[1] = SDL_CreateRGBSurface(SDL_HWSURFACE, LG_BLOC, LG_BLOC, 16, 0, 0, 0, 0);
+    m_bloc[2] = SDL_CreateRGBSurface(SDL_HWSURFACE, LG_BLOC, LG_BLOC, 16, 0, 0, 0, 0);
+
+    // [3] Création du titre
+    std::string nomNiveau("Level N ");
+    nomNiveau += convertirEntierEnCaracteres(numero);
+    nomNiveau = nomNiveau + " : " + nom;
+    std::cout << nomNiveau <<" chargé !" << std::endl;
+
+    // [4] Remplissage des surfaces
+    SDL_FillRect(m_bloc[0],NULL,SDL_MapRGB(m_bloc[0]->format,255,255,255));
+    SDL_FillRect(m_bloc[1],NULL,SDL_MapRGB(m_bloc[1]->format,255,0,0));
+    SDL_FillRect(m_bloc[2],NULL,SDL_MapRGB(m_bloc[2]->format,0,128,0));
+    m_titre = transform(nomNiveau);
+
+	// [5] Création de l'arrivéeet du spawn
+	m_posBut.x=m_posBut.y=-1000;
+	m_but = createCircle(LG_BLOC/2,SDL_MapRGB(m_bloc[0]->format,0,255,0),5);//m_bloc[0] juste pour récuperer le format 16 bits
+	m_posSpawn.x=m_posSpawn.y=-1000;
+	m_spawn = createCircle(LG_BLOC/2,SDL_MapRGB(m_bloc[0]->format,0,255,255),7);
+
+}///Constructeur
+
+
+Level::~Level()
+{
+    for (int i(0); i<NB_BLOCS; i++)
+    {
+        SDL_FreeSurface(m_bloc[i]);
+    }
+    SDL_FreeSurface(m_titre);
+	SDL_FreeSurface(m_but);
+	SDL_FreeSurface(m_spawn);
+}///Destructeur
+
+void Level::setBloc(int x, int y, int typeBloc)
+{
+    if ((typeBloc == RIEN || typeBloc == BLOC || typeBloc == BUMPER || typeBloc == PLANCHE) &&
+        0<=x && 0<=y && x<NB_BLOC_HORIZON && y<NB_BLOC_VERTI)
+        m_tableau[y][x]=typeBloc;
+}///setBloc
+
+void Level::save(int xSpawn, int ySpawn, int xBut, int yBut)
+{
+    //à implémenter
+}///save
+
+int Level::getBloc(int x, int y)
+{
+    if (x<0 || x>=NB_BLOC_HORIZON || y>=NB_BLOC_VERTI)
+       return BLOC;
+    else if (y<0)
+        return RIEN;
+    else
+        return m_tableau[y][x];
+}///getBloc
+
+void Level::afficher(SDL_Surface *screen)
+{
+    // [1] Création de la position
+    SDL_Rect position;
+
+    // [2] Collage du niveau
+    for (int i(0); i<NB_BLOC_HORIZON; i++)
+    {
+        for (int j(0); j<NB_BLOC_VERTI; j++)
+        {
+            position.x = i*LG_BLOC;
+            position.y = j*LG_BLOC;
+            if (m_tableau[j][i]==RIEN)
+                /*Rien faire*/;
+            else if (m_tableau[j][i]==BLOC)
+                SDL_BlitSurface(m_bloc[0], 0, screen, &position);
+            else if (m_tableau[j][i]==BUMPER)
+                SDL_BlitSurface(m_bloc[1], 0, screen, &position);
+            else if (m_tableau[j][i]==PLANCHE)
+                SDL_BlitSurface(m_bloc[2], 0, screen, &position);
+        }
+    }
+	SDL_BlitSurface(m_but, 0, screen, &m_posBut);
+	SDL_BlitSurface(m_spawn,0,screen, &m_posSpawn);
+
+    // [3] Collage du titre
+    position.x=20;
+    position.y=20;
+    SDL_BlitSurface(m_titre, 0, screen, &position);
+
+}///afficher
+
+std::string const Level::getNom()
+{
+    return m_nom;
+}
+
+void Level::lireParametres(int &xSpawn,int &ySpawn,float &resistance,float &gravite,int &xBut,int &yBut)
+{
+    // [1] ouverture du flux
+    std::string fichier("Niveaux/level "+convertirEntierEnCaracteres(m_numero)+".txt");
+    std::cout << fichier << std::endl;//Introduction
+    std::ifstream fluxIn(fichier.c_str());
+    if (fluxIn)
+    {
+        // [2] On saute ce qui nous plaît pas
+        for (int i(0);i<NB_BLOC_VERTI+2;i++)
+            getline(fluxIn,fichier);//Là, le string fichier sert de poubelle
+
+        // [3] Renseignement des paramètres
+        fluxIn >> xSpawn;
+        fluxIn >> ySpawn;
+        fluxIn >> resistance;
+        fluxIn >> gravite;
+        fluxIn >> xBut;
+        fluxIn >> yBut;
+
+		m_posSpawn.x=xSpawn*LG_BLOC;
+		m_posSpawn.y=ySpawn*LG_BLOC;
+		m_posBut.x=xBut*LG_BLOC;
+		m_posBut.y=yBut*LG_BLOC;
+
+        // [4] Affichage infos
+        std::cout << "Spawn("<<xSpawn<<";"<<ySpawn<<")."<<std::endl
+        <<"Resistance: "<<resistance<<std::endl
+        <<"Gravité: "<<gravite<<std::endl
+        <<"But("<<xBut<<";"<<yBut<<")."<<std::endl<<std::endl;
+
+    }//Fin de l'ouverture du fichier possible
+
+    // [5] On previent s'il y a pépin
+    else
+        std::cout << "Echec de l'ouverture du fichier lors de la lecture des paramètres."<<std::endl;
+}///lireParametres
+
+/***===================={ Fonctions indépendantes }====================***/
+Level* haveLevel(std::string nomFichier)
+{
+    // [1] Mise au poin du nom du fichier
+    nomFichier="Niveaux/"+nomFichier;
+
+    // [2] Ouverture du flux
+    std::ifstream fluxIn(nomFichier.c_str());
+    if (fluxIn)
+        std::cout << "Ouverture du fichier "<<nomFichier<<" réussie."<<std::endl;
+    else
+    {
+        std::cout << "Echec de l'ouverture du fichier "<<nomFichier<<"."<<std::endl;
+        return 0;
+    }
+
+    // [3] Création des composants du niveau
+    std::string nomNiveau;
+    int numeroNiveau;
+    int tableauNiveau[NB_BLOC_VERTI][NB_BLOC_HORIZON];
+
+    // [4] Remplissage du niveau
+    getline(fluxIn,nomNiveau);
+    fluxIn >> numeroNiveau;
+    for (int y(0); y<NB_BLOC_VERTI; y++)
+    {
+        for (int x(0); x<NB_BLOC_HORIZON; x++)
+        {
+            fluxIn >> tableauNiveau[y][x];
+        }
+    }
+
+    // [5] Création de l'objet
+    Level* niveau(0);
+    niveau = new Level(nomNiveau,numeroNiveau,tableauNiveau);
+
+    // [6] Renvoi du niveau
+    return niveau;
+}
+
+

+ 94 - 0
Jeu/Level.h

@@ -0,0 +1,94 @@
+#ifndef LEVEL_H_INCLUDED
+#define LEVEL_H_INCLUDED
+
+///Modifié le: 15/10/2013
+///Objet: afficher spawn et but
+///à faire:
+
+#include "../Headers/transform.h"
+#include "../Headers/Point.h"
+
+#include <fstream>
+
+/*
+===La classe Level===
+    +Définition:
+        La classe Level permet de créer un niveau de gravitation game. Il se caractérise par le
+        numéro du niveau, le nom du niveau et un tableau de int.
+    +Fonctions:
+        -Constructeur standard:
+            Permet d'instaurer tous les paramètres. Utilisez plutôt la fonction haveLevel.
+        -setBloc:
+            Permet de remplir une case du niveau. Utiliser pour cela les define.
+            Arguments: Deux entiers de position en pixels, plus le bloc à rajouter.
+        -save:
+            Utilisé lors de l'édition de niveau, ou pour sauvegarder une réussite (à faire).
+            Permet de sauvegarder le niveau dans son intégralité.
+            Arguments: deux entiers coordonnées spawn, deux entiers coordonnées but.
+        -getBloc:
+            Permet de connaitre la nature du bloc.
+            Arguments: Deux entiers de position en pixels.
+        -afficher:
+            Permet d'afficher le niveau.
+        -getNom:
+            Permet de connaître le nom du niveau, lu dans le fichier.
+            Renvoi: string contenant le nom du niveau.
+        -lireParamètres:
+            Permet à la balle de connaître tous les éléments de son environnement.
+            Arguments de réference: int XetY spawn, floats resistance et gravité, int XetY but
+
+===Le fonction haveLevel===
+    +Définition:
+        Permet de lire un fichier niveau. Pour cela, il faut un string contenant le nom du fichier
+        et la fonction retourne un niveau. :-)
+        Arguments: string nom de niveau
+        Renvoi: un objet de type Level
+*/
+
+#define NB_BLOC_HORIZON 32
+#define NB_BLOC_VERTI 24
+#define LG_BLOC 20
+
+#define RIEN 0
+#define BLOC 1
+#define BUMPER 2
+#define PLANCHE 3//à venir
+//Changer le NB_BLOCS et implémenter le constructeur à chaque ajout d'élément
+#define NB_BLOCS 3
+
+class Level
+{
+    public:
+    Level(std::string nom, int numero, int tableau[NB_BLOC_VERTI][NB_BLOC_HORIZON]=0);
+    ~Level();
+    //Fonctions d'édition
+    void setBloc(int x, int y, int typeBloc);
+    void save(int xSpawn, int ySpawn, int xBut, int yBut);
+
+    //Fonctions de jeu
+    int getBloc(int x, int y);
+    void afficher(SDL_Surface *screen);
+    std::string const getNom();
+
+    //Fonction d'acquisition des paramètres
+    void lireParametres(int &xSpawn,int &ySpawn,float &resistance,float &gravite,int &xBut,int &yBut);
+
+    private:
+    //Attributs standards:
+    int m_tableau[NB_BLOC_VERTI][NB_BLOC_HORIZON];
+    std::string const m_nom;
+    int const m_numero;
+    bool m_reussi;
+
+    //Attributs SDL:
+    SDL_Surface* m_titre;
+    SDL_Surface* m_bloc[NB_BLOCS];//ATTENTION !!! Rien = 0 !
+	SDL_Rect m_posBut;
+    SDL_Surface* m_but;
+	SDL_Rect m_posSpawn;
+	SDL_Surface* m_spawn;
+};
+
+Level* haveLevel(std::string nomFichier);
+
+#endif // LEVEL_H_INCLUDED

+ 123 - 0
Jeu/jeu.cpp

@@ -0,0 +1,123 @@
+#include "jeu.h"
+
+bool jeu(std::string nomFichierNiveau)
+{
+    /// [1] Lancement du jeu
+    // [1.1] Création de l'écran
+    SDL_Surface *screen = SDL_SetVideoMode(640, 480, 16,
+                                           SDL_HWSURFACE|SDL_DOUBLEBUF);
+    if ( !screen )
+    {
+        std::cout << "Unable to set 640x480 video: "<< SDL_GetError() << std::endl;
+        return 1;
+    }
+    SDL_WM_SetCaption("Gravitation Game _ Play",NULL);
+
+    // [1.2] Préparation des composants
+    bool goMenu(false);
+    Uint32 tempsPrecedent(0);
+    Level *niveau(0);
+    niveau = haveLevel(nomFichierNiveau);
+    if (niveau==0)
+    {
+        //Erreur détectée, retour au menu
+        std::cout << "Jeu.cpp: erreur détectée: niveau inexistant ou illisible" << std::endl;
+        return true;//retour au menu
+    }
+    Balle* ball(haveBall(niveau));
+
+    /// [2] Boucle principale évenementielle
+    bool done = false;
+    while (!done)
+    {
+        // [2.1] Gestion évènement
+        SDL_Event event;
+        while (SDL_PollEvent(&event))
+        {
+            switch (event.type)
+            {
+            case SDL_QUIT:
+                done = true;
+                goMenu = false;
+                break;
+            case SDL_KEYDOWN:
+                switch (event.key.keysym.sym)
+                {
+                    case SDLK_ESCAPE:
+                        done = true;
+                        goMenu = true;
+                        break;
+                    case SDLK_UP:
+                        ball->demarrage(HAUT);
+                        break;
+                    case SDLK_RIGHT:
+                        ball->demarrage(DROITE);
+                        break;
+                    case SDLK_DOWN:
+                        ball->demarrage(BAS);
+                        break;
+                    case SDLK_LEFT:
+                        ball->demarrage(GAUCHE);
+                        break;
+                    case SDLK_s:
+                        ball->statutConsole();
+                        break;
+                }///switch keysym
+                break;///keydown
+            case SDL_KEYUP:
+                switch (event.key.keysym.sym)
+                {
+                    case SDLK_ESCAPE:
+                        done = true;
+                        break;
+                    case SDLK_UP:
+                        ball->arret(HAUT);
+                        break;
+                    case SDLK_RIGHT:
+                        ball->arret(DROITE);
+                        break;
+                    case SDLK_DOWN:
+                        ball->arret(BAS);
+                        break;
+                    case SDLK_LEFT:
+                        ball->arret(GAUCHE);
+                        break;
+                    case SDLK_BACKSPACE:
+                        ball->respawn();
+                        break;
+                }///switch keysym
+                break;///keyup
+            } ///switch
+        } ///while
+
+        // [2.2] Calcul
+        ball->calculMouvement();
+
+        // [2.3] Dessin
+        SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 120, 130, 228));
+
+        ball->dessiner(screen);
+        niveau->afficher(screen);
+
+        SDL_Flip(screen);
+
+        // [2.4] Gestion du temps
+        while (30>SDL_GetTicks()-tempsPrecedent)//30ms normalement (3000 debug)
+        {
+            //ça bloque pendant 30 ms moins le temps de calcul
+        }
+        tempsPrecedent=SDL_GetTicks();
+
+    } ///Boucle principale évenementielle
+
+    /// [3] Nettoyage
+    delete niveau;
+    delete ball;
+	SDL_FreeSurface(screen);
+
+    /// [4] Fin de la partie
+    std::cout << "Jeu.cpp: Partie terminée, pas d'erreur détectée." << std::endl;
+    return goMenu;
+
+}///jeu()
+

+ 26 - 0
Jeu/jeu.h

@@ -0,0 +1,26 @@
+#ifndef JEU_H_INCLUDED
+#define JEU_H_INCLUDED
+
+#include "Level.h"
+#include "Balle.h"
+
+///jeu.h
+///Date de modification: 21_10_2013
+///Objet: timer 3000ms
+///Prochaine étape: ((remettre en place dès le debug de collisions terminées))
+
+/*
+-Rôle de jeu.h:
+        La fonction jeu permet de lancer le jeu à partir d'un nom de niveau. Retourne un bool,
+    pour savoir si le joueur retourne au menu ou quitte le jeu. Plus tard, des options pourront
+    être transmises, comme le plein écran.
+
+-Fichiers inclus:
+    +Level.h:
+		Fichier permettant de créer l'objet niveau et bénéficiant d'une fonction haveLevel pour
+    charger un niveau à partir du nom de fichier.
+*/
+
+bool jeu(std::string nomFichierNiveau);
+
+#endif // JEU_H_INCLUDED

+ 70 - 0
Menu/Bouton.cpp

@@ -0,0 +1,70 @@
+#include "Bouton.h"
+
+Bouton::Bouton(SDL_Surface *objetImg, SDL_Surface *screen, int const x, int const y)
+:m_x(x),m_y(y),m_selectImg(0)
+{
+    m_objetImg = objetImg;
+    m_screen = screen;
+
+    m_blitImg = m_objetImg;
+}///Constructeur
+
+Bouton::~Bouton()
+{
+    SDL_FreeSurface(m_objetImg);
+    if (m_selectImg != 0)
+        SDL_FreeSurface(m_selectImg);
+}
+
+void Bouton::attribuerImg(SDL_Surface *selectImg)
+{
+    m_selectImg = selectImg;
+}///attribuerImg
+
+bool Bouton::calculer(int const xSouris, int const ySouris)
+{
+    if (m_selectImg != 0)
+    {/**if**/
+        if (m_x < xSouris && xSouris < m_x+m_objetImg->w)
+        {///if
+            if (m_y < ySouris && ySouris < m_y+m_objetImg->h)
+            {//if
+                m_blitImg = m_selectImg;
+                return true;//Souris dessus !
+            }//if
+            else
+            {//else
+                m_blitImg = m_objetImg;
+                return false;//Rien
+            }//else
+        }///if
+        else
+        {//else
+            m_blitImg = m_objetImg;
+            return false;//Rien
+        }//else
+    }/**if**/
+
+    return false;//Il y a pas de seconde image patate !
+}///calculer
+
+void Bouton::afficher()
+{
+    // [1] Attribution des positions
+    SDL_Rect position;
+    position.x=m_x;
+    position.y=m_y;
+
+    // [2] Collage
+    SDL_BlitSurface(m_blitImg, 0, m_screen, &position);
+}///afficher
+
+bool Bouton::estClique(int const xSouris, int const ySouris)
+{
+    if (m_x < xSouris && xSouris < m_x+m_objetImg->w)
+        if (m_y < ySouris && ySouris < m_y+m_objetImg->h)
+            return true;
+    return false;
+}///estClique
+
+

+ 57 - 0
Menu/Bouton.h

@@ -0,0 +1,57 @@
+#ifndef BOUTON_H_INCLUDED
+#define BOUTON_H_INCLUDED
+
+///Modifié le: 02/10/2013
+///Objet: calculer renvoie un bool
+///à faire:
+
+#include <iostream>
+#include <string>
+#include <SDL.h>
+
+/*
+===La classe Bouton===
+    +Définition:
+        Elle permet de savoir si on clique dessus. On peut l'afficher, on calcule en lui donnant les
+        coordonnées de la souris, et une fonction retourne si ça a été cliqué ou pas ! Voilà le travail. ;)
+        Il peut également changer de forme si on passe la souris dessus...
+    +Méthodes:
+        - Constructeur:
+
+        - attribuerImg:
+            Permet de donner une surface qui s'affiche quand la souris passe dessus.
+            Argument: SDL_surface de la deuxième image affichable.
+
+        - calculer:
+
+        - afficher:
+
+        - estClique:
+            Lorsqu'un clic se déclenche, permet de savoir si l'icone est cliquée.
+
+*/
+
+class Bouton
+{
+    public:
+    Bouton(SDL_Surface *objetImg, SDL_Surface *screen, int const x, int const y);
+    ~Bouton();
+    void attribuerImg(SDL_Surface *selectImg);
+    bool calculer(int const xSouris, int const ySouris);
+    void afficher();
+    bool estClique(int const xSouris, int const ySouris);
+
+    protected:
+    //Attributs standards
+    int m_x;
+    int m_y;
+
+    //Attributs SDL
+    SDL_Surface *m_screen;
+    SDL_Surface *m_objetImg;
+    SDL_Surface *m_selectImg;
+
+    SDL_Surface *m_blitImg;
+};
+
+#endif // BOUTON_H_INCLUDED

+ 231 - 0
Menu/gestionnaireNiveaux.cpp

@@ -0,0 +1,231 @@
+#include "gestionnaireNiveaux.h"
+
+GestionnaireNiveaux::GestionnaireNiveaux(SDL_Surface *screen):
+m_pageActuelle(0),m_estChoisi(false),m_choixJoueur("nothings"),m_screen(screen)
+{
+    ///[1] Création des boutons
+    //[1.1] Changement de pages
+    m_pagePrecedente = new Bouton(SDL_LoadBMP("Images/gauche.bmp"), screen, 320-154, 440);
+    m_pageSuivante = new Bouton(SDL_LoadBMP("Images/droite.bmp"), screen, 320, 440);
+
+    //[1.2] Niveaux
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        m_tableauBoutons[i]=0;
+    }
+    allerALaPage(0);
+
+    ///[2] Attribution des secondes images
+    //[2.1] Changement de pages
+
+    //[2.2] Niveaux (pas besoin, fait dans allerPage())
+
+
+}///GestionnaireNiveaux()
+
+GestionnaireNiveaux::~GestionnaireNiveaux()
+{
+    ///[1] Nettoyage boutons
+    //[1.1] Changement de pages
+    delete(m_pagePrecedente);
+    delete(m_pageSuivante);
+
+    //[1.2] Niveaux
+    reinitialiserPage();
+
+}///~GestionnaireNiveaux()
+
+void GestionnaireNiveaux::calculer(int const xSouris, int const ySouris)
+{
+    bool selectOk(false);//Rien de selectionné
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        if (m_tableauBoutons[i]->calculer(xSouris,ySouris))
+        {
+            m_font=m_apercu[i];
+            selectOk=true;
+        }
+    }
+    if (!selectOk)//Rien de seelctionné !
+        m_font=0;
+}///calculer(int const xSouris, int const ySouris)
+
+void GestionnaireNiveaux::afficher()
+{
+    ///[1] Affichage des boutons
+    //[1.0] Font
+    SDL_Rect positionZero;
+    positionZero.x=positionZero.y=0;
+    if (m_font!=0)
+        SDL_BlitSurface(m_font,0,m_screen,&positionZero);
+
+    //[1.1] Changeurs de pages
+    m_pagePrecedente->afficher();
+    m_pageSuivante->afficher();
+
+    //[1.2] Niveaux
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        m_tableauBoutons[i]->afficher();
+    }
+
+}///afficher(SDL_Surface* screen)
+
+void GestionnaireNiveaux::clic(int const xSouris, int const ySouris)
+{
+    ///Teste tous les boutons, si un bouton est cliqué,
+    ///appelez nomDuFichier puis modifier m_choixJoueur et m_estChoisi
+    //[1] Test du tableau de boutons
+    for (Uint8 i(0); i<NB_BOUTONS; i++)
+    {
+        if (m_tableauBoutons[i]->estClique(xSouris,ySouris))
+        {
+            std::cout << "Clic, niveau choisi: " << nomDuFichier(i) << std::endl;
+            if (m_apercu[i]!=0)
+            {
+                m_estChoisi=true;
+                m_choixJoueur=nomDuFichier(i);
+            }
+            else
+                std::cout << nomDuFichier(i) << " n'existe pas. Reste au menu. " << std::endl;
+        }
+    }
+
+	//[2] Tests des boutons de chgmt de page
+	if (m_pageSuivante->estClique(xSouris,ySouris))
+		allerALaPage(m_pageActuelle+1);
+	else if (m_pagePrecedente->estClique(xSouris,ySouris) && m_pageActuelle>0)
+		allerALaPage(m_pageActuelle-1);
+
+}///clic(int const xSouris, int const ySouris)
+
+bool GestionnaireNiveaux::estChoisi()
+{
+    return m_estChoisi;
+}///estChoisi()
+
+std::string GestionnaireNiveaux::getChoix()
+{
+    return m_choixJoueur;
+}///getChoix()
+
+/**---------------------------------FONCTIONS INTERNES---------------------------------**/
+
+void GestionnaireNiveaux::reinitialiserPage()
+{
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        //[1] Nettoyage boutons
+        if (m_tableauBoutons[i]!=0)
+            delete m_tableauBoutons[i];
+        m_tableauBoutons[i]=0;
+
+        //[2] Nettoyage aperçus
+        if (m_apercu[i]!=0)
+            SDL_FreeSurface(m_apercu[i]);
+        m_apercu[i]=0;
+    }
+}///reinitialiserPage()
+
+void GestionnaireNiveaux::allerALaPage(Uint32 numeroPage)
+{
+    //[0] Sécurité:
+    if (m_tableauBoutons[0]!=0)
+        reinitialiserPage();
+
+    //[1] Changement de page, toute !
+    m_pageActuelle=numeroPage;
+
+    //[2] Chargement des images !!!
+    SDL_Surface* apparence[NB_BOUTONS];
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        apparence[i]=SDL_LoadBMP("Images/boutonLevel.bmp");
+    }
+
+    SDL_Surface* surbrillance[NB_BOUTONS];
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        surbrillance[i]=SDL_LoadBMP("Images/boutonLevelB.bmp");
+    }
+
+    //[2bis] Chargement des textes et aperçus !
+    std::string nomNiveau[NB_BOUTONS];
+    Level* maquette(0);
+    std::string ajout;
+
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        maquette=haveLevel(nomDuFichier(i));
+        if (maquette==0)//Niveau inexistant
+        {
+            nomNiveau[i]="NO_LVL";
+            m_apercu[i]=0;
+        }
+        else
+        {
+            ajout=convertirEntierEnCaracteres(m_pageActuelle*NB_BOUTONS+i+1);
+            nomNiveau[i]="Level "+ajout+" "+maquette->getNom();
+            m_apercu[i]=SDL_CreateRGBSurface(SDL_HWSURFACE,640,480,16,0,0,0,0);
+            maquette->afficher(m_apercu[i]);
+            SDL_SetColorKey(m_apercu[i],SDL_SRCCOLORKEY,SDL_MapRGB(m_apercu[i]->format,0,0,0));
+            delete maquette;
+        }
+    }
+
+    //[3] Collage des textes !
+    SDL_Surface* texte[NB_BOUTONS];
+    SDL_Rect position;
+    position.x=20;
+    position.y=4;
+    SDL_Rect positionB;
+    positionB.x=position.x+2;
+    positionB.y=position.y+1;
+
+    SDL_Color bleu={0,0,200};
+
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        texte[i]=transform(nomNiveau[i],25,bleu);
+
+        SDL_BlitSurface(texte[i], 0, apparence[i], &position);
+        SDL_BlitSurface(texte[i], 0, surbrillance[i], &positionB);
+    }
+
+    //[4] Création des boutons !!!
+    int y(80);
+    int x(320-276-7);
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        if (i==8)//Deuxième colonne !
+        {
+            x=320+7;
+            y=80;
+        }
+
+        m_tableauBoutons[i]=new Bouton(apparence[i], m_screen, x, y);
+        y+=38+5;
+
+        m_tableauBoutons[i]->attribuerImg(surbrillance[i]);
+    }
+
+    //[5] On nettoie les déchets
+    for (int i(0); i<NB_BOUTONS; i++)
+    {
+        SDL_FreeSurface(texte[i]);
+    }
+
+}///allerALaPage(Uint32 numeroPage)
+
+std::string GestionnaireNiveaux::nomDuFichier(Uint8 IDTab)
+{
+    //[1] Quel niveau selectionné ?
+    int numLvl;
+    numLvl=m_pageActuelle*8+IDTab+1;
+
+    //[2] Renvoi
+    return "level "+convertirEntierEnCaracteres(numLvl)+".txt";
+
+}///nomDuFichier(Uint8 IDTab)
+
+

+ 82 - 0
Menu/gestionnaireNiveaux.h

@@ -0,0 +1,82 @@
+#ifndef GESTIONNAIRENIVEAUX_H_INCLUDED
+#define GESTIONNAIRENIVEAUX_H_INCLUDED
+
+#include <fstream>
+
+#include "Bouton.h"
+#include "../Headers/transform.h"
+#include "../Jeu/Level.h"//Pour les aperçus
+
+///GestionnaireNiveaux.h
+///Date de modification: 10_10_2013
+///Objet: convertirCharEnCaracteres déplacée
+///Prochaine étape:
+
+#define NB_BOUTONS 16
+
+/*
+===La classe GestionnaireNiveaux===
+    +Définition:
+        Elle permet d'afficher les niveaux disponibles, sous forme d'icones. Elle donne le nom du
+        fichier du niveau choisi par le joueur utilisé par la fonction jeu par la suite.
+        Le gestionnaire Niveaux affiche seize icones représentant chacune un niveau, deux boutons
+        pour changer de page.
+    +Méthodes:
+        - Constructeur:
+            Permet de créer le gestionnaire en donnant la surface d'écran.
+
+        - calculer:
+            Permet de renseigner les coordonnées de la souris pour mettre en surbrillance les boutons.
+
+        - afficher:
+            Permet d'afficher l'interface des niveaux.
+
+        - clic:
+            Lorsqu'un clic se déclenche, permet de donner sa position.
+
+        - estChoisi:
+            Retourne vrai dès que l'utilisateur a choisi un niveau.
+
+        - getChoix:
+            Retourne dans un string le nom du fichier niveau à lancer.
+
+        - {PROTECTED} allerALaPage:
+            Permet de charger une page lorsque le bouton est utilisé. Géré en interne.
+
+        - {PROTECTED} nomDuFichier:
+            Permet de connaître le nom du fichier d'un élément du tableau en lui filant l'identifiant.
+
+*/
+
+class GestionnaireNiveaux
+{
+    public:
+    GestionnaireNiveaux(SDL_Surface *screen);
+    ~GestionnaireNiveaux();
+    void calculer(int const xSouris, int const ySouris);
+    void afficher();
+    void clic(int const xSouris, int const ySouris);
+    bool estChoisi();
+    std::string getChoix();
+
+    protected: //Fonctions internes
+    void reinitialiserPage();
+    void allerALaPage(Uint32 numeroPage);
+    std::string nomDuFichier(Uint8 IDTab);
+
+    private:
+    Bouton* m_tableauBoutons[NB_BOUTONS];
+    SDL_Surface* m_apercu[NB_BOUTONS];
+    SDL_Surface* m_font;
+    Bouton* m_pagePrecedente;
+    Bouton* m_pageSuivante;
+    Uint32 m_pageActuelle;
+
+    bool m_estChoisi;
+    std::string m_choixJoueur;
+
+    SDL_Surface* m_screen;
+};
+
+
+#endif // GESTIONNAIRENIVEAUX_H_INCLUDED

+ 94 - 0
Menu/menu.cpp

@@ -0,0 +1,94 @@
+#include "menu.h"
+
+std::string menu()
+{
+    /// [1] Lancement du menu
+    // [1.1] Para-fenêtre
+    SDL_WM_SetCaption("Gravitation Game _ Menu", 0);
+
+    // [1.2] Préparation de la fenêtre
+    SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16,
+                                           SDL_HWSURFACE|SDL_DOUBLEBUF);
+    if ( !screen )
+    {
+        std::cout << "menu.h: impossible de créer l'écran. Erreur: " << SDL_GetError();
+        return "quitter";
+    }
+
+    // [1.3] Préparation des objets
+    std::string retour("quitter");
+
+    SDL_Surface *titre(0);
+    SDL_Rect positionTitre;
+
+    SDL_Color blanc = {255,255,255};
+    Bouton quitButton(transform("Quit", 30), screen, screen->w-80, screen->h-50);
+    quitButton.attribuerImg(transform("Quit", 30, blanc));
+
+    // [1.4] Préparation du texte
+    titre = transform("GRAVITATION GAME _ stage select", 40);
+    positionTitre.x = screen->w/2-titre->w/2;
+    positionTitre.y = 20;
+
+    // [1.5] Préparation du gestionnaireNiveaux
+    GestionnaireNiveaux interface(screen);
+
+    /// [2] Boucle principale évenementielle
+    bool done = false;
+    while (!done)
+    {
+        // [2.1] Gestion évènements
+        SDL_Event event;
+        while (SDL_PollEvent(&event))
+        {
+            switch (event.type)
+            {
+            case SDL_QUIT:
+                done = true;
+                retour = "quitter";
+                break;
+            case SDL_KEYDOWN:
+                if (event.key.keysym.sym == SDLK_ESCAPE)
+                    done = true;
+                    retour = "quitter";
+                break;
+            case SDL_MOUSEMOTION:
+                quitButton.calculer(event.motion.x,event.motion.y);
+                interface.calculer(event.motion.x,event.motion.y);
+                break;
+            case SDL_MOUSEBUTTONUP:
+                if (event.button.button==SDL_BUTTON_LEFT)
+                {
+                    if (quitButton.estClique(event.button.x,event.button.y))
+                        done = true;
+                    interface.clic(event.button.x,event.button.y);
+                }
+                break;
+            } // end switch event type
+        } // end of message processing
+
+        // [2.2] Calculs
+        if (interface.estChoisi())
+        {
+            done=true;
+            retour=interface.getChoix();
+        }
+
+        // [2.3] Dessin des composants
+        SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 128, 100, 255));
+
+        interface.afficher();
+        SDL_BlitSurface(titre, 0, screen, &positionTitre);
+        quitButton.afficher();
+
+        SDL_Flip(screen);
+    } //fin bcl principale
+
+    ///[4] Destruction des composants
+    SDL_FreeSurface(titre);
+	SDL_FreeSurface(screen);
+
+    std::cout << "menu.cpp: Aucune erreur détectée." << std::endl;
+    return retour;
+};
+

+ 28 - 0
Menu/menu.h

@@ -0,0 +1,28 @@
+#ifndef MENU_H_INCLUDED
+#define MENU_H_INCLUDED
+
+///menu.h
+///Date de modification: 02_10_2013
+///Objet: réorganisation de l'ordre d'affichage
+///Prochaine étape:
+
+#include "Bouton.h"
+#include "../Headers/transform.h"
+#include "gestionnaireNiveaux.h"
+
+/*
+-Rôle de menu.h:
+        La fonction menu permet d'afficher la liste des niveaux disponibles. Lorsque le joueur a chosi
+    le niveau à lancer, le menu retourne le nom du fichier correspondant. Si il a quitté, le
+    string est "quitter".
+
+-Fichiers inclus:
+	+Bouton.h:
+		Fichier contenant de quoi créer des boutons.
+    +transform.h:
+		Permet de créer des SDL surfaces à partir de string.
+*/
+
+std::string menu();
+
+#endif // MENU_H_INCLUDED

+ 30 - 0
Menu/transform.cpp

@@ -0,0 +1,30 @@
+#include "transform.h"
+
+/*SDL_Surface* transform(std::string const chaine, int const taille, SDL_Color couleur)
+{
+    // [1] Préparation du texte
+    TTF_Font *police(0);
+    police = TTF_OpenFont("Polices/droid.ttf",taille);
+
+    // [2] Assignation de la surface
+    SDL_Surface *texte(0);
+    texte = TTF_RenderText_Blended(police, chaine.c_str(),couleur);
+
+    // [3] Fermeture
+    TTF_CloseFont(police);
+
+    // [4] Retourne la surface
+    return texte;
+}
+
+SDL_Surface* transform(std::string const chaine, int const taille)
+{
+    SDL_Color couleurNoire = {0,0,0};
+    return transform(chaine,taille,couleurNoire);
+}
+
+SDL_Surface* transform(std::string const chaine)
+{
+    return transform(chaine,20);
+}*/
+

+ 25 - 0
Menu/transform.h

@@ -0,0 +1,25 @@
+#ifndef TRANSFORM_H_INCLUDED
+#define TRANSFORM_H_INCLUDED
+
+///Modifié le: 14/06/2013
+///Objet: couleur
+
+#include <iostream>
+#include <string>
+
+#include <SDL.h>
+#include <SDL_ttf.h>
+
+/*
+===La fonction transform===
+    +Définition:
+        Elle permet de convertir un string en SDL_Surface. Attention ! Stocker la valeur retournée dans
+        un pointeur et n'oubliez pas le SDL_FreeSurface ! Sinon, risque de fuite de mémoire.
+
+*/
+
+SDL_Surface* transform(std::string const chaine, int const taille, SDL_Color couleur);
+SDL_Surface* transform(std::string const chaine, int const taille);
+SDL_Surface* transform(std::string const chaine);
+
+#endif // TRANSFORM_H_INCLUDED

+ 32 - 0
Niveaux/level 1.txt

@@ -0,0 +1,32 @@
+Niveau test
+1
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
+1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0
+1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+intXSpawn
+intYSpawn
+floatResistance=>d=0.5
+floatGravite=>d=1.5
+intXBut
+intYBut

BIN
Polices/droid.ttf


+ 59 - 0
main.cpp

@@ -0,0 +1,59 @@
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#include <SDL.h>
+#include <SDL_ttf.h>
+
+#include "Jeu/jeu.h"
+#include "Menu/menu.h"
+
+///Main.cpp
+///Date de modification: 29_09_2013
+///Objet: finir le menu.cpp pour l'utiliser correctement ici
+///Prochaine étape:
+
+/*
+-Rôle de main.cpp:
+        Ce main géneral permet d'interphaser les sequences de jeu et de menu. Il permet également
+    l'ouverture et la fermeture des bibliothèques SDL et TTF.
+
+-Fichiers inclus:
+	+jeu.h:
+		Permet de lancer le jeu avec les infos reçues par le menu.
+    +menu.h:
+		Permet d'obtenir les informations au lancement du jeu (niveau selectionné).
+*/
+
+int main ( int argc, char** argv )
+{
+    /// [1] Démarrage
+    // [1.1] Démarrages SDL et TTF
+    if ( SDL_Init( SDL_INIT_VIDEO ) < 0 || TTF_Init() < 0 )
+    {
+        std::cout << "Impossible d'initialiser la SDL: " << SDL_GetError() << std::endl;
+        std::cout << "Ou problème de TTf: " << TTF_GetError() << std::endl;
+        return 1;
+    }
+
+    // [1.2] Préparation de fermeture
+    atexit(SDL_Quit);
+    atexit(TTF_Quit);
+
+    /// [2] Alternance jeu et menu
+    std::string choix;
+
+    do
+    {
+        choix = menu();
+        if (choix=="quitter")
+            break;
+    }while(jeu(choix));
+
+
+    /// [3] Destruction des composants
+    //rien à détruire
+
+    std::cout << "Main.cpp: Aucune erreur détectée." << std::endl;
+    return 0;
+}