Beispiel #1
0
		public static Tween Run(float from, float to, Action<float> setter, 
			float timeInSeconds, Func<float, float> easing = null)
		{
			easing = easing ?? Ease.Linear;
			Tween tween = new Tween(true)
			{
				From = from, To = to, Setter = setter, Easing = easing, DurationInTicks = toTicks(timeInSeconds)
			};
			return tween;
		}
		public bool RenderBeforeLeavingRoom(List<IObject> displayList, Action<IObject> renderObj)
		{
			_x = _slideIn ? _targetX : 0f;
			_y = _slideIn ? _targetY : 0f;
			float toX = _slideIn ? 0f : _targetX;
			float toY = _slideIn ? 0f : _targetY;
			_tweenX = Tween.RunWithExternalVisit(_x, toX, b => _x = b, _timeInSeconds, _easingX, out _visitTweenX);
			_tweenY = Tween.RunWithExternalVisit(_y, toY, b => _y = b, _timeInSeconds, _easingY, out _visitTweenY);
			return false;
		}
Beispiel #3
0
		public static Tween RunWithExternalVisit(float from, float to, Action<float> setter, 
			float timeInSeconds, Func<float, float> easing, out Action visitCallback)
		{
			easing = easing ?? Ease.Linear;
			Tween tween = new Tween(false)
			{
				From = from, To = to, Setter = setter, Easing = easing, DurationInTicks = toTicks(timeInSeconds)
			};
			visitCallback = tween.visit;
			return tween;
		}
		public bool RenderTransition(IFrameBuffer from, IFrameBuffer to)
		{
			if (_tween.Task.IsCompleted)
			{
				if (_isFadeIn)
				{
					_isFadeIn = false;
					return false;
				}
				_isFadeIn = true;
				_tween = Tween.RunWithExternalVisit(0f, 1f, b => _black = b, _timeInSeconds, _easingFadeIn, out _visitTween);
			}
			_visitTween();
			_screenVectors.Render(_isFadeIn ? to.Texture : from.Texture, _black, _black, _black);
			return true;
		}
		public bool RenderTransition(IFrameBuffer from, IFrameBuffer to)
		{
			if (_tweenWidth.Task.IsCompleted)
			{
				if (_isBoxIn)
				{
					_isBoxIn = false;
					return false;
				}
				_isBoxIn = true;
				_tweenWidth = Tween.RunWithExternalVisit(0f, _screenWidth, f => _boxWidth = f, _timeInSeconds, _easingBoxIn, out _visitTweenWidth);
				Tween.RunWithExternalVisit(0f, _screenHeight, f => _boxHeight = f, _timeInSeconds, _easingBoxIn, out _visitTweenHeight);
			}

			_visitTweenWidth();
			_visitTweenHeight();

			if (_isBoxIn)
			{
				_screenVectors.Render(to.Texture);

				float x = _screenHalfWidth - _boxWidth / 2;
				float y = _screenHalfHeight - _boxHeight / 2;
                QuadVectors left = new QuadVectors (0f, 0f, x, _screenHeight, _glUtils);
                QuadVectors right = new QuadVectors (_screenWidth - x, 0f, x, _screenHeight, _glUtils);
                QuadVectors top = new QuadVectors (0f, 0f, _screenWidth, y, _glUtils);
                QuadVectors bottom = new QuadVectors (0f, _screenHeight - y, _screenWidth, y, _glUtils);
				renderBlackQuads(left, right, top, bottom);
			}
			else
			{
				_screenVectors.Render(from.Texture);
				QuadVectors quad = new QuadVectors (_screenHalfWidth - _boxWidth / 2, _screenHalfHeight - _boxHeight / 2, 
                                                    _boxWidth, _boxHeight, _glUtils);
				renderBlackQuads(quad);
			}
			return true;
		}
		public bool RenderBeforeLeavingRoom(List<IObject> displayList, Action<IObject> renderObj)
		{
			_tween = Tween.RunWithExternalVisit(0f, 1f, t => _time = t, _timeInSeconds, _easing, out _visitTween);
			return false;
		}
		public bool RenderBeforeLeavingRoom(System.Collections.Generic.List<IObject> displayList, Action<IObject> renderObj)
		{
			_tween = Tween.RunWithExternalVisit(1f, 0f, b => _alpha = b, _timeInSeconds, _easingFadeOut, out _visitTween);
			return false;
		}
		public bool RenderBeforeLeavingRoom(List<IObject> displayList, Action<IObject> renderObj)
		{
			_tweenWidth = Tween.RunWithExternalVisit(0f, _screenWidth, f => _boxWidth = f, _timeInSeconds, _easingBoxOut, out _visitTweenWidth);
			Tween.RunWithExternalVisit(0f, _screenHeight, f => _boxHeight = f, _timeInSeconds, _easingBoxOut, out _visitTweenHeight);
			return false;
		}
 public bool RenderBeforeLeavingRoom(List <IObject> displayList, Action <IObject> renderObj)
 {
     _tween = Tween.RunWithExternalVisit(0f, 1f, t => _time = t, _timeInSeconds, _easing, out _visitTween);
     return(false);
 }
 public bool RenderBeforeLeavingRoom(List <IObject> displayList)
 {
     _tween = Tween.RunWithExternalVisit(1f, 0f, b => _alpha = b, _timeInSeconds, _easingFadeOut, out _visitTween);
     return(false);
 }