예제 #1
0
파일: Form1.cs 프로젝트: Jozx/SF-2015
        private void OnTimedEvent(object sender, MicroLibrary.MicroTimerEventArgs timerEventArgs)
        {
            //<>
            if (KEN.Right >= RYU.Left + 10)
            {
                kenCollision = true;

                if (KEN.InvokeRequired)
                {

                    KEN.Invoke(new Action(() => KEN.Left = RYU.Left - RYU.Width + 10));
                }
                else
                {

                    KEN.Left = RYU.Left - RYU.Width + 10;
                }


            }
            else
            {
                kenCollision = false;
            }

            if (RYU.Left < KEN.Right - 10)
            {
                ryuCollision = true;

                if (RYU.InvokeRequired)
                {

                    RYU.Invoke(new Action(() => RYU.Left = KEN.Right - 10));
                }
                else
                {

                    RYU.Left = KEN.Right - 10;
                }


            }
            else
            {
                ryuCollision = false;
            }




            #region outOfBounds
            if (KEN.Right > screen.Right)
            {
                kenOutOfBounds = true;
                if (KEN.InvokeRequired)
                {
                    KEN.Invoke(new Action(() => KEN.Left = pointRight.X));
                }
                else
                {
                    KEN.Left = pointRight.X;
                }
            }
            else
            {
                kenOutOfBounds = false;
            }

            if (KEN.Left < screen.Left)
            {
                kenOutOfBounds = true;
                if (KEN.InvokeRequired)
                {
                    KEN.Invoke(new Action(() => KEN.Left = pointLeft.X));
                }
                else
                {
                    KEN.Left = pointLeft.X;
                }
            }
            else
            {
                kenOutOfBounds = false;
            }

            if (RYU.Left < screen.Left)
            {
                ryuOutOfBounds = true;
                if (RYU.InvokeRequired)
                {
                    RYU.Invoke(new Action(() => RYU.Left = pointLeft.X));
                }
                else
                {
                    RYU.Left = pointLeft.X;
                }
            }
            else
            {
                ryuOutOfBounds = false;
            }

            if (RYU.Right > screen.Right)
            {
                ryuOutOfBounds = true;
                if (RYU.InvokeRequired)
                {
                    RYU.Invoke(new Action(() => RYU.Left = pointRight.X));
                }
                else
                {
                    RYU.Left = pointRight.X;
                }
            }
            else
            {
                ryuOutOfBounds = false;
            }
            #endregion
        }
예제 #2
0
        private void OnTimedEvent(object sender,
                                  MicroLibrary.MicroTimerEventArgs timerEventArgs)
        {
            //Debug.Print("tick");
            if (!playbackActive)
            {
                fastTimer.Stop();
                return;
            }
            if (playbackForward)
            {
                //Debug.Print("forward");
                updatePosition(true);
            }
            else
            {
                //Debug.Print("back");
                updatePosition(false);
            }

            if (!ckLoop.Checked)
            {
                if (playbackPos == 0) playbackActive = false;
                if (playbackPos == (numFrames - 1)) playbackActive = false;
            }
        }
예제 #3
0
파일: MainWindow.cs 프로젝트: awant/pdp11
 private void OnTimedEvent(object sender, MicroLibrary.MicroTimerEventArgs timerEventArgs)
 {
     doStep();
 }
예제 #4
0
        /// <summary>
        /// This callback is invoked by the timer when a time-slice is over
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="timerEventArgs"></param>
        private void OnTimedEvent(object sender, MicroLibrary.MicroTimerEventArgs timerEventArgs)
        {
            Dictionary<int, List<byte[]>> dmxVals = new Dictionary<int, List<byte[]>>();
            List<int> dmxStartAdresses = new List<int>();
            int i = 0;

            for (i = 0; i < movingHeads.Count; i++)
            {
                if (movingHeads[i].SingleTurn != 0x00)
                {
                    var tmp = TurnSingleStep(movingHeads[i].SingleTurn, i);
                    dmxVals.Add(i, tmp);
                    dmxStartAdresses.Add(MhAdresses[i]);
                }
            }

            i = 0;
            foreach (var item in dmxVals.Values)
            {
                TransmitterSet(item, dmxStartAdresses[i]);
                ++i;
            }
            Transmitter.Flush();

            // publish all changes at once
            if (!isDuringSetup) VMSvc.DmxValuesChanged(dmxVals);
        }
예제 #5
0
        public void saveframe(object sender,
                                  MicroLibrary.MicroTimerEventArgs timerEventArgs)
        {
            if (videoOut.Ptr != IntPtr.Zero && videoOut != null)
            {
                try
                {
                    if (img3 == null)
                        videoOut.WriteFrame(old); //write old frame in case img3 is not pulled yet
                    else
                    {
                        videoOut.WriteFrame(img3);
                        old = img3;
                        img3 = null;
                    }


                }
                catch { }             //   img3.Dispose();
            }
        }