#ifndef NIVEAU_H
#define NIVEAU_H

#include <iostream>
#include <SDL/SDL.h>
#undef main
#include <vector>
#include "Flux/SpriteLoader.h"

///Faire une fonction set pour modif tableau et image
///Gérer les mvts de caisse
///Améliorer les collisions : portes

struct Perso
{
    Uint16 x;
    Uint16 y;
    SDL_Surface* skin;
};

class Niveau
{
    public:
        Niveau(SpriteLoader* spriteGet);
        ~Niveau();

        void majLevel(char newTerrain[18][24]);
        void afficher(SDL_Surface* screen);
        bool test(Uint16 y, Uint16 x, short dirX, short dirY);
        char getCase(Uint16 y, Uint16 x);
        void setCase(Uint16 y, Uint16 x, char bloc);
        bool deplacer(char ID, char ordre);
        void updateBoutons();
        bool suisJeArrive(char ID);

    protected:
        SDL_Surface* m_terrain;
        SpriteLoader* m_spriteGet;
        char m_tabl[18][24];//y;x
        Perso m_perso[2];
        std::map<char, std::string> m_pass;
        SDL_Rect m_blitPos;
        bool m_caisses[18][24];//y;x
        std::map<char, std::pair<bool, std::vector<int>[2] > > m_gates;
        Uint32 tabColor[26];
};

#endif // NIVEAU_H