Mercurial > sdl-ios-xcode
diff test/nds-test-progs/general/source/main.c @ 2696:0b395a60deff gsoc2008_nds
Timers work now.
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Mon, 18 Aug 2008 07:29:52 +0000 |
parents | c1c7cb1b5a47 |
children | e1da92da346c |
line wrap: on
line diff
--- a/test/nds-test-progs/general/source/main.c Sun Aug 17 09:50:28 2008 +0000 +++ b/test/nds-test-progs/general/source/main.c Mon Aug 18 07:29:52 2008 +0000 @@ -32,7 +32,7 @@ SDL_Surface *screen; SDL_Joystick *stick; SDL_Event event; - SDL_Rect rect = {8,8,240,176}; + SDL_Rect rect = {0,0,256,192}; int i; consoleDemoInit(); puts("Hello world! Initializing FAT..."); @@ -68,23 +68,14 @@ while(SDL_PollEvent(&event)) switch(event.type) { case SDL_JOYBUTTONDOWN: - switch(event.jbutton.which) { - case 0: - SDL_FillRect(screen, &rect, RGB15(31,0,0)|0x8000); - break; - case 1: - SDL_FillRect(screen, &rect, RGB15(0,31,0)|0x8000); - break; - case 2: - SDL_FillRect(screen, &rect, RGB15(0,0,31)|0x8000); - break; - case 3: - SDL_FillRect(screen, &rect, RGB15(0,0,0)|0x8000); - break; - default: break; - } - printf("joy_%d, at %d\n", event.jbutton.which, SDL_GetTicks()); - SDL_Flip(screen); + SDL_FillRect(screen, &rect, (u16)rand()|0x8000); + SDL_Flip(screen); + if(rect.w > 8) { + rect.x += 4; rect.y += 3; + rect.w -= 8; rect.h -= 6; + } + printf("button %d pressed at %d ticks\n", + event.jbutton.which, SDL_GetTicks()); break; case SDL_QUIT: SDL_Quit(); return 0; default: break;