Esempio n. 1
0
 public RoomTransitionDissolve(IGLUtils glUtils, float timeInSeconds = 1f, Func <float, float> easing = null, IGame game = null)
 {
     _timeInSeconds = timeInSeconds;
     _easing        = easing ?? Ease.Linear;
     _game          = game ?? AGSGame.Game;
     _screenVectors = new QuadVectors(_game, glUtils);
 }
        public bool RenderTransition(IFrameBuffer from, IFrameBuffer to)
        {
            if (_tweenX.Task.IsCompleted && _tweenY.Task.IsCompleted)
            {
                return(false);
            }
            if (!_tweenX.Task.IsCompleted)
            {
                _visitTweenX();
            }
            if (!_tweenY.Task.IsCompleted)
            {
                _visitTweenY();
            }

            var quad = new QuadVectors(_x, _y, _width, _height, _glUtils);

            if (_slideIn)
            {
                _screenVectors.Render(from.Texture);
                quad.Render(to.Texture);
            }
            else
            {
                _screenVectors.Render(to.Texture);
                quad.Render(from.Texture);
            }
            return(true);
        }
        public RoomTransitionDissolve(IGLUtils glUtils, IGraphicsBackend graphics, float timeInSeconds = 1f, Func<float, float> easing = null, IGame game = null)
		{
            _graphics = graphics;
			_timeInSeconds = timeInSeconds;
			_easing = easing ?? Ease.Linear;
			game = game ?? AGSGame.Game;
            _screenVectors = new QuadVectors (game, glUtils);
		}
		public RoomTransitionCrossFade(IGLUtils glUtils, float timeInSeconds = 1f, Func<float, float> easingFadeOut = null, 
			IGame game = null)
		{
			game = game ?? AGSGame.Game;
			_timeInSeconds = timeInSeconds / 2f;
			_easingFadeOut = easingFadeOut ?? Ease.Linear;
            _screenVectors = new QuadVectors (game, glUtils);
		}
Esempio n. 5
0
 public RoomTransitionCrossFade(IGLUtils glUtils, float timeInSeconds = 1f, Func <float, float> easingFadeOut = null,
                                IGame game = null)
 {
     game           = game ?? AGSGame.Game;
     _timeInSeconds = timeInSeconds / 2f;
     _easingFadeOut = easingFadeOut ?? Ease.Linear;
     _screenVectors = new QuadVectors(game, glUtils);
 }
Esempio n. 6
0
 public RoomTransitionBoxOut(IGLUtils glUtils, float timeInSeconds = 1f, Func <float, float> easingBoxOut = null,
                             Func <float, float> easingBoxIn       = null, IGame game = null)
 {
     _glUtils          = glUtils;
     _timeInSeconds    = timeInSeconds / 2f;
     _easingBoxOut     = easingBoxOut ?? Ease.Linear;
     _easingBoxIn      = easingBoxIn ?? Ease.Linear;
     game              = game ?? AGSGame.Game;
     _screenVectors    = new QuadVectors(game, glUtils);
     _screenWidth      = game.Settings.VirtualResolution.Width;
     _screenHeight     = game.Settings.VirtualResolution.Height;
     _screenHalfWidth  = _screenWidth / 2f;
     _screenHalfHeight = _screenHeight / 2f;
 }
		public RoomTransitionBoxOut(IGLUtils glUtils, float timeInSeconds = 1f, Func<float, float> easingBoxOut = null, 
			Func<float, float> easingBoxIn = null, IGame game = null)
		{
            _glUtils = glUtils;
			_timeInSeconds = timeInSeconds / 2f;
			_easingBoxOut = easingBoxOut ?? Ease.Linear;
			_easingBoxIn = easingBoxIn ?? Ease.Linear;
			game = game ?? AGSGame.Game;
            _screenVectors = new QuadVectors (game, glUtils);
			_screenWidth = game.Settings.VirtualResolution.Width;
			_screenHeight = game.Settings.VirtualResolution.Height;
			_screenHalfWidth = _screenWidth / 2f;
			_screenHalfHeight = _screenHeight / 2f;
		}
 public RoomTransitionSlide(IGLUtils glUtils, bool slideIn = false, float?x                  = null, float y = 0f,
                            float timeInSeconds            = 1f, Func <float, float> easingX = null,
                            Func <float, float> easingY    = null, IGame game                = null)
 {
     _glUtils       = glUtils;
     game           = game ?? AGSGame.Game;
     _timeInSeconds = timeInSeconds;
     _slideIn       = slideIn;
     _easingX       = easingX ?? Ease.QuadIn;
     _easingY       = easingY ?? Ease.QuadIn;
     _targetX       = x == null ? game.Settings.VirtualResolution.Width : x.Value;
     _targetY       = y;
     _width         = game.Settings.VirtualResolution.Width;
     _height        = game.Settings.VirtualResolution.Height;
     _screenVectors = new QuadVectors(game, glUtils);
 }
		public RoomTransitionSlide(IGLUtils glUtils, bool slideIn = false, float? x = null, float y = 0f, 
			float timeInSeconds = 1f, Func<float, float> easingX = null,
			Func<float, float> easingY = null, IGame game = null)
		{
            _glUtils = glUtils;
			game = game ?? AGSGame.Game;
			_timeInSeconds = timeInSeconds;
			_slideIn = slideIn;
			_easingX = easingX ?? Ease.QuadIn;
			_easingY = easingY ?? Ease.QuadIn;
			_targetX = x == null ? game.Settings.VirtualResolution.Width : x.Value;
			_targetY = y;
			_width = game.Settings.VirtualResolution.Width;
			_height = game.Settings.VirtualResolution.Height;
            _screenVectors = new QuadVectors (game, glUtils);
		}
Esempio n. 10
0
		public bool RenderTransition(IFrameBuffer from, IFrameBuffer to)
		{
			if (_tweenX.Task.IsCompleted && _tweenY.Task.IsCompleted)
			{
				return false;
			}
			if (!_tweenX.Task.IsCompleted) _visitTweenX();
			if (!_tweenY.Task.IsCompleted) _visitTweenY();

			var quad = new QuadVectors (_x, _y, _width, _height, _glUtils);
			if (_slideIn)
			{
				_screenVectors.Render(from.Texture);
				quad.Render(to.Texture);
			}
			else
			{
				_screenVectors.Render(to.Texture);
				quad.Render(from.Texture);
			}
			return true;
		}
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
		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;
		}