为了账号安全,请及时绑定邮箱和手机立即绑定

如何更改触摸板的大小?

如何更改触摸板的大小?

MMTTMM 2022-09-23 21:47:20
//x and y is absolute coordinate of the touchpad//dx and dy is the change in mouse position since the last acquisition// the variables screenX and screenY are the new positions x and y on the screenvar maxScreenX =800;  // width Screenvar maxScreenY =300;  // height Screenfunction transfer1(x,y,dx,dy){}触摸板的尺寸为200x200,但我想在屏幕的尺寸上绘制800x300,以便我可以从一端绘制到另一端。我该怎么做?
查看完整描述

1 回答

?
一只名叫tom的猫

TA贡献1906条经验 获得超2个赞

不确定我是否正确理解了这个问题,但我假设你只想将x和y坐标从200x200转换为800x300。


function transfer1(x,y,dx,dy)

{

  dx += x*maxScreenX/200

  dy += y*maxScreenY/200

}

这假设帧的中心是,因此值可以是负数,如果不是这种情况,您将需要一些语句来处理递减[x=0, y=0]if


查看完整回答
反对 回复 2022-09-23
  • 1 回答
  • 0 关注
  • 59 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信