//******************************************************* // a cockroach hunter for RexDK ver0.0.4 // product by H.Morotomi 2002.03.16 //******************************************************* #include #include #define DispWidth 240 #define DispHeight 120 #define CharWidth 8 #define CharHeight 26 #define Scor_X 200 #define Scor_Y 107 extern int __LIB__ DsPrintfe(int,int,int,char *); const char taro1[] = {0x08,0x1a,0x02,0x01,0x01,0x00,0x00,0x05,0x1b,0x26,0x3e,0x67,0xad,0x57,0x6f, 0xff,0xff,0xff,0xbf,0xff,0x1f,0x0f,0x03,0x04,0x08,0x08,0x10,0x00}; const char taro2[] = {0x08,0x1a,0x00,0x00,0x03,0xbc,0xc3,0x3e,0xf0,0xab,0xd6,0x6d,0xbb,0xbf,0xbf, 0x80,0xbb,0xbf,0xbf,0x5f,0x7b,0x76,0xed,0xf7,0x0b,0x00,0x00,0x00}; const char taro3[] = {0x08,0x1a,0x20,0x40,0xff,0x86,0xff,0xbf,0xd6,0x6b,0xb5,0x5e,0xf5,0xff,0xff, 0x00,0xff,0xff,0xff,0xff,0xfd,0xff,0xd6,0x7f,0xa4,0xdb,0x20,0x10}; const char taro4[] = {0x08,0x1a,0x00,0x03,0xfc,0x25,0xf8,0xf6,0xdd,0x6b,0xae,0xf5,0xaa,0xff,0xff, 0x00,0xff,0xff,0xff,0xff,0xff,0xdd,0xff,0xf8,0x06,0xeb,0x00,0x00}; const char taro5[] = {0x08,0x1a,0x00,0x80,0x00,0x00,0x00,0x00,0xc0,0x78,0xe4,0xbe,0xd7,0xab,0xff, 0x01,0xff,0xff,0xfa,0xf4,0x88,0xd0,0x20,0x80,0x00,0xa0,0x40,0x00}; char *taro_bmps[] = { taro1, taro2, taro3, taro4, taro5 }; //variable typedef struct MSG msg; POINT p; int scor; int Tmove(int Char_Y){ int Char_X=240,Char_X_old,x; int Char_Y_old,y; int i,f,flag,width; char str[10]; DsDisplayBlockClear(0,0,240,107); f=1; do{ if (Char_X<0){ DsDisplayBlockClear(0,Char_Y,CharWidth*5,CharHeight); } else{ DsDisplayBlockClear(Char_X_old,Char_Y,CharWidth*5,CharHeight); } for(i=0;i<5;i++){ x=Char_X+i*CharWidth; if ((x>=0)&&(x<=232)){ DsDisplayBitmapDraw( x, Char_Y, taro_bmps[i] , 0); } } flag=1; while(flag){ x=Char_X;y=Char_Y;width=CharWidth*5; if(Char_X<0){ x=0;width=width+Char_X; } DsTouchDataGet(p); DsSleep(level); if(((p.PointX > x)&&(p.PointX < x+width))&&((p.PointY>Char_Y)&&(p.PointY < Char_Y+CharHeight))){ scor +=1; DsDisplayBlockClear(Scor_X,Scor_Y,40,12); itoa(str,scor);DsPrintfe(Scor_X,Scor_Y,0,str); if (Char_X<0){ DsDisplayBlockClear(0,Char_Y,CharWidth*5,CharHeight); } else{ DsDisplayBlockClear(Char_X,Char_Y,CharWidth*5,CharHeight); } return 0; } p.PointX=255;p.PointY=255; DsEventMessageGet(msg); switch (msg.message) { case MSG_DS_KEY_DOWN: if(msg.sCode==KEY_ENTER_A) {flag=0;} break; } } Char_X_old = Char_X; Char_X -=CharWidth; if(Char_X<(-5*CharWidth)){ f=0; } }while(f); return 1; } main(){ int y; while(1){ DsEventMessageGet(msg); switch (msg.message) { case MSG_DS_KEY_DOWN: if(msg.sCode==KEY_ENTER_A) { y = (rand()%5)*20; Tmove(y);} break; } } }