Hello,
Its certainly not hard to write text to the screen in SGDK. I wonder though if there is some way to write a number (a variable), to see how many coins left on a level etc etc.
Writing integers
Moderator: Stef
-
- Very interested
- Posts: 117
- Joined: Sun Jan 02, 2011 9:14 pm
- Contact:
Re: Writing integers
Use intToStr() and uintToStr() functions this way
Code: Select all
void drawInt( u32 nb, u8 x, u8 y, u8 zeros )
{
s8 str [ zeros+1 ];
intToStr ( nb, str, zeros );
SYS_disableInts();
VDP_drawText ( str, x, y );
SYS_enableInts();
}
void drawUInt( u32 nb, u8 x, u8 y, u8 zeros )
{
s8 str [ zeros+1 ];
uintToStr ( nb, str, zeros );
SYS_disableInts();
VDP_drawText ( str, x, y );
SYS_enableInts();
}
Re: Writing integers
Worked flawlessly thank you