make refresh function public for sb::Text
This commit is contained in:
parent
fb68938889
commit
c7fb948e39
|
@ -68,7 +68,7 @@ void Text::refresh()
|
||||||
{
|
{
|
||||||
/* Render the text with transparent background as RGBA pixel data using the SDL image library. */
|
/* Render the text with transparent background as RGBA pixel data using the SDL image library. */
|
||||||
// std::shared_ptr<SDL_Surface> blended {TTF_RenderText_Blended(_font.get(), _content.c_str(), _foreground), SDL_FreeSurface};
|
// std::shared_ptr<SDL_Surface> blended {TTF_RenderText_Blended(_font.get(), _content.c_str(), _foreground), SDL_FreeSurface};
|
||||||
std::shared_ptr<SDL_Surface> blended {TTF_RenderText_Blended_Wrapped(_font.get(), _content.c_str(), _foreground, 3000), SDL_FreeSurface};
|
std::shared_ptr<SDL_Surface> blended {TTF_RenderUTF8_Blended_Wrapped(_font.get(), _content.c_str(), _foreground, 3000), SDL_FreeSurface};
|
||||||
if (!blended)
|
if (!blended)
|
||||||
{
|
{
|
||||||
Log::sdl_error("Could not create text");
|
Log::sdl_error("Could not create text");
|
||||||
|
|
15
src/Text.hpp
15
src/Text.hpp
|
@ -25,16 +25,12 @@ namespace sb
|
||||||
std::optional<glm::vec2> _dimensions;
|
std::optional<glm::vec2> _dimensions;
|
||||||
GLint _scaling_quality = GL_LINEAR;
|
GLint _scaling_quality = GL_LINEAR;
|
||||||
|
|
||||||
/*!
|
|
||||||
* Load the texture with the appropriate SDL_Surface pixels created by the SDL TTF library.
|
|
||||||
*/
|
|
||||||
void refresh();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Construct a sb::Text object from a font, string, and background and foreground colors. A texture with the text rendered in the
|
* Construct a sb::Text object from a font, string, and background and foreground colors. A texture will be created and attached. The
|
||||||
* given colors will be created and attached to this object.
|
* texture is not generated or rendered. Text::refresh() must be called afterward with the GL context loaded. The content, dimensions,
|
||||||
|
* foreground, background, font, and scaling quality functions call Text::refresh() automatically.
|
||||||
*
|
*
|
||||||
* The font must be wrapped in a shared pointer. A default loaded font is available from Game::font().
|
* The font must be wrapped in a shared pointer. A default loaded font is available from Game::font().
|
||||||
*
|
*
|
||||||
|
@ -103,6 +99,11 @@ namespace sb
|
||||||
*/
|
*/
|
||||||
void scaling_quality(GLint quality);
|
void scaling_quality(GLint quality);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Load the texture with the appropriate SDL_Surface pixels created by the SDL TTF library.
|
||||||
|
*/
|
||||||
|
void refresh();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Convert the text object to a string with some debugging information.
|
* Convert the text object to a string with some debugging information.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue