12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- //
- // Created by jovian on 18/07/17.
- //
- #ifndef TINYSHOOTER_RENDERER_H
- #define TINYSHOOTER_RENDERER_H
- #include <SDL.h>
- #include <vector>
- #include <map>
- #include <SDL_ttf.h>
- #include "Visual.h"
- #include "../Contents/PlanetDef.h"
- class Renderer {
- public :
- Renderer();
- virtual ~Renderer();
- bool initialize(); // Initialize SDL and load features (return false if error)
- void clearWindow(); // Clear all content
- void renderScene(std::vector<Visual *> &scope, const b2Vec2 ¢er, float zoom); // Displays a view
- void renderPlanetHUD(PlanetDef def);
- void renderName(SDL_Rect &dst, std::string name);
- void renderBar(int y, const int &value);
- void presentWindow(); // Refresh window
- SDL_Window *getWindow() const;
- private:
- bool loadPicture(std::string name); // Load a single picture
- bool loadStringTexture(std::string name); // Load a texture from a string
- bool loadEveryPicture(); // Load all contents needed in the game
- 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
|