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


Java UIAcceleration类代码示例

本文整理汇总了Java中com.panoramagl.ios.structs.UIAcceleration的典型用法代码示例。如果您正苦于以下问题:Java UIAcceleration类的具体用法?Java UIAcceleration怎么用?Java UIAcceleration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UIAcceleration类属于com.panoramagl.ios.structs包,在下文中一共展示了UIAcceleration类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setValues

import com.panoramagl.ios.structs.UIAcceleration; //导入依赖的package包/类
public PLPosition setValues(UIAcceleration acceleration)
{
	x = acceleration.x;
	y = acceleration.y;
	z = acceleration.z;
	return this;
}
 
开发者ID:codedavid,项目名称:PanoramaGL,代码行数:8,代码来源:PLPosition.java

示例2: resetWithShake

import com.panoramagl.ios.structs.UIAcceleration; //导入依赖的package包/类
/**shake methods*/

protected boolean resetWithShake(UIAcceleration acceleration)
{
	if(!mIsShakeResetEnabled || !mIsResetEnabled || this.isLocked() || mIsValidForCameraAnimation || mIsValidForTransition)
		return false;
	
	boolean result = false;
	long currentTime = System.currentTimeMillis();
	
    if((currentTime - mShakeData.lastTime) > PLConstants.kShakeDiffTime)
    {
    	long diffTime = (currentTime - mShakeData.lastTime);
    	mShakeData.lastTime = currentTime;
    	mShakeData.shakePosition.setValues(acceleration);
    	
    	float speed = Math.abs(mShakeData.shakePosition.x + mShakeData.shakePosition.y + mShakeData.shakePosition.z - mShakeData.shakeLastPosition.x - mShakeData.shakeLastPosition.y - mShakeData.shakeLastPosition.z) / diffTime * 10000;
    	
    	if(speed > mShakeThreshold)
    	{
    		boolean isNotCancelable = true;
    		if(mListener != null)
    			isNotCancelable = mListener.onShouldReset(this);
    		if(isNotCancelable)
    		{
	    		this.reset();
	    		if(mListener != null)
	    			mListener.onDidReset(this);
	    		result = true;
    		}
    	}
    	
    	mShakeData.shakeLastPosition.setValues(mShakeData.shakePosition);
    }
    return result;
}
 
开发者ID:codedavid,项目名称:PanoramaGL,代码行数:37,代码来源:PLView.java

示例3: resetWithShake

import com.panoramagl.ios.structs.UIAcceleration; //导入依赖的package包/类
/**shake methods*/

protected boolean resetWithShake(UIAcceleration acceleration) {
	if(!mIsShakeResetEnabled || !mIsResetEnabled || this.isLocked() || mIsValidForCameraAnimation || mIsValidForTransition)
		return false;
	
	boolean result = false;
	long currentTime = System.currentTimeMillis();
	
    if((currentTime - mShakeData.lastTime) > PLConstants.kShakeDiffTime)
    {
    	long diffTime = (currentTime - mShakeData.lastTime);
    	mShakeData.lastTime = currentTime;
    	mShakeData.shakePosition.setValues(acceleration);
    	
    	float speed = Math.abs(mShakeData.shakePosition.x + mShakeData.shakePosition.y + mShakeData.shakePosition.z - mShakeData.shakeLastPosition.x - mShakeData.shakeLastPosition.y - mShakeData.shakeLastPosition.z) / diffTime * 10000;
    	
    	if(speed > mShakeThreshold)
    	{
    		boolean isNotCancelable = true;
    		if(mListener != null)
    			isNotCancelable = mListener.onShouldReset(this);
    		if(isNotCancelable)
    		{
	    		this.reset();
	    		if(mListener != null)
	    			mListener.onDidReset(this);
	    		result = true;
    		}
    	}
    	
    	mShakeData.shakeLastPosition.setValues(mShakeData.shakePosition);
    }
    return result;
}
 
开发者ID:marianmoldovan,项目名称:panoramagl,代码行数:36,代码来源:PLManager.java

示例4: onShouldAccelerate

