Hello,
I am new to the forum that I have already been browsing for a few weeks, I thank the author of this bookstore (SGDK) who opened the doors to me to programming on Megadrive in C Language, as well as all the participants / members of this forums that enrich this section of the forum, it helps a lot.
So I come to ask for help / advice for something I want to check.
I would like to track the value of a variable of type "int / s16" ingame to realize that it takes the values I want during a collision.
First, I managed to do it using multiple loop if (value == v) {VDP_drawTextBG (plan, "value = v"), x, y}. but it's long and not very clean.
In fact VDP_drawTextBG (), takes a "const * char" as a parameter and as my variable is an s16 that's a problem, there is indeed a FIX16toStr () function which converts an s16 to char * in the string.h file.
Is there a way to convert s16 to const * char?
Display a variable on the screen[resolved]
Moderator: Stef
Display a variable on the screen[resolved]
Last edited by izidor on Wed Feb 03, 2021 6:19 am, edited 1 time in total.
Re: Display a variable on the screen[resolved]
It's resolved with sprintf(), I had not seen this function.
Code: Select all
char str_Region[2] = "0";
void RegionDisplay()
{
sprintf(str_Region,"%d",indexReg);
VDP_clearTextAreaBG(BG_B,15,10,2,1);
VDP_drawTextBG(BG_B,str_Region,15,10);
}
-
- Very interested
- Posts: 118
- Joined: Mon Feb 19, 2018 7:31 pm
Re: Display a variable on the screen[resolved]
Hi.
You can use Gens Kmod, open degug > messages.
In your code put:
You can use Gens Kmod, open degug > messages.
In your code put:
Code: Select all
KLog_U1("test:", intVARIABLE);
Re: Display a variable on the screen[resolved]
Thank you for the information,
it's not falling on deaf ears !!
it's not falling on deaf ears !!
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Display a variable on the screen[resolved]
Yeah GEns Kmod debugging is really more convenient than trying to display value on screen.
Don't forget to enable active debug feature in Gens KMod otherwise message logging won't work !
Don't forget to enable active debug feature in Gens KMod otherwise message logging won't work !