2020-11-21 19:57:40 +00:00
|
|
|
#ifndef SDLPP_HPP_TEXTURE
|
|
|
|
#define SDLPP_HPP_TEXTURE
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "sdlpp_common.hpp"
|
|
|
|
#include "sdlpp_font.hpp"
|
|
|
|
#include "sdlpp_renderer.hpp"
|
|
|
|
|
|
|
|
namespace SDLPP {
|
2020-11-22 22:37:55 +00:00
|
|
|
class SDLPPSCOPE Texture {
|
2020-11-21 19:57:40 +00:00
|
|
|
public:
|
|
|
|
Texture() = delete;
|
|
|
|
Texture( std::shared_ptr< Renderer > &renderer,
|
|
|
|
const std::string &img_path )
|
|
|
|
: Texture( renderer, img_path, "" ) {}
|
|
|
|
Texture( std::shared_ptr< Renderer > &renderer, const std::string &img_path,
|
|
|
|
const std::string &color_key );
|
|
|
|
Texture( std::shared_ptr< Renderer > &renderer, Font &font,
|
|
|
|
const std::string &text, const std::string &color = "FFFFFF",
|
|
|
|
const std::string &outline_color = "000000",
|
|
|
|
const int outline_size = -1 );
|
|
|
|
virtual ~Texture();
|
|
|
|
SDL_Texture *getTexturePtr();
|
2021-03-07 12:18:58 +00:00
|
|
|
void setAlpha( uint8_t alpha );
|
2020-11-21 19:57:40 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void setTextureFromSurface( std::shared_ptr< Renderer > &renderer,
|
|
|
|
SDL_Surface *surface );
|
|
|
|
SDL_Texture *texture = NULL;
|
|
|
|
};
|
|
|
|
} // end of namespace SDLPP
|
|
|
|
#endif
|