test/nds-test-progs/general/source/main.c
branchgsoc2008_nds
changeset 2696 0b395a60deff
parent 2694 c1c7cb1b5a47
child 2698 e1da92da346c
     1.1 --- a/test/nds-test-progs/general/source/main.c	Sun Aug 17 09:50:28 2008 +0000
     1.2 +++ b/test/nds-test-progs/general/source/main.c	Mon Aug 18 07:29:52 2008 +0000
     1.3 @@ -32,7 +32,7 @@
     1.4  	SDL_Surface *screen;
     1.5  	SDL_Joystick *stick;
     1.6  	SDL_Event event;
     1.7 -	SDL_Rect rect = {8,8,240,176};
     1.8 +	SDL_Rect rect = {0,0,256,192};
     1.9  	int i;
    1.10  
    1.11  	consoleDemoInit(); puts("Hello world!  Initializing FAT...");
    1.12 @@ -68,23 +68,14 @@
    1.13  	while(SDL_PollEvent(&event))
    1.14  	switch(event.type) {
    1.15  		case SDL_JOYBUTTONDOWN:
    1.16 -		switch(event.jbutton.which) {
    1.17 -			case 0:
    1.18 -			SDL_FillRect(screen, &rect, RGB15(31,0,0)|0x8000);
    1.19 -			break;
    1.20 -			case 1:
    1.21 -			SDL_FillRect(screen, &rect, RGB15(0,31,0)|0x8000);
    1.22 -			break;
    1.23 -			case 2:
    1.24 -			SDL_FillRect(screen, &rect, RGB15(0,0,31)|0x8000);
    1.25 -			break;
    1.26 -			case 3:
    1.27 -			SDL_FillRect(screen, &rect, RGB15(0,0,0)|0x8000);
    1.28 -			break;
    1.29 -			default: break;
    1.30 -		}
    1.31 -		printf("joy_%d, at %d\n", event.jbutton.which, SDL_GetTicks());
    1.32 -		SDL_Flip(screen);
    1.33 +			SDL_FillRect(screen, &rect, (u16)rand()|0x8000);
    1.34 +			SDL_Flip(screen);
    1.35 +			if(rect.w > 8) {
    1.36 +				rect.x += 4; rect.y += 3;
    1.37 +				rect.w -= 8; rect.h -= 6;
    1.38 +			}
    1.39 +			printf("button %d pressed at %d ticks\n",
    1.40 +			       event.jbutton.which, SDL_GetTicks());
    1.41  		break;
    1.42  		case SDL_QUIT: SDL_Quit(); return 0;
    1.43  		default: break;