当前位置: 首页>>代码示例>>Java>>正文


Java PointF.distance方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:23,代码来源:CellSelector.java

示例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();
	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:23,代码来源:CellSelector.java

示例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;
	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:21,代码来源:CellSelector.java

示例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);
		}
	}

}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:28,代码来源:CellSelector.java

示例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);

	}
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:31,代码来源:ScrollPane.java

示例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 );
		}
	}
	
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:28,代码来源:CellSelector.java

示例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;

	}
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:33,代码来源:ScrollPane.java

示例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 );	
		}	
	}
	
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:28,代码来源:CellSelector.java

示例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 );

	}
}
 
开发者ID:kurtyu,项目名称:PixelDungeonTC,代码行数:14,代码来源:ScrollPane.java


注:本文中的com.watabou.utils.PointF.distance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。