Пример #1
0
        private void PongControl_Loaded(object sender, RoutedEventArgs e)
        {
            model    = new PongModel();
            logic    = new PongLogic(model);
            renderer = new PongRenderer(model);

            Window wnd = Window.GetWindow(this);

            if (wnd != null)
            {
                tickTimer          = new DispatcherTimer();
                tickTimer.Interval = TimeSpan.FromMilliseconds(40);
                tickTimer.Tick    += TickTimer_Tick;
                tickTimer.Start();

                wnd.KeyDown += Wnd_KeyDown;
                this.MouseLeftButtonDown += PongControl_MouseLeftButtonDown;
            }
            logic.RefreshScreen += (s, e) => InvalidateVisual();
            InvalidateVisual();
        }
Пример #2
0
 public PongLogic(PongModel model)
 {
     this.model = model;
 }
Пример #3
0
 public PongRenderer(PongModel model)
 {
     this.model = model;
 }