當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。