import com.panoramagl.ios.structs.UIAcceleration; //导入依赖的package包/类
/**accelerate methods*/

public boolean onShouldAccelerate(PLIView view, UIAcceleration acceleration, SensorEvent event)
{
	return true;
}
 
开发者ID:codedavid,项目名称:PanoramaGL,代码行数:7,代码来源:PLViewListener.java

示例5: onDidAccelerate

import com.panoramagl.ios.structs.UIAcceleration; //导入依赖的package包/类
public void onDidAccelerate(PLIView view, UIAcceleration acceleration, SensorEvent event)
{
}
 
开发者ID:codedavid,项目名称:PanoramaGL,代码行数:4,代码来源:PLViewListener.java

示例6: accelerometer

import com.panoramagl.ios.structs.UIAcceleration; //导入依赖的package包/类
protected void accelerometer(SensorEvent event, UIAcceleration acceleration)
  {
if(this.isLocked() || this.resetWithShake(acceleration) || mIsValidForTouch || mIsValidForScrolling || mIsValidForSensorialRotation || mIsValidForCameraAnimation || mIsValidForTransition)
	return;

if(mIsAccelerometerEnabled)
{
	if(mListener != null && !mListener.onShouldAccelerate(this, acceleration, event))
		return;
	
	float x = 0.0f, y = (mIsAccelerometerUpDownEnabled ? -acceleration.z : 0.0f), factor = mAccelerometerSensitivity * (mPanorama.getCamera().isReverseRotation() ? -PLConstants.kAccelerometerMultiplyFactor : PLConstants.kAccelerometerMultiplyFactor);
	
	switch(this.getCurrentDeviceOrientation())
	{
		case UIDeviceOrientationUnknown:
		case UIDeviceOrientationPortrait:
			if(mIsAccelerometerLeftRightEnabled)
				x = acceleration.x;
			break;
		case UIDeviceOrientationLandscapeLeft:
			if(mIsAccelerometerLeftRightEnabled)
				x = -acceleration.y;
			break;
		case UIDeviceOrientationLandscapeRight:
			if(mIsAccelerometerLeftRightEnabled)
				x = acceleration.y;
			break;
		case UIDeviceOrientationPortraitUpsideDown:
			if(mIsAccelerometerLeftRightEnabled)
				x = -acceleration.x;
			break;
		default:
			break;
	}
	
	CGSize size = mRenderer.getSize();
	mAuxiliarStartPoint.setValues(size.width >> 1, size.height >> 1);
	mAuxiliarEndPoint.setValues(mAuxiliarStartPoint.x + x * factor, mAuxiliarStartPoint.y + y * factor);
	mPanorama.getCamera().rotate(this, mAuxiliarStartPoint, mAuxiliarEndPoint);
	
	if(mListener != null)
		mListener.onDidAccelerate(this, acceleration, event);
}
  }
 
开发者ID:codedavid,项目名称:PanoramaGL,代码行数:45,代码来源:PLView.java

示例7: onCreate

import com.panoramagl.ios.structs.UIAcceleration; //导入依赖的package包/类
/**android: events methods*/

@Override
   protected void onCreate(Bundle savedInstanceState) 
{
       super.onCreate(savedInstanceState);
       try
       {
       	mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
       	mGestureDetector = new GestureDetector
		(
			this,
			new SimpleOnGestureListener()
			{
				@Override
				public boolean onDoubleTap(MotionEvent event)
				{
					return PLView.this.onDoubleTap(event);
				}
				
				@Override
				public boolean onDoubleTapEvent(MotionEvent event)
				{
					return PLView.this.onDoubleTapEvent(event);
				}
				
				@Override
				public boolean onSingleTapConfirmed(MotionEvent event)
				{
					return PLView.this.onSingleTapConfirmed(event);
				}
			}
		);
       	mTempRenderingViewport = new CGRect();
       	mTempRenderingSize = new CGSize();
       	mTempSize = new CGSize();
       	mTempAcceleration = new UIAcceleration();
       	mInternalTouches = new ArrayList<UITouch>(kMaxTouches);
       	mCurrentTouches = new ArrayList<UITouch>(kMaxTouches);
       	mLocation = new int[2];
		this.initializeValues();
       }
       catch(Throwable e)
       {
       	PLLog.error("PLView::onCreate", e);
       }
   }
 
开发者ID:codedavid,项目名称:PanoramaGL,代码行数:48,代码来源:PLView.java

示例8: accelerometer

import com.panoramagl.ios.structs.UIAcceleration; //导入依赖的package包/类
protected void accelerometer(SensorEvent event, UIAcceleration acceleration) {
if(this.isLocked() || this.resetWithShake(acceleration) || mIsValidForTouch || mIsValidForScrolling || mIsValidForSensorialRotation || mIsValidForCameraAnimation || mIsValidForTransition)
	return;

if(mIsAccelerometerEnabled) {
	if(mListener != null && !mListener.onShouldAccelerate(this, acceleration, event))
		return;
	
	float x = 0.0f, y = (mIsAccelerometerUpDownEnabled ? -acceleration.z : 0.0f), factor = mAccelerometerSensitivity * (mPanorama.getCamera().isReverseRotation() ? -PLConstants.kAccelerometerMultiplyFactor : PLConstants.kAccelerometerMultiplyFactor);
	
	switch(this.getCurrentDeviceOrientation())
	{
		case UIDeviceOrientationUnknown:
		case UIDeviceOrientationPortrait:
			if(mIsAccelerometerLeftRightEnabled)
				x = acceleration.x;
			break;
		case UIDeviceOrientationLandscapeLeft:
			if(mIsAccelerometerLeftRightEnabled)
				x = -acceleration.y;
			break;
		case UIDeviceOrientationLandscapeRight:
			if(mIsAccelerometerLeftRightEnabled)
				x = acceleration.y;
			break;
		case UIDeviceOrientationPortraitUpsideDown:
			if(mIsAccelerometerLeftRightEnabled)
				x = -acceleration.x;
			break;
		default:
			break;
	}
	
	CGSize size = mRenderer.getSize();
	mAuxiliarStartPoint.setValues(size.width >> 1, size.height >> 1);
	mAuxiliarEndPoint.setValues(mAuxiliarStartPoint.x + x * factor, mAuxiliarStartPoint.y + y * factor);
	mPanorama.getCamera().rotate(this, mAuxiliarStartPoint, mAuxiliarEndPoint);
	
	if(mListener != null)
		mListener.onDidAccelerate(this, acceleration, event);
}
  }
 
开发者ID:marianmoldovan,项目名称:panoramagl,代码行数:43,代码来源:PLManager.java

示例9: onCreate

import com.panoramagl.ios.structs.UIAcceleration; //导入依赖的package包/类
/**android: events methods*/
 public void onCreate() {
     try
     {
     	mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
     	mGestureDetector = new GestureDetector (
		context,
	new SimpleOnGestureListener()
	{
		@Override
		public boolean onDoubleTap(MotionEvent event)
		{
			return PLManager.this.onDoubleTap(event);
		}
		
		@Override
		public boolean onDoubleTapEvent(MotionEvent event)
		{
			return PLManager.this.onDoubleTapEvent(event);
		}
		
		@Override
		public boolean onSingleTapConfirmed(MotionEvent event)
		{
			return PLManager.this.onSingleTapConfirmed(event);
		}
	}
);
     	mTempRenderingViewport = new CGRect();
     	mTempRenderingSize = new CGSize();
     	mTempSize = new CGSize();
     	mTempAcceleration = new UIAcceleration();
     	mInternalTouches = new ArrayList<UITouch>(kMaxTouches);
     	mCurrentTouches = new ArrayList<UITouch>(kMaxTouches);
     	mLocation = new int[2];
this.initializeValues();
     }
     catch(Throwable e)
     {
     	PLLog.error("PLView::onCreate", e);
     }
 }
 
开发者ID:marianmoldovan,项目名称:panoramagl,代码行数:43,代码来源:PLManager.java


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