SDLPP: Use FontConfiguration to store font configuration
With this it is possible to only store 1 configuration object as opposed to storing font configuration inside every TextRenderer
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#ifndef SDLPP_HPP_FONT_CONFIGURATION
|
||||
#define SDLPP_HPP_FONT_CONFIGURATION
|
||||
|
||||
#include "sdlpp_common.hpp"
|
||||
#include "sdlpp_font.hpp"
|
||||
|
||||
namespace SDLPP {
|
||||
class SDLPPSCOPE FontConfiguration {
|
||||
public:
|
||||
FontConfiguration() = delete;
|
||||
FontConfiguration( std::shared_ptr< Font > font, const std::string &color,
|
||||
const std::string &outline_color, double outline_size ) {
|
||||
_font = font;
|
||||
_color = color;
|
||||
_outline_color = outline_color;
|
||||
_outline_size = outline_size;
|
||||
}
|
||||
|
||||
const std::shared_ptr< Font > &getFont() {
|
||||
return _font;
|
||||
}
|
||||
|
||||
const std::string &getColor() {
|
||||
return _color;
|
||||
}
|
||||
|
||||
const std::string &getOutlineColor() {
|
||||
return _outline_color;
|
||||
}
|
||||
|
||||
const double &getOutlineSize() {
|
||||
return _outline_size;
|
||||
}
|
||||
|
||||
void setColor( const std::string &color ) {
|
||||
_color = color;
|
||||
}
|
||||
|
||||
void setOutlineColor( const std::string &outline_color ) {
|
||||
_outline_color = outline_color;
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr< Font > _font;
|
||||
std::string _color;
|
||||
std::string _outline_color;
|
||||
double _outline_size;
|
||||
};
|
||||
} // namespace SDLPP
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user