Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Renderer::DrawText(int x, int y, HFont fnt, const wchar_t *s)
- {
- if(IsValid() && Font_IsValid(fnt)) {
- SDL_Color color;
- color.r = m_drawColor.r;
- color.g = m_drawColor.g;
- color.b = m_drawColor.b;
- color.a = m_drawColor.a;
- SDL_Surface *sf = TTF_RenderUNICODE_Solid(m_FontMap[fnt], (Uint16 *)s, color);
- SDL_Texture *tx = SDL_CreateTextureFromSurface(m_renderer, sf);
- int w, h;
- SDL_QueryTexture(tx, nullptr, nullptr, &w, &h);
- SDL_Rect dst = { x, y, w, h };
- SDL_RenderCopy(m_renderer, tx, nullptr, &dst);
- SDL_DestroyTexture(tx);
- SDL_FreeSurface(sf);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment