80 SDL_Surface *surf = TTF_RenderText_Solid(f.
wrapper().unwrap(),text.c_str(),
color_value);
85 SDL_Texture *tex = SDL_CreateTextureFromSurface(
renderer, surf);
88 SDL_FreeSurface(surf);
91 SDL_Rect rc = {x,y,surf->w,surf->h};
92 SDL_RenderCopy(
renderer, tex,
nullptr, &rc);
93 SDL_FreeSurface(surf);
94 SDL_DestroyTexture(tex);
98 SDL_Surface *surf = TTF_RenderText_Blended(f.
wrapper().unwrap(),text.c_str(),
color_value);
103 SDL_Texture *tex = SDL_CreateTextureFromSurface(
renderer, surf);
106 SDL_FreeSurface(surf);
109 SDL_Rect rc = {x,y,surf->w,surf->h};
110 SDL_RenderCopy(
renderer, tex,
nullptr, &rc);
111 SDL_FreeSurface(surf);
112 SDL_DestroyTexture(tex);
void setRenderer(SDL_Renderer *renderer)
Set the SDL renderer used for all draw calls.
void printText_Blended(const Font &f, int x, int y, const std::string &text)
Render text with blended (anti-aliased) quality.
void setColor(SDL_Color color)
Set the colour used when rendering text.
void printText_Solid(const Font &f, int x, int y, const std::string &text)
Render text with solid (no anti-aliasing) blending.