コード例 #1
0
        public MainPage()
        {
            this.InitializeComponent();
            Initialise();

            BitmapImage unitImg = ImageFromRelativePath(this, "Assets/unit.png");
            BitmapImage towerImg = ImageFromRelativePath(this, "Assets/tower2.png");
            BitmapImage bulletImg = ImageFromRelativePath(this, "Assets/mario_fireball.png");

            BitmapImage mapImg = ImageFromRelativePath(this, "Assets/map.png");
            BitmapImage roadImg = ImageFromRelativePath(this, "Assets/tile.png");

            /*
            ImageBrush imBrush = new ImageBrush();
            //ImageBrush imBrush = SolidColorBrush;
            //SolidColorBrush imBrush = new SolidColorBrush();
            imBrush.ImageSource = mapImg;
            //imBrush.Color = Windows.UI.Colors.Black;
            rect = new Rectangle();
            rect.Fill = imBrush;
            rect.SetValue(Canvas.LeftProperty, 0);
            rect.SetValue(Canvas.TopProperty, 0);
            rect.Width = 500;
            rect.Height = 500;
            gameCanvas.Children.Add(rect);
            */
            game = new Game(gameCanvas, unitImg, towerImg, bulletImg, roadImg);

            /*
            //BitmapImage bi = new BitmapImage(new Uri("ms-appdata:///unit.png"));
            BitmapImage bi = ImageFromRelativePath(this, "Assets/unit.png");
            ImageBrush imBrush = new ImageBrush();
            //ImageBrush imBrush = SolidColorBrush;
            //SolidColorBrush imBrush = new SolidColorBrush();
            imBrush.ImageSource = bi;
            //imBrush.Color = Windows.UI.Colors.Black;
            rect = new Rectangle();
            rect.Fill = imBrush;
            rect.SetValue(Canvas.LeftProperty, 10);
            rect.SetValue(Canvas.TopProperty, 10);
            rect.Width = 72;
            rect.Height = 72;
            gameCanvas.Children.Add(rect);
             * */
        }
コード例 #2
0
        public MainPage()
        {
            this.InitializeComponent();
            Initialise();

            BitmapImage unitImg   = ImageFromRelativePath(this, "Assets/unit.png");
            BitmapImage towerImg  = ImageFromRelativePath(this, "Assets/tower2.png");
            BitmapImage bulletImg = ImageFromRelativePath(this, "Assets/mario_fireball.png");

            BitmapImage mapImg  = ImageFromRelativePath(this, "Assets/map.png");
            BitmapImage roadImg = ImageFromRelativePath(this, "Assets/tile.png");

            /*
             * ImageBrush imBrush = new ImageBrush();
             * //ImageBrush imBrush = SolidColorBrush;
             * //SolidColorBrush imBrush = new SolidColorBrush();
             * imBrush.ImageSource = mapImg;
             * //imBrush.Color = Windows.UI.Colors.Black;
             * rect = new Rectangle();
             * rect.Fill = imBrush;
             * rect.SetValue(Canvas.LeftProperty, 0);
             * rect.SetValue(Canvas.TopProperty, 0);
             * rect.Width = 500;
             * rect.Height = 500;
             * gameCanvas.Children.Add(rect);
             */
            game = new Game(gameCanvas, unitImg, towerImg, bulletImg, roadImg);

            /*
             * //BitmapImage bi = new BitmapImage(new Uri("ms-appdata:///unit.png"));
             * BitmapImage bi = ImageFromRelativePath(this, "Assets/unit.png");
             * ImageBrush imBrush = new ImageBrush();
             * //ImageBrush imBrush = SolidColorBrush;
             * //SolidColorBrush imBrush = new SolidColorBrush();
             * imBrush.ImageSource = bi;
             * //imBrush.Color = Windows.UI.Colors.Black;
             * rect = new Rectangle();
             * rect.Fill = imBrush;
             * rect.SetValue(Canvas.LeftProperty, 10);
             * rect.SetValue(Canvas.TopProperty, 10);
             * rect.Width = 72;
             * rect.Height = 72;
             * gameCanvas.Children.Add(rect);
             * */
        }