本文整理汇总了Java中com.watabou.utils.PointF.distance方法的典型用法代码示例。如果您正苦于以下问题:Java PointF.distance方法的具体用法?Java PointF.distance怎么用?Java PointF.distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.watabou.utils.PointF
的用法示例。
在下文中一共展示了PointF.distance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTouchDown
import com.watabou.utils.PointF; //导入方法依赖的package包/类
@Override
protected void onTouchDown(Touch t) {
if (t != touch && another == null) {
if (!touch.down) {
touch = t;
onTouchDown(t);
return;
}
pinching = true;
another = t;
startSpan = PointF.distance(touch.current, another.current);
startZoom = camera.zoom;
dragging = false;
} else if (t != touch) {
reset();
}
}
示例2: onTouchDown
import com.watabou.utils.PointF; //导入方法依赖的package包/类
@Override
protected void onTouchDown( Touch t ) {
if (t != touch && another == null) {
if (!touch.down) {
touch = t;
onTouchDown( t );
return;
}
pinching = true;
another = t;
startSpan = PointF.distance( touch.current, another.current );
startZoom = camera.zoom;
dragging = false;
} else if (t != touch) {
reset();
}
}
示例3: onTouchDown
import com.watabou.utils.PointF; //导入方法依赖的package包/类
@Override
protected void onTouchDown( NoosaInputProcessor.Touch t ) {
if (t != touch && another == null) {
if (!touch.down) {
touch = t;
onTouchDown( t );
return;
}
pinching = true;
another = t;
startSpan = PointF.distance( touch.current, another.current );
startZoom = camera.zoom;
dragging = false;
}
}
示例4: onDrag
import com.watabou.utils.PointF; //导入方法依赖的package包/类
@Override
protected void onDrag(Touch t) {
camera.target = null;
if (pinching) {
float curSpan = PointF.distance(touch.current, another.current);
camera.zoom(GameMath.gate(PixelScene.minZoom, startZoom * curSpan
/ startSpan, PixelScene.maxZoom));
} else {
if (!dragging
&& PointF.distance(t.current, t.start) > dragThreshold) {
dragging = true;
lastPos.set(t.current);
} else if (dragging) {
camera.scroll.offset(PointF.diff(lastPos, t.current).invScale(
camera.zoom));
lastPos.set(t.current);
}
}
}
示例5: onDrag
import com.watabou.utils.PointF; //导入方法依赖的package包/类
@Override
protected void onDrag(Touch t) {
if (dragging) {
Camera c = content.camera;
c.scroll.offset(PointF.diff(lastPos, t.current)
.invScale(c.zoom));
if (c.scroll.x + width > content.width()) {
c.scroll.x = content.width() - width;
}
if (c.scroll.x < 0) {
c.scroll.x = 0;
}
if (c.scroll.y + height > content.height()) {
c.scroll.y = content.height() - height;
}
if (c.scroll.y < 0) {
c.scroll.y = 0;
}
lastPos.set(t.current);
} else if (PointF.distance(t.current, t.start) > dragThreshold) {
dragging = true;
lastPos.set(t.current);
}
}
示例6: onDrag
import com.watabou.utils.PointF; //导入方法依赖的package包/类
@Override
protected void onDrag( Touch t ) {
camera.target = null;
if (pinching) {
float curSpan = PointF.distance( touch.current, another.current );
camera.zoom( GameMath.gate(
PixelScene.minZoom,
startZoom * curSpan / startSpan,
PixelScene.maxZoom ) );
} else {
if (!dragging && PointF.distance( t.current, t.start ) > dragThreshold) {
dragging = true;
lastPos.set( t.current );
} else if (dragging) {
camera.scroll.offset( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) );
lastPos.set( t.current );
}
}
}
示例7: onDrag
import com.watabou.utils.PointF; //导入方法依赖的package包/类
@Override
protected void onDrag( Touch t ) {
if (dragging) {
Camera c = content.camera;
c.scroll.offset( PointF.diff( lastPos, t.current ).invScale( c.zoom ) );
if (c.scroll.x + width > content.width()) {
c.scroll.x = content.width() - width;
}
if (c.scroll.x < 0) {
c.scroll.x = 0;
}
if (c.scroll.y + height > content.height()) {
c.scroll.y = content.height() - height;
}
if (c.scroll.y < 0) {
c.scroll.y = 0;
}
thumb.y = y + height * c.scroll.y / content.height();
lastPos.set( t.current );
} else if (PointF.distance( t.current, t.start ) > dragThreshold) {
dragging = true;
lastPos.set( t.current );
thumb.am = 1;
}
}
示例8: onDrag
import com.watabou.utils.PointF; //导入方法依赖的package包/类
@Override
protected void onDrag( NoosaInputProcessor.Touch t ) {
camera.target = null;
if (pinching) {
float curSpan = PointF.distance( touch.current, another.current );
camera.zoom( GameMath.gate(
PixelScene.minZoom,
startZoom * curSpan / startSpan,
PixelScene.maxZoom ) );
} else {
if (!dragging && PointF.distance( t.current, t.start ) > dragThreshold) {
dragging = true;
lastPos.set( t.current );
} else if (dragging) {
camera.scroll.offset( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) );
lastPos.set( t.current );
}
}
}
示例9: onDrag
import com.watabou.utils.PointF; //导入方法依赖的package包/类
@Override
protected void onDrag( NoosaInputProcessor.Touch t ) {
if (dragging) {
doScroll(t.current);
} else if (PointF.distance( t.current, t.start ) > dragThreshold) {
dragging = true;
lastPos.set( t.current );
}
}