Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // x = pos inicial
- // y = pos inicial
- // max_x = pos maxima X
- // sx = tamaño X fuente
- // sy = tamaño Y fuente
- // string ... formato + vars
- void drawWrappedString(float x, float y, float max_x, int sx, int sy, char *string, ...){
- char str[4096];
- va_list argp;
- va_start(argp, string);
- vsprintf(str, string, argp);
- va_end(argp);
- char *pch = NULL;
- pch = strtok(str, " ");
- float cx = x;
- float cy = y;
- while(pch != NULL){
- struct _SIZE size = GetTextSize(sx, sy, pch);
- if(cx + size.width >= max_x){
- DrawString(cx, cy, "\n");
- cy = GetFontY();
- cx = x;
- }
- DrawString(cx, cy, pch);
- DrawString(GetFontX(), cy, " ");
- cx = GetFontX();
- cy = GetFontY();
- pch = strtok(NULL, " ");
- }
- }
Add Comment
Please, Sign In to add comment