Ejemplo n.º 1
0
        private void InitializeGestures()
        {
            _headerImageTapGesture = new UITapGestureRecognizer(() => {
                var context = new ModalViewContext(
                    ModalViewKind.FullscreenImage,
                    ImageBackground.ImageUrl);

                if (ShowHideModalViewCommand != null &&
                    ShowHideModalViewCommand.CanExecute(context))
                {
                    ShowHideModalViewCommand.Execute(context);
                }
            })
            {
                NumberOfTouchesRequired = (uint)1,
                NumberOfTapsRequired    = (uint)1
            };

            ImageBackground.AddGestureRecognizer(_headerImageTapGesture);

            _descriptionTapGesture = new UITapGestureRecognizer(() => {
                if (ExpandCollapseCommand != null &&
                    ExpandCollapseCommand.CanExecute(null))
                {
                    ExpandCollapseCommand.Execute(null);
                }
            })
            {
                NumberOfTouchesRequired = (uint)1,
                NumberOfTapsRequired    = (uint)1
            };

            DescriptionLabel.AddGestureRecognizer(_descriptionTapGesture);
        }
Ejemplo n.º 2
0
 public override void LoadContent()
 {
     texBack    = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\End.jpg");
     font1      = Content.Load <SpriteFont>("GameOver");
     font2      = Content.Load <SpriteFont>("helpText");
     background = new ImageBackground(texBack, Color.White, graphicsDevice);
 }
Ejemplo n.º 3
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();


            MagicImage      LImage      = new PictureGrabber(PilgrimImg.Image, 50);
            MagicBackground LBackground = new ImageBackground(LImage.ImageHeight, 100);

            this.FGenerator = new ImageGenerator(LImage, LBackground);


            this.pictureBox1.Image = ((ImageGenerator)FGenerator).GetStereogram();



            FTimer          = new ObjectTimer(this);
            FTimer.Interval = 33;
            //			FTimer.Interval = 100;
            FTimer.Tick += new EventHandler(UpdateData);

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
Ejemplo n.º 4
0
 public override void LoadContent()
 {
     scrolling1 = new Scrolling(Content.Load <Texture2D>("skyMenu"), new Rectangle(0, 0, 800, 600));
     scrolling2 = new Scrolling(Content.Load <Texture2D>("skyMenu"), new Rectangle(800, 0, 800, 600));
     texBack    = texFromFile(graphicsDevice, dir + "help.png");
     back1      = new ImageBackground(texBack, Color.White, graphicsDevice);
 }
Ejemplo n.º 5
0
        private void SelectImageButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp; *.png)|*.jpg; *.jpeg; *.gif; *.bmp; *.png";
            if (open.ShowDialog() == DialogResult.OK)
            {
                if (BgImage != null)
                {
                    BgImage.Dispose();
                }
                BgImage = new Bitmap(open.FileName);
                if (BgFromImageRadioButton.Checked)
                {
                    if (Background != null)
                    {
                        Background.Dispose();
                    }
                    Background = new ImageBackground(BgImage,
                                                     DirectBitmap.Width, DirectBitmap.Height);
                }
                else
                {
                    BgFromImageRadioButton.Checked = true;
                }
            }
        }
