Ejemplo n.º 1
0
        //protected AnimationTimer Timer = new AnimationTimer();
        #endregion

        public BounceView(IntPtr handle) : base(handle)
        {
            AnimationLayer.Delegate = new BounceLayerDelegate();

            TickLayer = new CALayer();
            TickLayer.ContentsScale = NSScreen.MainScreen.BackingScaleFactor;

            Layer.AddSublayer(TickLayer);

            Metronome.Instance.Started         += Instance_Started;
            Metronome.Instance.Stopped         += Instance_Stopped;
            Metronome.Instance.BeatChanged     += Instance_BeatChanged;
            UserSettings.BounceSettingsChanged += UserSettings_BounceSettingsChanged;

            BounceHelper.ResetElaspedBpm();
        }
Ejemplo n.º 2
0
        public override void DrawFrame()
        {
            if (Metronome.Instance.PlayState == Metronome.PlayStates.Stopped)
            {
                // sometimes the drawFrame will run after playback is started, so we handle that case
                ReturnToInitialState();
                BounceHelper.ResetElaspedBpm();
            }
            else
            {
                //BounceHelper.ElapsedBpm = Metronome.Instance.ElapsedBpm - BounceHelper.ElapsedBpm;
                //BounceHelper.ElapsedBpm = Timer.GetElapsedBpm();
                BounceHelper.UpdateElapsedBpm();
            }

            DrawElements();
        }
Ejemplo n.º 3
0
 void Instance_Stopped(object sender, EventArgs e)
 {
     ReturnToInitialState();
     BounceHelper.ResetElaspedBpm();
     DrawElements();
 }