コード例 #1
0
        /// <summary>
        /// Delegate used for executing animation drawing.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="GraphicsContext"/> used for drawing.
        /// </param>
        /// <param name="animationTime">
        /// A <see cref="TimeSpan"/> that specifies the total animation time.
        /// </param>
        /// <param name="data">
        /// A <see cref="Object"/> used to pass information to animation drawing delegate.
        /// </param>
        protected void StartAnimation(GraphicsContext ctx, TimeSpan animationTime, AnimationDelegates animationDelegates, object data)
        {
            DateTime animationBegin = DateTime.UtcNow;
            TimeSpan animationElapsedTime;

            // Initialize animation
            if (animationDelegates.Init != null)
            {
                animationDelegates.Init(ctx, data);
            }

            // Execute animation
            while ((animationElapsedTime = (DateTime.UtcNow - animationBegin)) < animationTime)
            {
                // Clear surface
                Surface.Clear(ctx);
                // Execute drawing
                animationDelegates.Draw(ctx, animationElapsedTime, data);
                // Swap surface, if possible
                if (Surface.Swappable)
                {
                    Surface.SwapSurface();
                }
            }
        }
コード例 #2
0
		/// <summary>
		/// Get the animation delegates required to this test ficture.
		/// </summary>
		/// <returns></returns>
		private AnimationDelegates GetAnimationDelegates()
		{
			AnimationDelegates animationDelegates = new AnimationDelegates();

			animationDelegates.Init = AnimationInit;
			animationDelegates.Draw = AnimationDraw;

			return (animationDelegates);
		}
コード例 #3
0
ファイル: GraphicsWindow.cs プロジェクト: vazgriz/OpenGL.Net
        /// <summary>
        /// Get the animation delegates required to this test ficture.
        /// </summary>
        /// <returns></returns>
        private AnimationDelegates GetAnimationDelegates()
        {
            AnimationDelegates animationDelegates = new AnimationDelegates();

            animationDelegates.Init = AnimationInit;
            animationDelegates.Draw = AnimationDraw;

            return(animationDelegates);
        }
コード例 #4
0
		/// <summary>
		/// Delegate used for executing animation drawing.
		/// </summary>
		/// <param name="ctx">
		/// A <see cref="GraphicsContext"/> used for drawing.
		/// </param>
		/// <param name="animationTime">
		/// A <see cref="TimeSpan"/> that specifies the total animation time.
		/// </param>
		/// <param name="data">
		/// A <see cref="Object"/> used to pass information to animation drawing delegate.
		/// </param>
		protected void StartAnimation(GraphicsContext ctx, TimeSpan animationTime, AnimationDelegates animationDelegates, object data)
		{
			DateTime animationBegin = DateTime.UtcNow;
			TimeSpan animationElapsedTime;

			// Initialize animation
			if (animationDelegates.Init != null)
				animationDelegates.Init(ctx, data);

			// Execute animation
			while ((animationElapsedTime = (DateTime.UtcNow - animationBegin)) < animationTime) {
				// Clear surface
				Surface.Clear(ctx);
				// Execute drawing
				animationDelegates.Draw(ctx, animationElapsedTime, data);
				// Swap surface, if possible
				if (Surface.Swappable)
					Surface.SwapSurface();
			}
		}