Exemple #1
0
            internal bool MoveNext(long tick)
            {
                bool finished = IsFinished(tick);

                if (finished)
                {
                    parent.Bounds = destBounds;
                    parent        = null;
                }
                else
                {
                    double percentComplete = (double)(tick - startTick) / (double)totalTicks;

                    int newX = startBounds.X +
                               (int)((float)(destBounds.X - startBounds.X) * percentComplete);
                    int newY = startBounds.Y +
                               (int)((float)(destBounds.Y - startBounds.Y) * percentComplete);
                    int newWidth = startBounds.Width +
                                   (int)((float)(destBounds.Width - startBounds.Width) * percentComplete);
                    int newHeight = startBounds.Height +
                                    (int)((float)(destBounds.Height - startBounds.Height) * percentComplete);

                    parent.Bounds = new Rectangle(newX, newY, newWidth, newHeight);
                }

                return(finished);
            }
Exemple #2
0
 internal Movement(DirectDrawing drawing, double totalTime, Rectangle dest)
 {
     parent      = drawing;
     startTick   = HighResTimer.GetCurrentTickCount();
     lastTick    = startTick;
     totalTicks  = (long)(totalTime * (double)HighResTimer.TicksPerSecond);
     startBounds = parent.Bounds;
     destBounds  = dest;
 }
Exemple #3
0
        public static void Clear(string name)
        {
            DirectDrawing tmpDraw = GetDirectDrawing(name);

            if (tmpDraw != null)
            {
                tmpDraw.Dispose();
            }
        }