I have some simple code that looks like this:
printf("Press zero or back to exit\n");
maSetColor(0x0055ff);
maFillRect(10,10,100,100);
maUpdateScreen();
This runs, but when it's like this:
maSetColor(0x0055ff);
maFillRect(10,10,100,100);
maUpdateScreen();
printf("Press zero or back to exit\n");
printf
erases the screen.
Why is this? Is this a normal property of printf()
? Is there a different print function I should use to print on top of everything, instead of erasing everything? I know I can use MoSync's MaDrawText()
instead, but I was wondering if there was a print function that would also work.
This is expected behavior,
printf()
will display text in a seperate screen. The alternative ismaDrawText(int left, int top, const char* str);
which will allow you to draw the text in the paint area.Your code could look like:
Your first example works because you are calling the function before you update the screen and hence printf() will not draw on top of your current drawing.