Heres the function
SDL_Surface *draw_wordbreak( char *input) {
char *token;
int drawY = 0;
SDL_Surface *tempSurface = NULL;
printf("Splitting string in to tokens : %s \ninto tokens:\n", input);
token = strtok(input,",");
while(token != NULL) {
printf("TOKEN : %s \n",token);
SDL_Surface *txtTmp = NULL;
txtTmp = TTF_RenderText_Solid(base_font, token, blueColor);
apply_surface(0,drawY,txtTmp,tempSurface);
SDL_FreeSurface(txtTmp);
token = strtok(NULL,",");
drawY += 20; // move the next line down
}
return tempSurface;
}
this is from the main file
// the data to be made in to text
char tempData[100] = "this is some example,Data to show off the wordbreak,Function for the sdl_ttf";
// setup the surface for the text to be transfer to
SDL_Surface *story_text_001;
// where the function is used
story_text_001 = draw_wordbreak(tempData);
// then in the render loop is where it should get applied
apply_surface(85,85,story_text_001,screen);
// screen is the display device and apply_surface works fine it been tested with many
// others sdl surfaces
When i do this the story_text_001 surface does not have any text like it should ?