ive decided to make a game similar to adventure capitalist using SDL2 and TTF and it appears i cannot render a number higher than the maximum number of a signed 32 bit integer, but i want to be able to render number as high as the maximum value of an unsigned 64 bit integer, is there any way i can get around this rather low limitation?
You can render arbitrary strings, so make a string:
char str; SDL_snprintf(str, sizeof (str), "%" SDL_PRIu64, MyUint64Value);
str instead of the original Uint64.
when ever i do that it works just as my original buffer did and renders the max value at -6, here is my buffer line:
SDL_DestroyTexture(ScoreTex); SDL_FreeSurface(ScoreSur); char ScoreBuf; sprintf_s(ScoreBuf, "Score: %i", (int)Score); ScoreSur = TTF_RenderText_Blended(ScoreFont, ScoreBuf, ScoreColor); ScoreTex = SDL_CreateTextureFromSurface(ren, ScoreSur); SDL_QueryTexture(ScoreTex, NULL, NULL, &Score_Rect.w, &Score_Rect.h);
sprintf_s(ScoreBuf, "Score: %i", (int)Score); casts the value to an int (which is a signed 32-bit value in this case) before converting it to a string.
Try this instead:
sprintf_s(ScoreBuf, "Score: %" SDL_PRIu64, (Uint64) Score);
there we go, thank you!