public static void Print() { BoxSpriteManager pBoxMan = BoxSpriteManager.privGetInstance(); Debug.Assert(pBoxMan != null); pBoxMan.basePrint(); }
public ColObject(ProxySprite pProxySprite) { Debug.Assert(pProxySprite != null); // Create Collision Rect // Use the reference sprite to set size and shape // need to refactor if you want it different GameSprite pSprite = pProxySprite.pSprite; Debug.Assert(pSprite != null); // Origin is in the UPPER RIGHT this.poColRect = new ColRect(pSprite.GetScreenRect()); Debug.Assert(this.poColRect != null); // Create the box sprite //WORKING //this.pColSprite = BoxSpriteManager.Add(GameSprite.Name.Box, this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height); //TEST this.pColSprite = BoxSpriteManager.Add(pProxySprite.pSprite.GetName(), this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height); ////get the box name from the matching sprite name; //BoxSprite.Name colBoxName = (BoxSprite.Name) pProxySprite.pSprite.GetName(); //Debug.Assert(colBoxName != null); //this.pColSprite = BoxSpriteManager.Find(colBoxName); //this.pColSprite.SetScreenRect(this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height); //Debug.Assert(this.pColSprite != null); this.pColSprite.SetLineColor(1.0f, 1.0f, 0.0f); }
public void RecycleAllActive() { SpriteBatchNode current = (SpriteBatchNode)this.poActiveHead; SpriteBatchNode pOld; while (current != null) { if (current.pSprite.pGameObject != null) { GameObjectManager.getInstance().Remove(current.pSprite.pGameObject.Wash()); } if (current.pSprite.GetType() == typeof(GameSprite)) { GameSpriteManager.getInstance().Remove(current.pSprite.Wash()); } else if (current.pSprite.GetType() == typeof(BoxSprite)) { BoxSpriteManager.getInstance().Remove(current.pSprite.Wash()); } pOld = current; current = (SpriteBatchNode)current.pNext; this.Remove(pOld); } }
public static void Dump() { BoxSpriteManager pMan = BoxSpriteManager.privGetInstance(); Debug.Assert(pMan != null); pMan.BaseDump(); }
public static void Remove(BoxSprite pBoxSprite) { BoxSpriteManager pBoxMan = BoxSpriteManager.privGetInstance(); Debug.Assert(pBoxMan != null); Debug.Assert(pBoxSprite != null); pBoxMan.baseRemove(pBoxSprite); }
public static void Remove(BoxSprite pNode) { BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance(); Debug.Assert(pMan != null); Debug.Assert(pNode != null); pMan.BaseRemove(pNode); }
public static void DumpLists() { BoxSpriteManager pMan = privGetInstance(); Debug.Assert(pMan != null); Debug.WriteLine("------ BoxSprite Manager Lists ------"); pMan.baseDumpLists(); }
public static BoxSpriteManager getInstance() { if (pInstance == null) { pInstance = new BoxSpriteManager(); } return(pInstance); }
public void Set(BoxSprite.Name name) { this.name = ProxyBoxSprite.Name.Proxy; this.x = 0.0f; this.y = 0.0f; this.pBoxSprite = BoxSpriteManager.Find(name); Debug.Assert(this.pBoxSprite != null); }
public static void Remove(BoxSprite pNode) { //get the singleton BoxSpriteManager pMan = privGetInstance(); Debug.Assert(pMan != null); Debug.Assert(pNode != null); pMan.baseRemoveNode(pNode); }
public static void Destroy() { BoxSpriteManager pMan = BoxSpriteManager.privGetInstance(); Debug.Assert(pMan != null); // Do something clever here // track peak number of active nodes // print stats on destroy // invalidate the singleton }
public static void PrintReport() { Debug.WriteLine("--------------------------------------------------------------------------------"); Debug.WriteLine("------------------------------ BoxSprite Manager -------------------------------"); Debug.WriteLine("--------------------------------------------------------------------------------"); BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance(); Debug.Assert(pMan != null); pMan.BasePrintReport(); }
public static BoxSprite Find(BoxSprite.Name theName) { BoxSpriteManager pBoxMan = BoxSpriteManager.privGetInstance(); Debug.Assert(pBoxMan != null); pBoxMan.poNodeCompare.SetName(theName); BoxSprite pBoxSprite = (BoxSprite)pBoxMan.baseFind(pBoxMan.poNodeCompare); return(pBoxSprite); }
public static BoxSprite Add(BoxSprite.Name theName, float x, float y, float width, float height, Azul.Color pColor = null) { BoxSpriteManager pBoxMan = BoxSpriteManager.privGetInstance(); Debug.Assert(pBoxMan != null); BoxSprite pNode = (BoxSprite)pBoxMan.baseAdd(); Debug.Assert(pNode != null); pNode.Set(theName, x, y, width, height, pColor); return(pNode); }
public static BoxSprite Find(BoxSprite.Name name) { BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance(); Debug.Assert(pMan != null); pMan.poNodeCompare.name = name; BoxSprite pData = (BoxSprite)pMan.BaseFind(pMan.poNodeCompare); Debug.Assert(pData != null); return(pData); }
public static BoxSprite Add(BoxSprite.Name name, Azul.Rect pRect) { BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance(); Debug.Assert(pMan != null); BoxSprite pNode = (BoxSprite)pMan.BaseAdd(); Debug.Assert(pNode != null); // Initialize the Data pNode.Set(name, pRect); return(pNode); }
//--------------------------------------------------------------------------------- // Static Methods //--------------------------------------------------------------------------------- public static void Create(int reserveNum = 3, int reserveGrow = 1) { Debug.Assert(reserveNum > 0); Debug.Assert(reserveGrow > 0); // Initialize the singleton here Debug.Assert(pInstance == null); // Do the initialization if (pInstance == null) { pInstance = new BoxSpriteManager(reserveNum, reserveGrow); } }
public static BoxSprite Find(BoxSprite.Name name) { BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance(); Debug.Assert(pMan != null); // So: Use the Compare Node - as a reference // use in the Compare() function pMan.poNodeCompare.SetName(name); BoxSprite pData = (BoxSprite)pMan.BaseFind(pMan.poNodeCompare); return(pData); }
//---------------------------------------------------------------------- // 4 Wrapper methods: baseAdd, baseFind, baseRemove, baseDump //---------------------------------------------------------------------- //EDIT THE FOLLOWING METHODS--------------------- //public static BoxSprite Add(BoxSprite.Name name, Azul.Rect pScreenRect) //{ // BoxSpriteManager pMan = privGetInstance(); // Debug.Assert(pMan != null); // BoxSprite pNode = (BoxSprite)pMan.baseAddToFront(); // Debug.Assert(pNode != null); // pNode.Set(name, pScreenRect); // return pNode; //} public static BoxSprite Add(GameSprite.Name spriteName, float x, float y, float width, float height, Azul.Color lineColor = null) { BoxSpriteManager pMan = BoxSpriteManager.privGetInstance(); Debug.Assert(pMan != null); BoxSprite pNode = (BoxSprite)pMan.baseAddToFront(); Debug.Assert(pNode != null); // wash it pNode.Set(spriteName, x, y, width, height, lineColor); return(pNode); }
//---------------------------------------------------------------------------------- // Static Methods //---------------------------------------------------------------------------------- public static void Create(int initReserve = 3, int growthRate = 1) { // pre-conditions Debug.Assert(initReserve > 0); Debug.Assert(growthRate > 0); Debug.Assert(BoxSpriteManager.pInstance == null); // create the one an only instance. if (BoxSpriteManager.pInstance == null) { BoxSpriteManager.pInstance = new BoxSpriteManager(initReserve, growthRate); } }
public static BoxSprite Add(BoxSprite.Name name, float x, float y, float width, float height, Azul.Color pColor = null) { BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance(); Debug.Assert(pMan != null); BoxSprite pNode = (BoxSprite)pMan.BaseAdd(); Debug.Assert(pNode != null); // Initialize the Data pNode.Set(name, x, y, width, height, pColor); return(pNode); }
public static BoxSprite Add(BoxSprite.Name name, Azul.Color pColor = null) { BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance(); Debug.Assert(pMan != null); BoxSprite pNode = (BoxSprite)pMan.BaseAdd(); Debug.Assert(pNode != null); pNode.Set(name, pColor); return(pNode); }
//-------------------------------------------------------------------------------------------- // Constructor //-------------------------------------------------------------------------------------------- public CollisionObject(ProxySprite proxySprite) { Debug.Assert(proxySprite != null); GameSprite pSprite = proxySprite.pSprite; Debug.Assert(pSprite != null); this.pColRect = new CollisionRect(pSprite.GetScreenRect()); Debug.Assert(this.pColRect != null); this.pBoxSprite = BoxSpriteManager.Add(BoxSprite.Name.CollisionBox, this.pColRect.x, this.pColRect.y, this.pColRect.width, this.pColRect.height); Debug.Assert(this.pBoxSprite != null); this.pBoxSprite.SetColor(1.0f, 1.0f, 1.0f); }
//----------------------------------------------------------------------------- // Game::UnLoadContent() // unload content (resources loaded above) // unload all content that was loaded before the Engine Loop started //----------------------------------------------------------------------------- public override void UnLoadContent() { TextureManager.Destroy(); ImageManager.Destroy(); GameSpriteManager.Destroy(); BoxSpriteManager.Destroy(); SpriteBatchManager.Destroy(); ProxySpriteManager.Destroy(); TimerEventManager.Destroy(); DeathManager.Destroy(); }
public static void Destroy() { // Get the instance BoxSpriteManager pMan = BoxSpriteManager.privGetInstance(); Debug.WriteLine("--->BoxSpriteMan.Destroy()"); pMan.baseDestroy(); #if (TRACK_DESTRUCTOR) Debug.WriteLine(" {0} ({1})", BoxSpriteMan.pBoxSpriteRef, BoxSpriteMan.pBoxSpriteRef.GetHashCode()); Debug.WriteLine(" {0} ({1})", BoxSpriteMan.pInstance, BoxSpriteMan.pInstance.GetHashCode()); #endif BoxSpriteManager.pBoxSpriteRef = null; BoxSpriteManager.pInstance = null; }
//---------------------------------------------------------------------- // Methods //---------------------------------------------------------------------- public static void Create(int reserveNum = 3, int reserveGrow = 1) { // make sure values are ressonable Debug.Assert(reserveNum > 0); Debug.Assert(reserveGrow > 0); Debug.Assert(pInstance == null); // Do the initialization if (pInstance == null) { pInstance = new BoxSpriteManager(reserveNum, reserveGrow); } }
//---------------------------------------------------------------------------------- // Data //---------------------------------------------------------------------------------- //public BoxSprite pCollSprite; //public CollRect poColRect; //---------------------------------------------------------------------------------- // Constructors //---------------------------------------------------------------------------------- public NullCollisionObject(ProxySprite pProxySprite) { Debug.Assert(pProxySprite != null); GameSprite pGameSprite = pProxySprite.pSprite; Debug.Assert(pGameSprite != null); // Origin is in the upper-right this.poColRect = new CollRect(pGameSprite.GetScreenRect()); Debug.Assert(this.poColRect != null); // Create the Sprite this.pCollSprite = BoxSpriteManager.Add(BoxSprite.Name.Box, this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height); Debug.Assert(this.pCollSprite != null); this.pCollSprite.SetLineColor(1.0f, 1.0f, 1.0f); }
public static void Create(int numNodes = 5, int growthSize = 2) { // make sure values are ressonable Debug.Assert(numNodes > 0); Debug.Assert(growthSize > 0); // initialize the singleton here Debug.Assert(pInstance == null); // Do the initialization if (pInstance == null) { pInstance = new BoxSpriteManager(numNodes, growthSize); BoxSpriteManager.Add(BoxSprite.Name.Uninitialized, 0, 0, Constants.uninitializedWidth, Constants.uninitializedHeight); BoxSpriteManager.Add(BoxSprite.Name.NullObject, 0, 0, 0, 0); } }
public CollisionObject(ProxySprite pProxySprite) { Debug.Assert(pProxySprite != null); // Create Collision Rect // Use the reference sprite to set size and shape // need to refactor if you want it different GameSprite pSprite = pProxySprite.pSprite; Debug.Assert(pSprite != null); // Origin is in the UPPER RIGHT this.poColRect = new CollisionRect(pSprite.GetScreenRect()); Debug.Assert(this.poColRect != null); // Create the sprite this.pColSprite = BoxSpriteManager.Add(BoxSprite.Name.Box, this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height); Debug.Assert(this.pColSprite != null); this.pColSprite.SetLineColor(1.0f, 1.0f, 0.0f); }
//public facing constructor for instantiation of the singleton instance public static void Create(int startReserveSize = 3, int refillSize = 1) { // make sure values are reasonable Debug.Assert(startReserveSize > 0); Debug.Assert(refillSize > 0); // initialize the singleton here: Debug.Assert(pInstance == null); // Do the initialization if (pInstance == null) { //constructor can only be called here since private access pInstance = new BoxSpriteManager(startReserveSize, refillSize); } // Add a default data node? Debug.WriteLine("------BoxSprite Manager Initialized-------"); }