Ejemplo n.º 6
0
        public override void LoadContent()
        {
            scrolling1 = new Scrolling(Content.Load <Texture2D>("skyMenu"), new Rectangle(0, 0, 800, 600));
            scrolling2 = new Scrolling(Content.Load <Texture2D>("skyMenu"), new Rectangle(800, 0, 800, 600));
            texBack    = texFromFile(graphicsDevice, dir + "menu1.png");
            texBall    = texFromFile(graphicsDevice, dir + "ballMenu.png");
            back1      = new ImageBackground(texBack, Color.White, graphicsDevice);

            texBack1 = texFromFile(graphicsDevice, dir + "help.png");
            back2    = new ImageBackground(texBack1, Color.White, graphicsDevice);



            anmiationList = new SpriteList();
            for (int y = 0; y < 2; y++)
            {
                anmiation1 = new Sprite3(true, texBall, 190, 265 + b);
                anmiation1.setXframes(3);
                anmiation1.setYframes(1);
                anmiation1.setWidthHeight(32, 32);
                Vector2[] seq = new Vector2[3];
                seq[0].X = 1; seq[0].Y = 0;
                seq[1].X = 2; seq[1].Y = 0;
                seq[2].X = 0; seq[2].Y = 0;

                anmiation1.setAnimationSequence(seq, 0, 2, 15);
                anmiation1.animationStart();
                anmiationList.addSpriteReuse(anmiation1);

                b = b + 56;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            LineBatch.init(GraphicsDevice);
            texBack   = Util.texFromFile(GraphicsDevice, dir + "back3.png");    //***
            texpaddle = Util.texFromFile(GraphicsDevice, dir + "red64x32.png"); //***
            texBall   = Util.texFromFile(GraphicsDevice, dir + "ball2.png");    //***
            texBlock1 = Util.texFromFile(GraphicsDevice, dir + "white64x32.png");
            paddle    = new Sprite3(true, texpaddle, xx, yy);
            paddle.setBBToTexture();
            ball = new Sprite3(true, texBall, xx, yy);
            ball.setBBandHSFractionOfTexCentered(0.7f);
            sl = new SpriteList();

            back1    = new ImageBackground(texBack, Color.White, GraphicsDevice);
            playArea = new Rectangle(lhs, top, rhs - lhs, bot - top); // width and height
            for (int y = 0; y < 5; y++)
            {
                for (int x = 0; x < 4; x++)
                {
                    Sprite3 s = new Sprite3(true, texBlock1, x * 68 + playArea.X + blocksOffsetX, y * 36 + playArea.Y + blocksOffsetY);
                    s.hitPoints = 1;
                    if (y == 0)
                    {
                        s.hitPoints = 2;
                        s.setColor(Color.LightBlue);
                    }

                    sl.addSpriteReuse(s);
                }
            }
            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 8
0
        public override void Update(GameTime gameTime)
        {
            anmiationList.animationTick();
            prevKeyState = keyState;
            keyState     = Keyboard.GetState();
            if (keyState.IsKeyDown(Keys.Space) && !prevKeyState.IsKeyDown(Keys.Space))
            {
                gameStateManager.setLevel(1);
            }
            if (keyState.IsKeyDown(Keys.H) && !prevKeyState.IsKeyDown(Keys.H))
            {
                back1 = new ImageBackground(texBack1, Color.White, graphicsDevice);
                for (int i = 0; i < anmiationList.count(); i++)
                {
                    Sprite3 s = anmiationList.getSprite(i);
                    if (s == null)
                    {
                        continue;
                    }
                    if (!s.active)
                    {
                        continue;
                    }
                    if (!s.visible)
                    {
                        continue;
                    }
                    s.setActive(false);
                }
            }
            if (keyState.IsKeyDown(Keys.M) && !prevKeyState.IsKeyDown(Keys.M))
            {
                back1 = new ImageBackground(texBack, Color.White, graphicsDevice);
                for (int i = 0; i < anmiationList.count(); i++)
                {
                    Sprite3 s = anmiationList.getSprite(i);
                    if (s == null)
                    {
                        continue;
                    }
                    // if (!s.active) continue;
                    // if (!s.visible) continue;
                    s.setActive(true);
                }
            }
            if (scrolling1.rectangle.X + scrolling1.texture.Width <= 0)
            {
                scrolling1.rectangle.X = scrolling2.rectangle.X + scrolling2.texture.Width;
            }
            if (scrolling2.rectangle.X + scrolling2.texture.Width <= 0)
            {
                scrolling2.rectangle.X = scrolling1.rectangle.X + scrolling1.texture.Width;
            }

            scrolling1.Update();
            scrolling2.Update();
        }
Ejemplo n.º 9
0
 public override void LoadContent()
 {
     random    = new Random();
     font1     = Content.Load <SpriteFont>("SpriteFont1");
     texBack   = texFromFile(graphicsDevice, dir + "nextLevel.png");
     Particle2 = Util.texFromFile(graphicsDevice, Dir.dir + "Particle2.png");
     back1     = new ImageBackground(texBack, Color.White, graphicsDevice);
     tex       = Particle2;
     setSys2();
 }
Ejemplo n.º 10
0
        public override bool Execute(UICommandContext ctx)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Image Files(*.jpg;*.png)|*.jpg;*.png";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                var bkg = new ImageBackground(ImageTexture2D.Create(dlg.FileName));
                ctx.RenderView.GetViewer().SetBackground(bkg);
            }
            return(true);
        }
