当一串文本过去300
时,我希望它下降到一个新行并继续。我读到这就是你的做法,但它不起作用 - 它只是延长了文本。
如何做到这一点?
const char* message = "example text to test that it drops to a new line.";
std::string fontFile = "Font/font.ttf";
int fontSize = 16;
TTF_Font *font = nullptr;
font = TTF_OpenFont(fontFile.c_str(), fontSize);
SDL_Color textColor = { 0, 300, 200 };
SDL_Surface *surf = TTF_RenderText_Blended_Wrapped(font, message, textColor, 300);
texture = SDL_CreateTextureFromSurface(m_p_Renderer, surf);
int w,h;
TTF_SizeText(font,message,&w,&h);
srcRect.x = 0;
srcRect.y = 0;
destRect.x = 0;
destRect.y = 0;
srcRect.w =w;
srcRect.h = h;
destRect.w =w;
destRect.h = h;