#39780 - human_tree - Tue Apr 12, 2005 5:55 am
Hey all.. This may be a simple question, but is there a way to print text (using consolePrintf()) to the second screen?
Also, how do I print an integer using consolePrintf(), or should I use a different function? Thanks for any help.
#39809 - maniacdevnull - Tue Apr 12, 2005 3:26 pm
human_tree wrote: |
Also, how do I print an integer using consolePrintf(), or should I use a different function? Thanks for any help. |
Don't know the answer to your first question, but to print an int with printf, do something like this:
Code: |
int i;
consolePrintf("The value is i is %d",i);
|
and it will put the value of i where the %d is. YOu can also do this with more that one variable, like so:
Code: |
int i;
int j;
consolePrintf("The value is i is %d and j is %d", i, j);
|
and it will put the variables into the %d markers in the order they are listed
#39852 - human_tree - Tue Apr 12, 2005 10:56 pm
Yay, thanks very much.. I'd tried using %d but I'd forgotten the integer name had to go after a comma... D'oh.. For the while I was using consolePutInt() which wasn't fun, trying to guess X and Y values.. But now I don't have to, thanks for your help..
#39877 - FeaRog - Wed Apr 13, 2005 3:30 am
In the example programs (eg hello world) near the start of the arm9 main function you'll notice some functions are called - can't remember the names exactly but along the lines of SetMode and SetBank - involving BG0. there are *Sub versions of some of the functions, and SUB_ versions of some of the definitions - I'd suggest looking up all the calls that look like video initialisation in ndslib/include/NDS/arm9/video.h - thats how I figured out how to do it :) I'd give you some code if I were at home, but I'm at work at the moment so I don't have access to it.
Hope that helps!
#39987 - dovoto - Thu Apr 14, 2005 6:11 am
Currently you can not print to both screens at the same time as there is only state variables (cursor position and that sort of thing) for one screen at a time. You can however print to either sub or main display and any background layer as long as you specify the correct color depth to the init function.
_________________
www.drunkencoders.com