コード例 #1
0
        public static void Print()
        {
            BoxSpriteManager pBoxMan = BoxSpriteManager.privGetInstance();

            Debug.Assert(pBoxMan != null);
            pBoxMan.basePrint();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        public static void Dump()
        {
            BoxSpriteManager pMan = BoxSpriteManager.privGetInstance();

            Debug.Assert(pMan != null);

            pMan.BaseDump();
        }
コード例 #5
0
        public static void Remove(BoxSprite pBoxSprite)
        {
            BoxSpriteManager pBoxMan = BoxSpriteManager.privGetInstance();

            Debug.Assert(pBoxMan != null);

            Debug.Assert(pBoxSprite != null);
            pBoxMan.baseRemove(pBoxSprite);
        }
コード例 #6
0
        public static void Remove(BoxSprite pNode)
        {
            BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.BaseRemove(pNode);
        }
コード例 #7
0
ファイル: BoxSprite.cs プロジェクト: Smybarr/space_invaders
        public static void DumpLists()
        {
            BoxSpriteManager pMan = privGetInstance();

            Debug.Assert(pMan != null);

            Debug.WriteLine("------ BoxSprite Manager Lists ------");
            pMan.baseDumpLists();
        }
コード例 #8
0
ファイル: BoxSpriteManager.cs プロジェクト: Arnold-2/SInvader
        public static BoxSpriteManager getInstance()
        {
            if (pInstance == null)
            {
                pInstance = new BoxSpriteManager();
            }

            return(pInstance);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
ファイル: BoxSprite.cs プロジェクト: Smybarr/space_invaders
        public static void Remove(BoxSprite pNode)
        {
            //get the singleton
            BoxSpriteManager pMan = privGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.baseRemoveNode(pNode);
        }
コード例 #11
0
        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
        }
コード例 #12
0
        public static void PrintReport()
        {
            Debug.WriteLine("--------------------------------------------------------------------------------");
            Debug.WriteLine("------------------------------ BoxSprite Manager -------------------------------");
            Debug.WriteLine("--------------------------------------------------------------------------------");

            BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance();

            Debug.Assert(pMan != null);
            pMan.BasePrintReport();
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        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);
        }
コード例 #17
0
        //---------------------------------------------------------------------------------
        // 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);
            }
        }
コード例 #18
0
        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);
        }
コード例 #19
0
ファイル: BoxSprite.cs プロジェクト: Smybarr/space_invaders
        //----------------------------------------------------------------------
        // 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);
        }
コード例 #20
0
        //----------------------------------------------------------------------------------
        // 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);
            }
        }
コード例 #21
0
        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);
        }
コード例 #22
0
        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);
        }
コード例 #23
0
ファイル: CollisionObject.cs プロジェクト: wangjo22/Final
        //--------------------------------------------------------------------------------------------
        // 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);
        }
コード例 #24
0
        //-----------------------------------------------------------------------------
        // 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();
        }
コード例 #25
0
ファイル: BoxSprite.cs プロジェクト: Smybarr/space_invaders
        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;
        }
コード例 #26
0
        //----------------------------------------------------------------------
        // 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);
            }
        }
コード例 #27
0
        //----------------------------------------------------------------------------------
        // 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);
        }
コード例 #28
0
        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);
            }
        }
コード例 #29
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);
        }
コード例 #30
0
ファイル: BoxSprite.cs プロジェクト: Smybarr/space_invaders
        //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-------");
        }