public GameGenerator(ref Canvas worldCanvas, ref GamePhysics gamePhysics)
        {
            canvas  = worldCanvas;
            physics = gamePhysics;

            double backgroundY = Application.Current.Host.Content.ActualWidth - 214;

            background01 = new Background(0, backgroundY, 795, 214, 0, 0, 0);
            background02 = new Background(795, backgroundY, 795, 214, 0, 0, 0);
            background03 = new Background(1590, backgroundY, 795, 214, 0, 0, 0);

            background01.Y = backgroundY;
            background02.Y = backgroundY;
            background03.Y = backgroundY;

            Rectangle blueBehind = new Rectangle();

            blueBehind.Width  = Application.Current.Host.Content.ActualHeight;
            blueBehind.Height = Application.Current.Host.Content.ActualWidth;
            blueBehind.Fill   = new SolidColorBrush(Color.FromArgb(255, 153, 217, 234));

            canvas.Children.Add(blueBehind);

            canvas.Children.Add(background01.GetRepresentation());
            canvas.Children.Add(background02.GetRepresentation());
            canvas.Children.Add(background03.GetRepresentation());

            var content = Application.Current.Host.Content;

            resolution = new Size(content.ActualWidth, content.ActualHeight);
        }
        public GameGenerator(ref Canvas worldCanvas, ref GamePhysics gamePhysics)
        {
            canvas = worldCanvas;
            physics = gamePhysics;

            double backgroundY = Application.Current.Host.Content.ActualWidth - 214;

            background01 = new Background(0, backgroundY, 795, 214, 0, 0, 0);
            background02 = new Background(795, backgroundY, 795, 214, 0, 0, 0);
            background03 = new Background(1590, backgroundY, 795, 214, 0, 0, 0);

            background01.Y = backgroundY;
            background02.Y = backgroundY;
            background03.Y = backgroundY;

            Rectangle blueBehind = new Rectangle();
            blueBehind.Width = Application.Current.Host.Content.ActualHeight;
            blueBehind.Height = Application.Current.Host.Content.ActualWidth;
            blueBehind.Fill = new SolidColorBrush(Color.FromArgb(255, 153, 217, 234));

            canvas.Children.Add(blueBehind);

            canvas.Children.Add(background01.GetRepresentation());
            canvas.Children.Add(background02.GetRepresentation());
            canvas.Children.Add(background03.GetRepresentation());

            var content = Application.Current.Host.Content;
            resolution = new Size(content.ActualWidth, content.ActualHeight);
        }
Beispiel #3
0
        private void InitializeCore()
        {
            worldCanvas.MouseLeftButtonDown += new MouseButtonEventHandler(WorldCanvas_MouseLeftButtonDown);

            test        = new Chicken(100, 100, 60, 60, 0, 0, 0.1);
            gamePhysics = new GamePhysics();
            gamePhysics.DynamicGraphicsList.Add(test);

            gameGenerator = new GameGenerator(ref worldCanvas, ref gamePhysics);

            worldCanvas.Children.Add(test.GetRepresentation());

            scoreWatch.Start();
        }
Beispiel #4
0
        private void InitializeCore()
        {
            worldCanvas.MouseLeftButtonDown += new MouseButtonEventHandler(WorldCanvas_MouseLeftButtonDown);

            test = new Chicken(100, 100, 60, 60, 0, 0, 0.1);
            gamePhysics = new GamePhysics();
            gamePhysics.DynamicGraphicsList.Add(test);

            gameGenerator = new GameGenerator(ref worldCanvas, ref gamePhysics);

            worldCanvas.Children.Add(test.GetRepresentation());

            scoreWatch.Start();
        }