#include "base.h"
//#include "android.h"
#include "graphics.h"
#include "exb.h"
/*
手机C多点触控 手机C4.6以上版本才能运行
判断第i号手指是否按下
int touch_isdown(int i);
获取第i号手指的x坐标
int touch_getx(int i);
获取第i号手指的y坐标
int touch_gety(int i);
风的影子 编写
手机C论坛:http://bbs.yzjlb.net
*/
int timer;
#ifdef TCC
void logoc(int data);
#endif
int init(){
drawCir(0,0,60,0xffaaaaaa);
setscrsize(720, 720*SCRH/SCRW);
timer = timercreate();
#ifdef TCC
timerstart(timer,20,1,logoc,TRUE);
#else
timerstart(timer,30,1,"logoc",TRUE);
#endif
int c=0;
char *ptr = NULL;
// *ptr =0;
return 0;
}
//绘制一个圆形文字
void
drawCirText(char *text,int
x,int y, int color){
int w=0,h=0;
drawCir(x,y-60,32,color);
textwh(text,0,1,&w,&h);
dtext(text, x-w/2,y-h/2-60, 20,20,20,0,1);
}
void logoc(int data){
cls(0,0,0);
char temp[300];
int is_touch = 0;
for(int i=0;i<5;i++){
if(touch_isdown(i)){
is_touch=1;
int x = touch_getx(i);
int y = touch_gety(i);
sprintf(temp,"%d",i);
drawCirText(temp,x,y,0xffffffff);
sprintf(temp,"%3d, %d", x,y);
dtext(temp, 0,0, 240,240,240, 0,1);
}
}
if(is_touch==0){
dtext("滑动屏幕显示手指id",30,30, 240,240,240, 0,1);
}
int _time = getuptime();
ref(0,0,SCRW,SCRH);
printf("time=%02d\n", getuptime()- _time);
}
int event(int type,int p1,int p2){
if(type==MS_UP){
//toast("touch up",0);
}
if(type==KY_UP){
#ifndef TCC
exitApp();
#endif
exit();
}
return 0;
}
int pause(){
return 0;
}
int resume(){
return 0;
}
int exitApp(){
timerdel(timer);
return 0;
}