Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

can't render more than one line with this code

$
0
0

why I can't render more than one line with this code it's render only last line with loadtext() ,this is the code:

void Ltext::loadtext(const char* text, SDL_Color textColor,SDL_Renderer* gren)

{

 

free();

gFont = TTF_OpenFont("carson.ttf", 24);  

SDL_SetRenderDrawColor(gren, 255,255,255,255);

SDL_RenderClear(gren);

int n;

//Render text surface

   SDL_Surface* textSurface = TTF_RenderText_Solid(gFont, text, textColor);

if(textSurface != NULL)

{

 //Create texture from surface pixels

 mTexture = SDL_CreateTextureFromSurface(gren, textSurface);

 if (mTexture == NULL)

 {

  printf("Unable to create texture from rendered text! SDL Error: %s\n", SDL_GetError());

 }

 //Get rid of old surface …


Viewing all articles
Browse latest Browse all 17560

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>