public void Destroy() { // Get the instance Debug.WriteLine(" SBNodeManager.Destroy()"); this.baseDestroy(); #if (TRACK_DESTRUCTOR) if (SBNodeMan.pSBNodeRef != null) { Debug.WriteLine(" {0} ({1})", SBNodeMan.pSBNodeRef, SBNodeMan.pSBNodeRef.GetHashCode()); } #endif SBNodeManager.pSBNodeRef = null; }
//public void Attach(GameSprite.Name name) //{ // Debug.Assert(this.pSBNodeMan != null); // this.pSBNodeMan.Attach(name); //} //public void Attach(BoxSprite.Name name) //{ // Debug.Assert(this.pSBNodeMan != null); // this.pSBNodeMan.Attach(name); //} //public void Attach(ProxySprite pNode) //{ // Debug.Assert(this.pSBNodeMan != null); // SBNode pSBNode = this.pSBNodeMan.Attach(pNode); //} public void Attach(SpriteBase pNode) { Debug.Assert(pNode != null); // Go to Man, get a node from reserve, add to active, return it SBNode pSBNode = (SBNode)this.pSBNodeMan.Attach(pNode); Debug.Assert(pSBNode != null); // Initialize SpriteBatchNode pSBNode.Set(pNode, this.pSBNodeMan); this.pSBNodeMan.SetSpriteBatch(this); }
public void draw() { // get the active list SBNode pActiveList = (SBNode)this.baseGetActiveList(); // walk through the list and render while (pActiveList != null) { Debug.Assert(pActiveList.getSpriteBase() != null); pActiveList.getSpriteBase().render(); pActiveList = (SBNode)pActiveList.pNext; } }
//public void Detach(SpriteBase pNode) //{ // Debug.Assert(pNode != null); // SBNode pSBNode = this.Find(pNode); // //if(pSBNode == null) // //{ // // Debug.Assert(true); // //} // this.BaseRemove(pSBNode); //} public void Detach(SpriteBase pSB) { Debug.Assert(pSB != null); SBNode pSBNode = pSB.GetBackToSBNode(); pSB.pBackToSBNode = null; SBNodeManager pMan = pSBNode.GetBackToSBNodeManager(); pSBNode.pBackToSBNodeManager = null; pMan.Remove(pSBNode); //this.poSBNodeMan.Detach(pNode); }
//public SpriteBatch GetBackToSpriteBatch() //{ // Debug.Assert(this.pBackToSpriteBatch != null); // return this.pBackToSpriteBatch; //} //public void SetBackToSpriteBatch(SpriteBatch pSpriteBatch) //{ // Debug.Assert(pSpriteBatch != null); // this.pBackToSpriteBatch = pSpriteBatch; //} public void Draw() { SBNode pNode = (SBNode)this.BaseGetActive(); // Update() should be called in each sprites before call this Draw() function. if (this.collisionBoxToggle == true) { while (pNode != null) { pNode.GetSpriteBase().Render(); pNode = (SBNode)pNode.pNext; } } }
public void DumpSpriteBases() { SBNode pSBNode = (SBNode)this.BaseGetActive(); int i = 0; while (pSBNode != null) { Debug.WriteLine("<->#{0}", i); pSBNode.DumpSB(); pSBNode = (SBNode)pSBNode.pNext; i++; } }
public void Destroy() { // Get the instance #if (TRACK_DESTRUCTOR) Debug.WriteLine(" SBNodeMan.Destroy({0})", this.GetHashCode()); #endif this.BaseDestroy(); #if (TRACK_DESTRUCTOR) Debug.WriteLine(" {0} ({1})", this.poNodeCompare, this.poNodeCompare.GetHashCode()); #endif this.name = SpriteBatch.Name.Uninitialized; this.poNodeCompare = null; this.pBackSpriteBatch = null; }
public void Draw() { SBNode pSpriteBatchNode = (SBNode)this.pSBNodeMan.GetActive(); //int debugPrintCount = 0; while (pSpriteBatchNode != null) { //debugPrintCount++; // Assumes someone before here called update() on each sprite // OK... data is right so --> Draw me. pSpriteBatchNode.GetSpriteBase().Draw(); pSpriteBatchNode = (SBNode)pSpriteBatchNode.pMNext; } //Debug.WriteLine("{0} sprites from SpriteBatch({1}) drawn", debugPrintCount, this.name); }
//---------------------------------------------------------------------- // Override Abstract methods //---------------------------------------------------------------------- protected override bool DerivedCompare(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); SBNode pDataA = (SBNode)pLinkA; SBNode pDataB = (SBNode)pLinkB; Boolean status = false; if (pDataA.GetSpriteBase() == pDataB.GetSpriteBase()) { status = true; } return(status); }
//just like the set methods in SBNode; attach for each type //public SBNode Attach(GameSprite.Name name) //{ // // take node from reserve, wash the links // //adds it to the active list and set the name // SBNode pNode = (SBNode)this.baseAdd(); // Debug.Assert(pNode != null); // // sets the SBnode pointer // pNode.Set(name); // return pNode; //} //public SBNode Attach(BoxSprite.Name name) //{ // // take node from reserve, wash the links // //adds it to the active list and set the name // SBNode pNode = (SBNode)this.baseAdd(); // Debug.Assert(pNode != null); // //sets the SBnode pointer // pNode.Set(name); // return pNode; //} //public SBNode Attach(ProxySprite pNode) //{ // SBNode pSBNode = (SBNode)this.baseAdd(); // Debug.Assert(pNode != null); // pSBNode.Set(pNode); // return pSBNode; //} public void Draw() { // starting node SBNode pNode = (SBNode)this.BaseGetActive(); SBNode pNext = null; while (pNode != null) { pNext = (SBNode)pNode.pNext; pNode.GetSpriteBase().Render(); //ok because all nodes in this are SpriteBase objects pNode = pNext; } }
public virtual void Reset() { Debug.Assert(this.poProxySprite != null); SBNode pSBNode = this.poProxySprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.RemoveSprite(pSBNode); Debug.Assert(this.poColObj != null); Debug.Assert(this.poColObj.pColSprite != null); pSBNode = this.poColObj.pColSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.RemoveSprite(pSBNode); GONodeMan.Dettach(this); }
public void remove(SpriteBase pNode) { Debug.Assert(pNode != null); SBNode pSBNode = (SBNode)this.poSBNodeMan.baseGetActiveList(); Debug.Assert(pSBNode != null); while (pSBNode != null) { if (pSBNode.getSpriteBase() == pNode) { // to do.. pSBNode.pNext.pPrev = pSBNode.pPrev; pSBNode.pPrev.pNext = pSBNode.pNext; break; } pSBNode = (SBNode)pSBNode.pNext; } }
//---------------------------------------------------------------------- // Abstract methods //---------------------------------------------------------------------- public virtual void remove() { //Debug.WriteLine("REMOVE: {0}", this); // remove from SpriteBatch Debug.Assert(this.getProxySprite() != null); SBNode pSBNode = this.getProxySprite().GetSBNode(); // remove it from the manager Debug.Assert(pSBNode != null); SpriteBatchMan.Remove(pSBNode); // remove collision sprite from spriteBatch Debug.Assert(this.poCollisionObject != null); Debug.Assert(this.poCollisionObject.pCollisionSprite != null); pSBNode = this.poCollisionObject.pCollisionSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.Remove(pSBNode); // remove from GameObjectMan GameObjectMan.Remove(this); }
override protected Boolean DerivedCompare(DLink pLinkA, DLink pLinkB) { // This is used in baseFind() Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); SBNode pDataA = (SBNode)pLinkA; SBNode pDataB = (SBNode)pLinkB; Boolean status = false; // Stubbed this function out if (pLinkB == pLinkA) { status = false; } else { status = false; } return(status); }
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; } }
//intially had this in each of my objects(D.R.Y) //to remove Sprite & its collision box //from the sprite batches and GO node man public virtual void Remove() { //Debug.WriteLine("Remove: {0}", this); Debug.Assert(this.poProxySprite != null); SBNode pSBNode = this.poProxySprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.RemoveSprite(pSBNode); Debug.Assert(this.poColObj != null); Debug.Assert(this.poColObj.pColSprite != null); pSBNode = this.poColObj.pColSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchMan.RemoveSprite(pSBNode); GONodeMan.Dettach(this); //then add it to a graveyard to use later GraveyardMan.Bury(this); }
public void Remove(SBNode pSpriteBatchNode) { Debug.Assert(pSpriteBatchNode != null); this.pSBNodeMan.Remove(pSpriteBatchNode); }
override protected void DerivedDumpNode(DLink pLink) { Debug.Assert(pLink != null); SBNode pData = (SBNode)pLink; // pData.Dump(); }
public void Remove(SBNode pNode) { Debug.Assert(pNode != null); this.BaseRemove(pNode); }
protected override void DerivedDumpNode(DLink pDLink) { SBNode pSBNode = (SBNode)pDLink; pSBNode.DumpSB(); }
public void SetBackToSBNode(SBNode pSBNode) { Debug.Assert(pSBNode != null); this.pBackToSBNode = pSBNode; }
protected override void DerivedWash(DLink pDLink) { SBNode pSBNode = (SBNode)pDLink; pSBNode.Wash(); }
public SpriteBase() : base() { this.pBackSBNode = null; }
public void SetSBNode(SBNode pSpriteBatchNode) { Debug.Assert(pSpriteBatchNode != null); this.pBackSBNode = pSpriteBatchNode; }