Exemple #1
0
        private void FlappyControl_Loaded(object sender, RoutedEventArgs e)
        {
            Window wnd = Window.GetWindow(this);

            model    = new FlappyModel(ActualWidth, ActualHeight);
            logic    = new FlappyLogic(model);
            renderer = new FlappyRenderer(model);

            if (wnd != null) //Rendering and Timer run
            {
                wnd.KeyDown   += Wnd_KeyDown;
                wnd.MouseDown += Wnd_MouseDown;
                timer          = new DispatcherTimer();
                timer.Interval = TimeSpan.FromMilliseconds(100);
                timer.Tick    += Timer_Tick;
                timer.Start();
            }

            InvalidateVisual();
        }
Exemple #2
0
 public FlappyLogic(FlappyModel model)
 {
     this.model = model;
 }
Exemple #3
0
 public FlappyRenderer(FlappyModel model)
 {
     this.model = model;
     bgRect     = new Rect(0, 0, model.GameWidth, model.GameHeight);
 }