ScreenClick的用法
来源:互联网 发布:java mysql 函数传参 编辑:程序博客网 时间:2024/05/29 18:17
public class ScreenClick {public float x,y;public int I=-1,J=-1;public int priviousI=0,previousJ=0;public float xSpan,ySpan,xOffset,yOffset;public ScreenClick(float xSpan,float ySpan) {// TODO Auto-generated constructor stubthis.xSpan=xSpan;this.ySpan=ySpan;this.xOffset=xSpan;this.yOffset=ySpan-10;}public void setCoor1(float x,float y){this.x=x;this.y=y;judge1();}public void setCoor2(float x,float y){this.x=x;this.y=y;judge2();}public void judge1(){label1 :for(int i=0;i<10;i++){for(int j=0;j<13;j++){if(i%2==0){if(isInRect_ou(i,j)){SV_main.x1=i;SV_main.y1=j;if(priviousI==i&&previousJ==j){SV_main.count=1;}else {SV_main.count=0;if(SV_main.colorEdgeFlag1){SV_main.x1=priviousI;SV_main.y1=previousJ; SV_main.saveIndex[1]=getPreviousElementIndex();}} I=i;J=j; priviousI=i;previousJ=j; break label1;}}else {if(isInRect_ji(i,j)){SV_main.x1=i;SV_main.y1=j;if(priviousI==i&&previousJ==j){SV_main.count=1;}else {SV_main.count=0;if(SV_main.colorEdgeFlag1){SV_main.x1=priviousI;SV_main.y1=previousJ; SV_main.saveIndex[1]=getPreviousElementIndex();}} I=i;J=j; priviousI=i;previousJ=j;break label1;}}}}}public void judge2(){label1 :for(int i=0;i<10;i++){for(int j=0;j<13;j++){if(i%2==0){if(isInRect_ou(i,j)){SV_main.x2=i;SV_main.y2=j; I=i;J=j;break label1;}}else {if(isInRect_ji(i,j)){SV_main.x2=i;SV_main.y2=j; I=i;J=j;break label1;}}}}}private boolean isInRect_ou(int i,int j) {// TODO Auto-generated method stubif(xSpan*j+xOffset+50<x&&x<xSpan*(j+1)+50+xOffset&&ySpan*i+yOffset<y&&y<ySpan*(i+1)+yOffset){return true;}return false;}private boolean isInRect_ji(int i,int j) {// TODO Auto-generated method stubif(xSpan*j+xOffset*0.5f+50<x&&x<xSpan*(j+1)+xOffset*0.5f+50&&ySpan*i+yOffset<y&&y<ySpan*(i+1)+yOffset){return true;}return false;}public float getX(){return x;}public float getY(){return y;}public int getI(){return I;}public int getJ(){return J;}public int getElementIndex(){//点击按钮输出对应的坐标,system。outif(I==3&&J==10){return 0;//na}if(I==2&&J==1){return 1;//cl}if(I==7&&J==5){return 2;//h}if(I==6&&J==5){return 3;//o}return 0;}public int getPreviousElementIndex(){//点击按钮输出对应的坐标,system。outif(priviousI==3&&previousJ==10){return 0;//na}if(priviousI==2&&previousJ==1){return 1;//cl}if(priviousI==7&&previousJ==5){return 2;//h}if(priviousI==6&&previousJ==5){return 3;//o}return 0;}}
0 0
- ScreenClick的用法
- ?的用法
- ?的用法
- ---" ~ " 的用法---
- ---" ~ " 的用法---
- ~ 的用法
- 的用法
- ##的用法
- ##的用法
- 的用法
- ${ }的用法
- ##的用法
- ${ }的用法
- "->"的用法
- ${ }的用法
- >>的用法
- &的用法
- ${}的用法
- Git详解之二:Git基础
- 【android】知识点
- ubuntu进入字符界面
- C语言基础:函数指针
- Unsupported major.minor version 51.0解决办法
- ScreenClick的用法
- UVa 122 - Trees on the level【二叉树初接触(BFS)】
- CPU GPU设计工作原理《转》
- arc
- Objective-c的@property 详解
- HttpServlet动态生成图像
- Spring Aop代理
- 24点游戏算法
- 理解RESTful架构