Welcome! Log In Create A New Profile

Advanced

Format printf outputs

Posted by SpaceJump 
Format printf outputs
December 17, 2008 12:07AM
Is there a way to center printf outputs and to change the text color and background?
Re: Format printf outputs
December 17, 2008 07:29AM
Probably not automatically and yes, but it sucks.
The console is not meant to be used seriously. Move on before it drags you down with it.
Re: Format printf outputs
December 17, 2008 07:56AM
What do you suggest I should use?

Or could you tell me how I can move the text to the right. That would help me a lot.
Re: Format printf outputs
December 17, 2008 12:21PM
I recommend that you roll your own text layout system. Or just chose a place to show the text on the screen and use some text rendering library.
Re: Format printf outputs
December 17, 2008 02:20PM
But if it's just about little testing, the printf is good enough. The key for your problems is escape code: (following is direct quote from devkitpro's wii template
// The console understands VT terminal escape codes
	// This positions the cursor on row 2, column 0
	// we can use variables for this with format codes too
	// e.g. printf ("\x1b[%d;%dH", row, column );
	printf("\x1b[2;0H");
For other uses look for ANSI escape codes
For example changing color to green would go like:
printf("\x1b[32m")

Of course if you want to center text you have to know width and height of console and lenght of your text and a little maths



Edited 1 time(s). Last edit at 12/17/2008 02:22PM by Dande.
Sorry, only registered users may post in this forum.

Click here to login