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(); }
public FlappyLogic(FlappyModel model) { this.model = model; }
public FlappyRenderer(FlappyModel model) { this.model = model; bgRect = new Rect(0, 0, model.GameWidth, model.GameHeight); }