Beispiel #1
0
f32 CNrpMiniMap::GetCurrentAngle_( const core::position2di& mPos )
{
	f32 angle=startAngle_;
	s32 dst = mPos.getDistanceFrom(  AbsoluteRect.getCenter() );

	if( dst > 0.7 * startSize_.Width / 2 && dst < startSize_.Width / 2 )
	{
		angle = atan2f( (f32)(mPos.Y - AbsoluteRect.getCenter().Y),
			(f32)(AbsoluteRect.getCenter().X - mPos.X) ) * 180 / core::PI + 90.f;	
	}

	return angle;
}
Beispiel #2
0
f32 CNrpCircleScrollBar::GetCurrentAngle_( const core::position2di& mPos )
{
	f32 angle=startAngle_;
	f32 dst = (f32)mPos.getDistanceFrom(  AbsoluteRect.getCenter() );
	f32 rad = AbsoluteRect.getWidth() / 2.f;

	if( dst > 0.2 * rad && dst < rad )
	{
		angle = atan2f( (f32)(mPos.Y - AbsoluteRect.getCenter().Y),
				        (f32)(mPos.X - AbsoluteRect.getCenter().X) ) * 180 / core::PI + 90;
	}
	
	if( angle < 0 )
		angle = 360 + angle;


	if( angle + circleCounter_ * 360 - startAngle_ < -100 )
		circleCounter_++;
	else if( angle + circleCounter_ * 360 - startAngle_ > 100 )
		circleCounter_--;

	return angle + circleCounter_ * 360;
}