Ejemplo n.º 11
0
        public override void LoadContent()
        {
            pauseHelpText  = Content.Load <SpriteFont>("helpText");
            texPauseScreen = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Pause.jpg");  //
            texBack        = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Pause.jpg");  //
            texPause       = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Pause2.jpg"); //

            pauseBackground = new ImageBackground(texBack, Color.White, graphicsDevice);
            pause           = new Sprite3(true, texPause, 444, 30);

            pause.setWidthHeight(pause.getWidth() / 2, pause.getHeight() / 2);
            pause.setColor(Color.Aquamarine);
        }
Ejemplo n.º 12
0
        private void backgroundImageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Image files (*.png;*.jpg)|*.png;*.jpg";
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var texture    = ImageTexture2D.Create(dlg.FileName);
            var background = new ImageBackground(texture);

            mRenderView.GetViewer().SetBackground(background);
        }
Ejemplo n.º 13
0
        public override void WillMoveToSuperview(UIView newsuper)
        {
            base.WillMoveToSuperview(newsuper);

            if (newsuper == null)
            {
                ExpandCollapseCommand    = null;
                ShowHideModalViewCommand = null;
                NavigateAddressesCommand = null;

                DisposeGestures();
                DisposeMapCell();

                ImageBackground.Dispose();
            }
        }
Ejemplo n.º 14
0
        private void DisposeGestures()
        {
            if (_headerImageTapGesture != null)
            {
                ImageBackground.RemoveGestureRecognizer(_headerImageTapGesture);
                _headerImageTapGesture.Dispose();
                _headerImageTapGesture = null;
            }

            if (_descriptionTapGesture != null)
            {
                DescriptionLabel.RemoveGestureRecognizer(_descriptionTapGesture);
                _descriptionTapGesture.Dispose();
                _descriptionTapGesture = null;
            }
        }
