gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Clear Display Help :O

#165196 - bing - Fri Dec 12, 2008 10:18 am

Hello,

how can i clear the display? :o



Code:
#include <mygba.h>

int main() {
 ham_Init();
 ham_InitText(0);

int xpos=9,ypos=9;
ham_DrawText(xpos,ypos,"Beweglich!");

while(!F_CTRLINPUT_START_PRESSED) {
 if(F_CTRLINPUT_RIGHT_PRESSED) {
   xpos++;
   system("cls");
   ham_DrawText(xpos,ypos,"Beweglich!"); }
 else if(F_CTRLINPUT_LEFT_PRESSED) {
   xpos--;
   system("cls");
   ham_DrawText(xpos,ypos,"Beweglich!"); }
 else if(F_CTRLINPUT_UP_PRESSED) {
   ypos--;
   system("cls");
   ham_DrawText(xpos,ypos,"Beweglich!"); }
 else if(F_CTRLINPUT_DOWN_PRESSED) {
   ypos++;
   system("cls");
   ham_DrawText(xpos,ypos,"Beweglich!"); }
 }

return 0;
}


As you can see, i tried "system("cls")", but it doesn`t work. :(

So please help me out.




Bing :)

#165197 - kusma - Fri Dec 12, 2008 11:38 am

[Images not permitted - Click here to view it]

#165200 - bing - Fri Dec 12, 2008 1:36 pm

kusma wrote:
[Images not permitted - Click here to view it]

Sorry, I don?t get it. :o

#165203 - Maxxie - Fri Dec 12, 2008 2:21 pm

Neither do i.

On the problem: the call system("cls") does not clear the screen itself. It's calling the system to execute the command "cls". If there is no system or it does not know what "cls" means, it just fails (as it does here)

Since you are accessing the display via ham anyways, why not stick with the ham_* functions? There got to be one for clearing the screen in it (dont know ham libs myself).

Maybe you should start with a tutorial first.
_________________
Trying to bring more detail into understanding the wireless hardware

#165212 - bing - Fri Dec 12, 2008 11:30 pm

Maxxie wrote:
Neither do i.

On the problem: the call system("cls") does not clear the screen itself. It's calling the system to execute the command "cls". If there is no system or it does not know what "cls" means, it just fails (as it does here)

Since you are accessing the display via ham anyways, why not stick with the ham_* functions? There got to be one for clearing the screen in it (dont know ham libs myself).

Maybe you should start with a tutorial first.

I?m really sorry, but i can?t find a fuction like this. :o

#165223 - silent_code - Sat Dec 13, 2008 2:04 pm

There's an escape sequence, which is handled in libnds, that clears the console; maybe that's a good starting point?
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#165230 - gmiller - Sat Dec 13, 2008 6:41 pm

I see you are using the HAM library calls and maybe running GBA code because of that. The "system()" call allows access to the CLI (command line interpreter). The GBA does not have a CLI in it and only if you linked one is would it have. You need to find the "ham API" call to clear the screen or stop using ham and do it yourself..