Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Nov 8th, 2010  |  syntax: None  |  size: 0.43 KB  |  hits: 121  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <SDL/SDL_ttf.h>
  2.  
  3.  
  4. TTF_Init();
  5. TTF_Font *font;
  6.  
  7. font = TTF_OpenFont("somefont.ttf", 24); /* 24 is the size */
  8.  
  9. /* char* texto */
  10. SDL_Color foregroundColor = { 255, 255, 0 };
  11. SDL_Color backgroundColor = { 0, 0, 0 };
  12. SDL_Surface* textSurface = TTF_RenderText_Shaded(font, texto,
  13.    foregroundColor, backgroundColor);
  14.  
  15.  
  16. SDL_Rect textLocation = { 0, 0, 0, 0 };
  17. SDL_BlitSurface(textSurface, NULL, scr, &textLocation);