//
// Created by jovian on 18/07/17.
// Adapted for MetaBall

#ifndef TINYSHOOTER_RENDERER_H
#define TINYSHOOTER_RENDERER_H

#include "../constantes.h"
#include <SDL.h>
#include <vector>
#include <map>
#include <SDL_ttf.h>

class Renderer {
public :
    Renderer();

    virtual ~Renderer();

    bool initialize(); // Initialize SDL and load features (return false if error)

    void clearWindow(); // Clear all content
    void renderName(SDL_Rect &dst, std::string name);
    void renderBoolMatrix(bool mat[WIN_H][WIN_W]);
    void presentWindow(); // Refresh window

    SDL_Window *getWindow() const;

private:
    bool loadStringTexture(std::string name); // Load a texture from a string

protected:
    int m_screenWidth;
    int m_screenHeight;

    SDL_Window *m_window; // SDL main window
    SDL_Renderer *m_renderer; // SDL main renderer
    TTF_Font *m_font; // TTF main font
    std::vector<SDL_Texture *> m_pictureTab; // Every game texture
    std::map<std::string, SDL_Texture *> m_stringTab; // Every game name texture
};


#endif //TINYSHOOTER_RENDERER_H