Пример #1
0
        public static void Draw()
        {
            SpriteBatchMan pMan = SpriteBatchMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            // walk through the list and render
            SpriteBatch pSpriteBatch = (SpriteBatch)pMan.BaseGetActive();

            while (pSpriteBatch != null)
            {
                SBNodeMan pSBNodeMan = pSpriteBatch.GetSBNodeMan();
                Debug.Assert(pSBNodeMan != null);

                if (pSpriteBatch.GetisDraw())
                {
                    pSBNodeMan.Draw();
                }

                pSpriteBatch = (SpriteBatch)pSpriteBatch.pNext;
                //SBNode pNode = (SBNode)pSBNodeMan.BaseGetActive();

                //while (pNode != null)
                //{
                //    // Assumes someone before here called update() on each sprite
                //    // Draw me.
                //    pNode.getSpriteBase().Render();

                //    pNode = (SBNode)pNode.pNext;
                //}

                //pSpriteBatch = (SpriteBatch)pSpriteBatch.pNext;
            }
        }
Пример #2
0
 public SpriteBatch()
     : base()
 {
     this.name       = SpriteBatch.Name.Uninitialized;
     this.pSBNodeMan = new SBNodeMan();
     Debug.Assert(this.pSBNodeMan != null);
     this.isDraw = true;
 }
Пример #3
0
        public static void Remove(SBNode pSpriteBatchNode)
        {
            Debug.Assert(pSpriteBatchNode != null);
            SBNodeMan pSBNodeMan = pSpriteBatchNode.getSBNodeMan();

            Debug.Assert(pSBNodeMan != null);
            pSBNodeMan.remove(pSpriteBatchNode);
        }
Пример #4
0
        public static void RemoveSprite(SBNode pSpriteBaseNode)
        {
            Debug.Assert(pSpriteBaseNode != null);
            //Get the manager that holds the sprite base node
            SBNodeMan pSBNodeMan = pSpriteBaseNode.GetSBNodeMan();

            Debug.Assert(pSBNodeMan != null);
            pSBNodeMan.Remove(pSpriteBaseNode);
        }
Пример #5
0
        public void Dettach(SpriteBase pNodeToRemove)
        {
            //use the back pointers
            Debug.Assert(pNodeToRemove != null);
            SBNode pSBNode = pNodeToRemove.GetSBNode();

            SBNodeMan pSBNodeMan = this.GetSBNodeMan();

            pSBNodeMan.Remove(pSBNode);
        }
Пример #6
0
        public SpriteBatch()
            : base()
        {
            this.name = SpriteBatch.Name.Unitialized;

            // this is why SBNode manager cant be a singleton
            this.poSBNodeMan = new SBNodeMan();
            Debug.Assert(this.poSBNodeMan != null);
            this.bToggle = true;
        }
Пример #7
0
        //---------------------------------------------------------------------------------------------------------
        // Methods
        //---------------------------------------------------------------------------------------------------------
        public void set(SpriteBase pNode, SBNodeMan pSBNodeMan)
        {
            Debug.Assert(pNode != null);
            this.pSpriteBase = pNode;

            // set back pointer, easy for deletion
            Debug.Assert(this.pSpriteBase != null);
            this.pSpriteBase.SetSBNode(this);

            Debug.Assert(pSBNodeMan != null);
            this.pBackSBNodeMan = pSBNodeMan;
        }
Пример #8
0
        public void Set(SpriteBase pNode, SBNodeMan pInSBNodeMan)
        {
            Debug.Assert(pNode != null);
            this.pSpriteBase = pNode;

            //set back pointers
            Debug.Assert(pSpriteBase != null);
            this.pSpriteBase.SetSBNode(this);

            Debug.Assert(pInSBNodeMan != null);
            this.pBackSBNodeMan = pInSBNodeMan;
        }
