1rs post. Newbie in SGDK.
Posted: Mon Dec 02, 2013 12:25 pm
Hi all,
First of all, sorry about my english.
I've just started reading about how to create your own code (games, demos, ...) and copile it to run in emulators or even in real hardware. It's amazing.
I've done my first pseudo ASCII pong game. Whole code is very basic and without order. I'm sure that it can be improved, but i'm just testing methods and codes.
You can find the code here: http://codetidy.com/7445/
As you can see (if you compile it) that there's no counters in this game: only walls, ball and rackets.
I've been trying to make some kind of counter, that's not difficult because you only have to increase some variable in every rebound.
My problem is when I try to write this value on the screen.
I've been trying using VDP_drawText but it looks that it doesn't accepts integers. It only accepts strings.
That's the funcion found in vdp_gb.h
void VDP_drawText(const char *str, u16 x, u16 y)
There's another function that I think I can use to convert integers to string, but I don't know how to use them. I've tried several times but without result.
Here those two functions (string.h):
void intToStr(s32 value, char *str, s16 minsize);
or maybe
void uintToStr(u32 value, char *str, s16 minsize);
I just only want to convert my rebounds counter into string to be displayed in VDP_drawText.
Any idea or example to do that? Thank you!
First of all, sorry about my english.
I've just started reading about how to create your own code (games, demos, ...) and copile it to run in emulators or even in real hardware. It's amazing.
I've done my first pseudo ASCII pong game. Whole code is very basic and without order. I'm sure that it can be improved, but i'm just testing methods and codes.
You can find the code here: http://codetidy.com/7445/
As you can see (if you compile it) that there's no counters in this game: only walls, ball and rackets.
I've been trying to make some kind of counter, that's not difficult because you only have to increase some variable in every rebound.
My problem is when I try to write this value on the screen.
I've been trying using VDP_drawText but it looks that it doesn't accepts integers. It only accepts strings.
That's the funcion found in vdp_gb.h
void VDP_drawText(const char *str, u16 x, u16 y)
There's another function that I think I can use to convert integers to string, but I don't know how to use them. I've tried several times but without result.
Here those two functions (string.h):
void intToStr(s32 value, char *str, s16 minsize);
or maybe
void uintToStr(u32 value, char *str, s16 minsize);
I just only want to convert my rebounds counter into string to be displayed in VDP_drawText.
Any idea or example to do that? Thank you!