s16/s32 and sprintf/VDP_drawText
Posted: Sun Apr 05, 2020 5:15 pm
Good day folks
Very stupid question. This is working well:
I can see 65000 on TV.
Also works with s16 with i.e. a = 32000 (as we need space for negative numbers).
Why this is not working:
No error here, just see 4464 not 70000. Same happens with u32.
Of course var_a is 70000 internally, just not sure if sprintf() or VDP_drawText() breaks something.
Why I can play with 16bit numbers but not with 32bit numbers with sprintf() or VDP_drawText()??
Very stupid question. This is working well:
Code: Select all
u16 var_a = 65000;
char my_string[32];
sprintf(my_string, "%u", var_a);
VDP_drawText(my_string, x, y); //x,y position in tiles
Also works with s16 with i.e. a = 32000 (as we need space for negative numbers).
Why this is not working:
Code: Select all
s32 var_a = 70000;
char my_string[32];
sprintf(my_string, "%ld", var_a);
VDP_drawText(my_string, x, y); //x,y position in tiles
Of course var_a is 70000 internally, just not sure if sprintf() or VDP_drawText() breaks something.
Why I can play with 16bit numbers but not with 32bit numbers with sprintf() or VDP_drawText()??