Renderer.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // Created by jovian on 18/07/17.
  3. // Adapted for MetaBall
  4. #ifndef TINYSHOOTER_RENDERER_H
  5. #define TINYSHOOTER_RENDERER_H
  6. #include "../constantes.h"
  7. #include <SDL.h>
  8. #include <vector>
  9. #include <map>
  10. #include <SDL_ttf.h>
  11. class Renderer {
  12. public :
  13. Renderer();
  14. virtual ~Renderer();
  15. bool initialize(); // Initialize SDL and load features (return false if error)
  16. void clearWindow(); // Clear all content
  17. void renderName(SDL_Rect &dst, std::string name);
  18. void renderBoolMatrix(bool mat[WIN_H][WIN_W]);
  19. void presentWindow(); // Refresh window
  20. SDL_Window *getWindow() const;
  21. private:
  22. bool loadStringTexture(std::string name); // Load a texture from a string
  23. protected:
  24. int m_screenWidth;
  25. int m_screenHeight;
  26. SDL_Window *m_window; // SDL main window
  27. SDL_Renderer *m_renderer; // SDL main renderer
  28. TTF_Font *m_font; // TTF main font
  29. std::vector<SDL_Texture *> m_pictureTab; // Every game texture
  30. std::map<std::string, SDL_Texture *> m_stringTab; // Every game name texture
  31. };
  32. #endif //TINYSHOOTER_RENDERER_H