Пример #9
0
        //~SBNode()
        //{
        //    this.pSpriteBase = null;
        //}

        //public void Set(GameSprite.Name name)
        //{
        //    // Go find it
        //    this.pSpriteBase = GameSpriteMan.Find(name);
        //    Debug.Assert(this.pSpriteBase != null);
        //}

        //public void Set(BoxSprite.Name name)
        //{
        //    // Go find it
        //    this.pSpriteBase = BoxSpriteMan.Find(name);
        //    Debug.Assert(this.pSpriteBase != null);
        //}

        //public void Set(ProxySprite pNode)
        //{
        //    // associate it
        //    Debug.Assert(pNode != null);
        //    this.pSpriteBase = pNode;
        //}

        public void Set(SpriteBase pNode, SBNodeMan _pSBNodeMan)
        {
            Debug.Assert(pNode != null);
            this.pSpriteBase = pNode;

            // Set the back pointer
            // Allows easier deletion in the future
            Debug.Assert(pSpriteBase != null);
            this.pSpriteBase.SetSBNode(this);

            Debug.Assert(_pSBNodeMan != null);
            this.pBackSBNodeMan = _pSBNodeMan;
        }
Пример #10
0
        public static void Draw()
        {
            SpriteBatchMan pMan = SpriteBatchMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            //need access to the Sprites,
            //in the SpriteBatch to render
            SpriteBatch pSBatch = (SpriteBatch)pMan.BaseGetActive();

            while (pSBatch != null)
            {
                if (pSBatch.bToggle == true)
                {
                    SBNodeMan pSBNodeMan = pSBatch.GetSBNodeMan();
                    Debug.Assert(pSBNodeMan != null);

                    pSBNodeMan.Draw();
                }

                pSBatch = (SpriteBatch)pSBatch.pNext;
            }
        }
        public void Draw()
        {
            //SpriteBatchMan pMan = SpriteBatchMan.PrivGetInstance();
            //Debug.Assert(pMan != null);

            // walk through the list and render
            SpriteBatch pSpriteBatch = (SpriteBatch)this.BaseGetActive();

            //int count = 0;
            while (pSpriteBatch != null)
            {
                //count++;
                if (pSpriteBatch.display == true)
                {
                    SBNodeMan pSBNodeMan = pSpriteBatch.GetSBNodeMan();
                    Debug.Assert(pSBNodeMan != null);

                    pSBNodeMan.Draw();
                }
                pSpriteBatch = (SpriteBatch)pSpriteBatch.pNext;
            }
            //Debug.WriteLine("DrawCount:{0}", count);
        }
Пример #12
0
        public static void Draw()
        {
            //ensure call Create() first
            SpriteBatchMan pMan = SpriteBatchMan.GetInstance();

            Debug.Assert(pMan != null);

            // get the active list
            SpriteBatch pSpriteBatch = (SpriteBatch)pMan.baseGetActiveList();

            // walk through the list and render
            while (pSpriteBatch != null)
            {
                if (pSpriteBatch.getIsDraw())
                {
                    SBNodeMan pSBNodeMan = pSpriteBatch.getSBNodeMan();
                    Debug.Assert(pSBNodeMan != null);

                    pSBNodeMan.draw();
                }

                pSpriteBatch = (SpriteBatch)pSpriteBatch.pNext;
            }
        }
Пример #13
0
        public static void Update()
        {
            SpriteBatchMan pMan = SpriteBatchMan.PrivGetInstance();

            Debug.Assert(pMan != null);
            SpriteBatch pSpriteBatch = (SpriteBatch)pMan.BaseGetActive();

            while (pSpriteBatch != null)
            {
                SBNodeMan pSBNodeMan = pSpriteBatch.GetSBNodeMan();
                Debug.Assert(pSBNodeMan != null);

                SBNode pNode = (SBNode)pSBNodeMan.BaseGetActive();

                while (pNode != null)
                {
                    pNode.GetSpriteBase().Update();

                    pNode = (SBNode)pNode.pNext;
                }

                pSpriteBatch = (SpriteBatch)pSpriteBatch.pNext;
            }
        }
Пример #14
0
 public SBNode()
     : base()
 {
     this.pSpriteBase    = null; // SBNode does not own pSpriteBase
     this.pBackSBNodeMan = null;
 }
Пример #15
0
 public void Wash()
 {
     this.pSpriteBase    = null;
     this.pBackSBNodeMan = null;
 }
Пример #16
0
 public SBNode()
     : base()
 {
     this.pSpriteBase    = null;
     this.pBackSBNodeMan = null;
 }