Ejemplo n.º 15
0
 private void BgFromImageRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     if (BgFromImageRadioButton.Checked)
     {
         if (BgImage == null)
         {
             MessageBox.Show("Select image first");
             BgFromColorRadioButton.Checked = true;
             return;
         }
         if (Background != null)
         {
             Background.Dispose();
         }
         Background = new ImageBackground(BgImage,
                                          DirectBitmap.Width, DirectBitmap.Height);
     }
 }
        public override void Metamorphose(LegoUIMeta uiMeta)
        {
            if (MetamorphoseStage == LegoMetamorphoseStage.Completed)
            {
                MetamorphoseStage = LegoMetamorphoseStage.Metamorphosing;
            }

            if (progressbarMeta == null)
            {
                progressbarMeta = uiMeta.NextProgressbar;
                RectMeta        = uiMeta.CurrentRect;
            }

            switch (progressbarStatus)
            {
            case YuProgressbarMetamorphoseStatus.Progressbar:
                MetamorphoseRect(RectMeta);
                progressbarStatus = YuProgressbarMetamorphoseStatus.ImageBackground;
                break;

            case YuProgressbarMetamorphoseStatus.ImageBackground:
                ImageBackground.Metamorphose(progressbarMeta.BackgroundImageRect,
                                             progressbarMeta.BackgroundImageMeta);
                progressbarStatus = YuProgressbarMetamorphoseStatus.RectTransform_FillArea;
                break;

            case YuProgressbarMetamorphoseStatus.RectTransform_FillArea:
                YuLegoUtility.MetamorphoseRect(RectFillArea, progressbarMeta.FillAreaMeta);
                progressbarStatus = YuProgressbarMetamorphoseStatus.Image_Fill;
                break;

            case YuProgressbarMetamorphoseStatus.Image_Fill:
                ImageFill.Metamorphose(progressbarMeta.FillImageRect,
                                       progressbarMeta.FillImageMeta);

                progressbarMeta   = null;
                progressbarStatus = YuProgressbarMetamorphoseStatus.Progressbar;
                MetamorphoseStage = LegoMetamorphoseStage.Completed;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 17
0
        public ActionResult BackgroundImage(ImageBackground ii)
        {
            HttpPostedFileBase file = Request.Files["imgfile"];

            try
            {
                con.Open();
                if (file != null && file.ContentLength > 0)
                {
                    file.SaveAs(Server.MapPath("~/imgs/" + file.FileName));
                    ii.imgSrc = "~/imgs/" + file.FileName;
                    string extension = System.IO.Path.GetExtension(file.FileName);
                    if (extension == ".JPEG" || extension == ".png" || extension == ".PNG" || extension == ".jpg" || extension == ".jpeg")
                    {
                        SqlCommand    ee = new SqlCommand("select * from ImageBackground", con);
                        SqlDataReader dr = ee.ExecuteReader();
                        DataTable     dt = new DataTable();
                        dt.Load(dr);
                        if (dt.Rows.Count == 0)
                        {
                            string q = "insert into  ImageBackground Values (N'" + ii.imgSrc + "')";
                            com = new SqlCommand(q, con);
                            com.ExecuteNonQuery();
                            ViewBag.successMsg = "تم الرفع بنجاع";
                        }
                        else
                        {
                            string q = "update  ImageBackground set imgSrc=N'" + ii.imgSrc + "'";
                            com = new SqlCommand(q, con);
                            com.ExecuteNonQuery();
                            ViewBag.successMsg = "تم الرفع بنجاع";
                        }
                    }
                }
                con.Close();
                return(Redirect("BackgroundImage"));
            }
            catch
            {
                ViewData["error"] = "لم يتم الحفظ";
                return(View());
            }
        }
Ejemplo n.º 18
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (tabControlBackgroundType.SelectedIndex == 0)
     {
         if (listViewImages.SelectedItems.Count > 0)
         {
             string image = (string)listViewImages.SelectedItems[0].Tag;
             if (!string.IsNullOrEmpty(image))
             {
                 Background   = new ImageBackground(image);
                 DialogResult = DialogResult.OK;
             }
         }
         else
         {
             MessageBox.Show("Kein Bild gewählt!", "Bildmanager", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else if (tabControlBackgroundType.SelectedIndex == 1)
     {
         Background   = new ColorBackground(pictureBoxColor.BackColor);
         DialogResult = DialogResult.OK;
     }
 }
Ejemplo n.º 19
0
        public override void Metamorphose(LegoUIMeta uiMeta)
        {
            if (MetamorphoseStage == LegoMetamorphoseStage.Completed)
            {
                MetamorphoseStage = LegoMetamorphoseStage.Metamorphosing;
            }

            if (sliderMeta == null)
            {
                sliderMeta = uiMeta.NextSlider;
                RectMeta   = uiMeta.CurrentRect;
            }

            switch (metamorphoseStatus)
            {
            case YuLegoSliderMetamorphoseStatus.Slider:
                YuLegoUtility.MetamorphoseRect(RectTransform, uiMeta.CurrentRect);

                direction    = sliderMeta.Direction;
                minValue     = sliderMeta.MinValue;
                maxValue     = sliderMeta.MaxValue == 0?1:sliderMeta.MaxValue;
                wholeNumbers = sliderMeta.IsWholeNumbers;

                if (sliderMeta.Transition == LegoTransition.ColorTint)
                {
                    var colorTintMeta = sliderMeta.ColorTintMeta;

                    colors = new ColorBlock
                    {
                        normalColor      = colorTintMeta.NormalLegoColor.ToColor(),
                        highlightedColor = colorTintMeta.HighlightedLegoColor.ToColor(),
                        pressedColor     = colorTintMeta.PressedLegoColor.ToColor(),
                        disabledColor    = colorTintMeta.DisabledLegoColor.ToColor(),
                        colorMultiplier  = colorTintMeta.ColorMultiplier,
                        fadeDuration     = colorTintMeta.FadeDuration
                    };
                }

                metamorphoseStatus = YuLegoSliderMetamorphoseStatus.Image_Background;
                break;

            case YuLegoSliderMetamorphoseStatus.Image_Background:
                ImageBackground.Metamorphose(sliderMeta.BackgroundImageRect,
                                             sliderMeta.BackgroundImageMeta);
                metamorphoseStatus = YuLegoSliderMetamorphoseStatus.RectTransform_FillArea;
                break;

            case YuLegoSliderMetamorphoseStatus.RectTransform_FillArea:
                YuLegoUtility.MetamorphoseRect(RectFillArea, sliderMeta.FillAreaMeta);
                metamorphoseStatus = YuLegoSliderMetamorphoseStatus.Image_Fill;
                break;

            case YuLegoSliderMetamorphoseStatus.Image_Fill:
                ImageFill.Metamorphose(sliderMeta.FillImageRect, sliderMeta.FillImageMeta);
                metamorphoseStatus = YuLegoSliderMetamorphoseStatus.RectTransform_HandleSlideArea;
                break;

            case YuLegoSliderMetamorphoseStatus.RectTransform_HandleSlideArea:
                YuLegoUtility.MetamorphoseRect(HandleSlideArea, sliderMeta.HandleSlideAreaRect);
                metamorphoseStatus = YuLegoSliderMetamorphoseStatus.Image_Handle;
                break;

            case YuLegoSliderMetamorphoseStatus.Image_Handle:
                HandleImage.Metamorphose(sliderMeta.HandleImageRect, sliderMeta.HandleImageMeta);

                sliderMeta         = null;
                metamorphoseStatus = YuLegoSliderMetamorphoseStatus.Slider;
                MetamorphoseStage  = LegoMetamorphoseStage.Completed;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 20
0
        public override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(graphicsDevice);
            weaponList  = new SpriteList(20);

            playerXLocation = Dir.rnd.Next(0, 1000);
            playerYLocation = 880;
            enemyXLocation  = -20;
            enemyYLocation  = Dir.rnd.Next(213, 600);
            enemy2XLocation = Dir.rnd.Next(Dir.rightBoundary - 300, Dir.rightBoundary);
            anchorXLocation = Dir.rnd.Next(Dir.leftBoundary + 100, Dir.rightBoundary - 100);
            anchorYLocation = 175;

            texBackgroundLevel2    = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Sea04.png");
            texPlayer              = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\ship-md.png");
            texEnemy1              = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Merchant1.png");
            texEnemy2              = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Merchant2.png");
            texMissile             = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Torpedo5up.png");
            texMissileSmoke        = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Particle1.png");
            texExplostionAnimation = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\explodeWater1024x64.png");
            texMineExplostion      = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\explode1.png");
            texMouse        = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\Mouse.png");
            texAnchor       = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\anchor-th.png");
            texLife         = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\life-preserver-th.png");
            texMine         = Util.texFromFile(graphicsDevice, Dir.dir + @"Art\water_mine.png");
            scoreFont       = Content.Load <SpriteFont>("display");
            helpFont        = Content.Load <SpriteFont>("helpText");
            explostionSound = Content.Load <SoundEffect>("bazooka_fire");
            exLimSound      = new LimitSound(explostionSound, 3);

            backgroundLevel2        = new ImageBackground(texBackgroundLevel2, Color.White, graphicsDevice);
            player                  = new Sprite3(true, texPlayer, playerXLocation, playerYLocation);
            enemy1                  = new Sprite3(true, texEnemy1, enemyXLocation, enemyYLocation);
            enemy2                  = new Sprite3(true, texEnemy2, enemy2XLocation, enemyYLocation);
            explosionAnimation      = new Sprite3(true, texExplostionAnimation, 0, playerYLocation);
            mineExplostionAnimation = new Sprite3(true, texMineExplostion, 0, playerYLocation);
            mine = new Sprite3(true, texMine, 0, 0);
            mine.setHSoffset(new Vector2(296, 313));
            weaponList.addSpriteReuse(mine);
            life = new Sprite3(true, texLife, Dir.rnd.Next(Dir.leftBoundary + 200, Dir.rightBoundary - 200), Dir.rnd.Next(300, 600));
            life.setActiveAndVisible(false);

            for (int i = 1; i < 3; i++)
            {
                anchor = new Sprite3(true, texAnchor, anchorXLocation, anchorYLocation);
                anchor.setWidthHeight(50, 50);
                weaponList.addSpriteReuse(anchor);
            }
            for (int m = 1; m < 6; m++)
            {
                missile = new Sprite3(true, texMissile, playerXLocation, playerYLocation);
                missile.setWidthHeight(missile.getWidth() / 2, missile.getHeight() / 2);
                weaponList.addSpriteReuse(missile);
            }

            player.setColor(Color.Red);

            // Adjusting sprite image sizes to suit my taste
            player.setWidthHeight(210, 64);
            enemy1.setWidthHeight(256, 64);
            enemy2.setWidthHeight(enemy1.getWidth() / 2, 64);
            life.setWidthHeight(48, 48);
            mine.setWidthHeight(40, 45);

            // animation for torpedo explosion
            explosionAnimation.setWidthHeightOfTex(1024, 64);
            explosionAnimation.setXframes(16);
            explosionAnimation.setYframes(1);
            explosionAnimation.setWidthHeight(80, 80);
            for (int moveX = 0; moveX <= 15; moveX++)
            {
                anim[moveX].X = moveX; anim[moveX].Y = 0;
            }
            explosionAnimation.setAnimationSequence(anim, 0, 15, 3);
            explosionAnimation.setAnimFinished(0);
            explosionAnimation.animationStart();

            // animation for mine explostion
            mineExplostionAnimation.setWidthHeightOfTex(1024, 64);
            mineExplostionAnimation.setXframes(16);
            mineExplostionAnimation.setYframes(1);
            mineExplostionAnimation.setWidthHeight(80, 80);
            for (int moveX = 0; moveX <= 15; moveX++)
            {
                mineAnim[moveX].X = moveX; mineAnim[moveX].Y = 0;
            }
            mineExplostionAnimation.setAnimationSequence(mineAnim, 0, 15, 4);
            mineExplostionAnimation.setAnimFinished(0);
            mineExplostionAnimation.animationStart();

            HealthBarAttached h1 = new HealthBarAttached(Color.Aquamarine, Color.Green, Color.Red, 9, true);

            h1.offset                 = new Vector2(0, -1); // one pixel above the bounding box
            h1.gapOfbar               = 2;
            enemy1.hitPoints          = 10;
            enemy1.maxHitPoints       = 10;
            enemy1.attachedRenderable = h1;

            HealthBarAttached h2 = new HealthBarAttached(Color.Aquamarine, Color.Green, Color.Red, 9, true);

            h2.offset                 = new Vector2(0, -1); // one pixel above the bounding box
            h2.gapOfbar               = 2;
            enemy2.hitPoints          = 20;
            enemy2.maxHitPoints       = 20;
            enemy2.attachedRenderable = h2;

            HealthBarAttached playerHP = new HealthBarAttached(Color.Aquamarine, Color.Green, Color.Red, 9, true);

            playerHP.offset           = new Vector2(0, -1); // one pixel above the bounding box
            playerHP.gapOfbar         = 2;
            player.hitPoints          = 50;
            player.maxHitPoints       = 50;
            player.attachedRenderable = playerHP;

            drawSmoke();
        }
Ejemplo n.º 21
0
        //Somewhere to store previous keyboard information so we can detect a single key click(as opposed to the 30 a second we get on a key depress)



        public override void LoadContent()
        {
            spriteBatch = new SpriteBatch(graphicsDevice);

            //
            random = new Random();

            //  font1 = Content.Load<SpriteFont>("Fontey");

            Particle1 = Util.texFromFile(graphicsDevice, Dir.dir + "Particle1.png");
            Particle2 = Util.texFromFile(graphicsDevice, Dir.dir + "Particle2.png");
            Particle3 = Util.texFromFile(graphicsDevice, Dir.dir + "Particle3.png");
            Particle4 = Util.texFromFile(graphicsDevice, Dir.dir + "ParticleArrow.png");
            Particle5 = Util.texFromFile(graphicsDevice, Dir.dir + "Cloud8.png");
            Particle6 = Util.texFromFile(graphicsDevice, Dir.dir + "Bug2.png");

            tex = Particle2;


            //

            font1         = Content.Load <SpriteFont>("SpriteFont1");
            texBack       = texFromFile(graphicsDevice, dir + "levelOneBack1.png");
            spider        = texFromFile(graphicsDevice, dir + "Bug.png");
            texpaddle     = texFromFile(graphicsDevice, dir + "paddle2.png");
            bee           = texFromFile(graphicsDevice, dir + "Bee2.png");
            texAnmiation1 = Util.texFromFile(graphicsDevice, dir + "coin3.png");
            texDragon     = Util.texFromFile(graphicsDevice, dir + "dragon.png");
            scrolling1    = new Scrolling(Content.Load <Texture2D>("skyMenu"), new Rectangle(0, 0, 800, 600));
            scrolling2    = new Scrolling(Content.Load <Texture2D>("skyMenu"), new Rectangle(800, 0, 800, 600));
            music         = Content.Load <SoundEffect>("MUSIC1");
            limSound      = new LimitSound(music, 3);
            bazooka       = Content.Load <SoundEffect>("bazooka_fire");
            baz           = bazooka.CreateInstance();

            LineBatch.init(graphicsDevice);


            dragonList = new SpriteList();
            for (int y = 0; y < 3; y++)
            {
                for (int i = 0; i < 5; i++)
                {
                    dragon = new Sprite3(true, texDragon, 250 + a, 80 + b);
                    dragon.setXframes(8);
                    dragon.setYframes(1);
                    dragon.setWidthHeight(32, 32);
                    //anmiation1.setBBToTexture();
                    dragon.setBB(7, 7, 130, 124);
                    Vector2[] seq1 = new Vector2[8];
                    seq1[0].X = 0; seq1[0].Y = 0;
                    seq1[1].X = 1; seq1[1].Y = 0;
                    seq1[2].X = 2; seq1[2].Y = 0;
                    seq1[3].X = 3; seq1[3].Y = 0;
                    seq1[4].X = 4; seq1[4].Y = 0;
                    seq1[5].X = 5; seq1[5].Y = 0;
                    seq1[6].X = 6; seq1[6].Y = 0;
                    seq1[7].X = 7; seq1[7].Y = 0;

                    dragon.setAnimationSequence(seq1, 0, 7, 10);
                    dragon.animationStart();
                    dragonList.addSpriteReuse(dragon);
                    a = a + 64;
                }
                a = 0;
                b = b + 80;
            }

            ballPos = new Vector2(xx, yy);
            paddle  = new Sprite3(true, texpaddle, xx, bot - texpaddle.Height);
            paddle.setBBToTexture();
            back1    = new ImageBackground(texBack, Color.White, graphicsDevice);
            playArea = new Rectangle(lhs, top, rhs - lhs, bot - top);      // width and height

            texBall = Util.texFromFile(graphicsDevice, dir + "ball2.png"); //***

            ball = new Sprite3(true, texBall, xx, yy);
            ball.setBBandHSFractionOfTexCentered(0.7f);
        }
Ejemplo n.º 22
0
 public override void LoadContent()
 {
     font1   = Content.Load <SpriteFont>("SpriteFont1");
     texBack = texFromFile(graphicsDevice, dir + "gameOver.png");
     back1   = new ImageBackground(texBack, Color.White, graphicsDevice);
 }
Ejemplo n.º 23
0
 private void DisposeImageBackground()
 {
     ImageBackground.Dispose();
 }
Ejemplo n.º 24
0
        void ReleaseDesignerOutlets()
        {
            if (DescriptionBottomConstraint != null)
            {
                DescriptionBottomConstraint.Dispose();
                DescriptionBottomConstraint = null;
            }

            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }

            if (DescriptionTopConstraint != null)
            {
                DescriptionTopConstraint.Dispose();
                DescriptionTopConstraint = null;
            }

            if (HeaderHeightConstraint != null)
            {
                HeaderHeightConstraint.Dispose();
                HeaderHeightConstraint = null;
            }

            if (ImageBackground != null)
            {
                ImageBackground.Dispose();
                ImageBackground = null;
            }

            if (ImageHeightConstraint != null)
            {
                ImageHeightConstraint.Dispose();
                ImageHeightConstraint = null;
            }

            if (ImageWidthConstraint != null)
            {
                ImageWidthConstraint.Dispose();
                ImageWidthConstraint = null;
            }

            if (MapCell != null)
            {
                MapCell.Dispose();
                MapCell = null;
            }

            if (MapHeightConstraint != null)
            {
                MapHeightConstraint.Dispose();
                MapHeightConstraint = null;
            }

            if (MapWidthConstraint != null)
            {
                MapWidthConstraint.Dispose();
                MapWidthConstraint = null;
            }

            if (MapXConstraint != null)
            {
                MapXConstraint.Dispose();
                MapXConstraint = null;
            }

            if (MapYConstraint != null)
            {
                MapYConstraint.Dispose();
                MapYConstraint = null;
            }
        }