Example #1
0
        private void PopulateGameWorld()
        {
            int maxHeight = graphics.PreferredBackBufferHeight;
            int maxWidth = graphics.PreferredBackBufferWidth;

            scatterView = new XnaScatterView(controller, "Canvas.jpg", 0, maxHeight, 0, maxWidth);
            scatterView.Center = new Vector2(maxWidth / 2, maxHeight / 2);

            // Item 1 - Translate, Rotate
            XnaScatterViewItem item1 = new XnaScatterViewItem(controller, "Card01.png", scatterView);
            item1.CanTranslateFlick = false;
            item1.CanRotateFlick = false;
            item1.CanScale = false;
            item1.CanScaleFlick = false;
            item1.Center = new Vector2(r.Next(maxWidth), r.Next(maxHeight));
            scatterView.AddItem(item1);

            // Item 2 
            XnaScatterViewItem item2 = new XnaScatterViewItem(controller, "Card02.png", scatterView);
            item2.CanRotate = false;
            item2.CanRotateFlick = false;
            item2.CanScaleFlick = false;
            item2.Center = new Vector2(r.Next(maxWidth), r.Next(maxHeight));
            scatterView.AddItem(item2);

            // Item 3
            XnaScatterViewItem item3 = new XnaScatterViewItem(controller, "Card04.png", scatterView);
            item3.CanRotate = false;
            item3.CanRotateFlick = false;
            item3.Center = new Vector2(r.Next(maxWidth), r.Next(maxHeight));
            scatterView.AddItem(item3);

            // Item 4
            XnaScatterViewItem item4 = new XnaScatterViewItem(controller, "Card03.png", scatterView);
            item4.CanScale = false;
            item4.CanScaleFlick = false;
            item4.Center = new Vector2(r.Next(maxWidth), r.Next(maxHeight));
            scatterView.AddItem(item4);

            // Item 5
            XnaScatterViewItem item5 = new XnaScatterViewItem(controller, "Card05.png", scatterView);
            item5.Center = new Vector2(r.Next(maxWidth), r.Next(maxHeight));
            scatterView.AddItem(item5);

            gameObjects.Add(scatterView);
        }
 //==========================================================//
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="passedColor">The color of the item.</param>
 /// <param name="passedParent">The item's parent XnaScatterView.</param>
 public XnaScatterViewItem(UIController controller, string contentImage, XnaScatterView passedParent)
     :base(controller, 1, 1 )
 {
     textureSourceFile = contentImage;
     parent = passedParent;
 }
Example #3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing) 
     {
         IDisposable graphicsDispose = graphics as IDisposable;
         if (graphicsDispose != null)
         {
             graphicsDispose.Dispose();
         }
         if (spriteBatch != null)
         {
             spriteBatch.Dispose();
             spriteBatch = null;
         }
         if (touchTarget != null)
         {
             touchTarget.Dispose();
             touchTarget = null;
         }
         if (scatterView != null)
         {
             scatterView.Dispose();
             scatterView = null;
         }
     }
     base.Dispose(disposing);
 }