Example #1
0
        override public void render()
        {
            Debug.Assert(this.azulSprite != null);
            Debug.Assert(this.fontColor != null);
            Debug.Assert(this.screenRect != null);
            Debug.Assert(this.text != null);
            Debug.Assert(this.text.Length > 0);

            float xTmp = this.x;
            float yTmp = this.y;

            float xEnd = this.x;

            for (int i = 0; i < this.text.Length; i++)
            {
                int   key    = Convert.ToByte(text[i]);
                Glyph pGlyph = GlyphManager.Find(this.glyphName, key);
                Debug.Assert(pGlyph != null);
                xTmp = xEnd + pGlyph.glyphRect.width / 2;
                this.screenRect.Set(xTmp, yTmp, pGlyph.glyphRect.width, pGlyph.glyphRect.height);
                azulSprite.Swap(pGlyph.glyphTex.getAzulTexture(), pGlyph.glyphRect, this.screenRect, this.fontColor);
                azulSprite.Update();
                azulSprite.Render();
                xEnd = pGlyph.glyphRect.width / 2 + xTmp;
            }
        }
Example #2
0
        public override void Render()
        {
            Debug.Assert(this.pAzulSprite != null);
            Debug.Assert(this.pColor != null);
            Debug.Assert(this.pScreenRect != null);
            Debug.Assert(this.pMessage != null);
            Debug.Assert(this.pMessage.Length > 0);

            float xTmp = this.x;
            float yTmp = this.y;

            float xEnd = this.x;

            for (int i = 0; i < this.pMessage.Length; i++)
            {
                int key = Convert.ToByte(pMessage[i]);

                Glyph pGlyph = GlyphManager.Find(this.glyphName, key);
                Debug.Assert(pGlyph != null);

                xTmp = xEnd + pGlyph.GetAzulSubRect().width / 2;
                this.pScreenRect.Set(xTmp, yTmp, pGlyph.GetAzulSubRect().width, pGlyph.GetAzulSubRect().height);

                pAzulSprite.Swap(pGlyph.GetAzulTexture(), pGlyph.GetAzulSubRect(), this.pScreenRect, this.pColor);

                pAzulSprite.Update();
                pAzulSprite.Render();

                // move the starting to the next character
                xEnd = pGlyph.GetAzulSubRect().width / 2 + xTmp;
            }
        }
Example #3
0
        public static void Remove(Glyph pNode)
        {
            Debug.Assert(pNode != null);
            GlyphManager pManager = GlyphManager.privGetInstance();

            pManager.baseRemove(pNode);
        }
        public override void LoadContent()
        {
            this.poSpriteNodeBatchMan = new SpriteNodeBatchManager(3, 1);
            SpriteNodeBatchManager.SetActive(this.poSpriteNodeBatchMan);

            SpriteNodeBatch pSB_Texts = SpriteNodeBatchManager.Add(SpriteNodeBatch.Name.Texts);

            Texture pTexture = TextureManager.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");

            GlyphManager.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            Font pFont;

            pFont = FontManager.Add(Font.Name.GameOver, SpriteNodeBatch.Name.Texts, "GAME OVER", Glyph.Name.Consolas36pt, 300, 400);
            pFont.SetColor(0.50f, 0.50f, 0.50f);



            // -----------------------------------------------------------------------------
            // ---------------------- Create Sprite Node Batches ---------------------------
            // -----------------------------------------------------------------------------



            SpriteNodeBatch pBatch_Texts    = SpriteNodeBatchManager.Add(SpriteNodeBatch.Name.Texts, 2);
            SpriteNodeBatch pBatch_Player   = SpriteNodeBatchManager.Add(SpriteNodeBatch.Name.Players, 5);
            SpriteNodeBatch pBatch_TheSwarm = SpriteNodeBatchManager.Add(SpriteNodeBatch.Name.TheSwarm, 10);
            SpriteNodeBatch pBatch_Shields  = SpriteNodeBatchManager.Add(SpriteNodeBatch.Name.Shields, 200);


            SpriteNodeBatch pBatch_Boxes = SpriteNodeBatchManager.Add(SpriteNodeBatch.Name.Boxes, 400);

            pBatch_Boxes.SetDrawStatus(false);
        }
Example #5
0
        public static void Destroy()
        {
            // Get the instance
            GlyphManager pInstance = GlyphManager.PrivGetInstance();

            pInstance.BaseDestroy();
        }
Example #6
0
        public static void Remove(Glyph pNode)
        {
            Debug.Assert(pNode != null);
            GlyphManager pInstance = GlyphManager.PrivGetInstance();

            pInstance.BaseRemove(pNode);
        }
        public static void Remove(Glyph pNode)
        {
            Debug.Assert(pNode != null);
            GlyphManager pMan = GlyphManager.getSingleton();

            pMan.genericRemove(pNode);
        }
Example #8
0
        public static void Print()
        {
            GlyphManager pManager = GlyphManager.privGetInstance();

            Debug.Assert(pManager != null);

            Debug.WriteLine("------ Glyph Manager ------");
            pManager.basePrint();
        }
Example #9
0
        public static GlyphManager getInstance()
        {
            if (privInstance == null)
            {
                privInstance = new GlyphManager();
            }

            return(privInstance);
        }
Example #10
0
        public static void Remove(Glyph pNode)
        {
            GlyphManager pMan = GlyphManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.BaseRemove(pNode);
        }
Example #11
0
        public static void DumpLists()
        {
            GlyphManager pMan = privGetInstance();

            Debug.Assert(pMan != null);

            Debug.WriteLine("------ Glyph Manager Dump Lists------");
            pMan.baseDumpLists();
        }
Example #12
0
        public static void Dump()
        {
            GlyphManager pMan = GlyphManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            Debug.WriteLine("------ Glyph Manager ------");
            pMan.BaseDump();
        }
Example #13
0
        public static void Destroy()
        {
            GlyphManager pMan = GlyphManager.PrivGetInstance();

#if (TRACK_DESTRUCTOR)
            Debug.WriteLine("--->GlyphMan.Destroy()");
#endif
            pMan.BaseDestroy();
        }
Example #14
0
        public void loadFont()
        {
            TextureManager.add(Texture.TextureName.GITex, "Final_Sprites.tga");
            TextureManager.add(Texture.TextureName.Consolas36pt, "Consolas36pt.tga");
            SpriteBatch pSB_Texts = SpriteBatchManager.add(SpriteBatch.SpriteBatchName.Text);

            GlyphManager.addXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.TextureName.Consolas36pt);
            FontManager.add(Font.FontName.GameOver, SpriteBatch.SpriteBatchName.Text, "Game Over!!!!!", Glyph.Name.Consolas36pt, 300, 600, Unit.redColor);
            FontManager.add(Font.FontName.Instruction1, SpriteBatch.SpriteBatchName.Text, "Your Score is " + PlayerManager.getCurrentPlayer().score, Glyph.Name.Consolas36pt, 300, 550, Unit.redColor);
        }
Example #15
0
        public static void Remove(Glyph pNode)
        {
            //get the singleton
            GlyphManager pMan = privGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.baseRemoveNode(pNode);
        }
Example #16
0
        public static void Dump()
        {
            GlyphManager pInstance = GlyphManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            Debug.WriteLine("------ Glyph Manager ------");
            pInstance.PrintStats();
            pInstance.PrintNodes();
        }
Example #17
0
 //-----------------------------------------------------------------------------
 // Game::UnLoadContent()
 //       unload content (resources loaded above)
 //       unload all content that was loaded before the Engine Loop started
 //-----------------------------------------------------------------------------
 public override void UnLoadContent()
 {
     FontManager.Destroy();
     GlyphManager.Destroy();
     CollisionPairManager.Destroy();
     SpriteAnimationManager.Destroy();
     SpriteBoxManager.Destroy();
     SpriteManager.Destroy();
     ImageManager.Destroy();
     TextureManager.Destroy();
 }
Example #18
0
        public static void PrintReport()
        {
            Debug.WriteLine("--------------------------------------------------------------------------------");
            Debug.WriteLine("------------------------------- Glyph Manager --------------------------------");
            Debug.WriteLine("--------------------------------------------------------------------------------");

            GlyphManager pMan = GlyphManager.PrivGetInstance();

            Debug.Assert(pMan != null);
            pMan.BasePrintReport();
        }
        public static Glyph Add(Glyph.Name name, int key, Texture.TextureName textName, float x, float y, float width, float height)
        {
            GlyphManager pMan = GlyphManager.getSingleton();

            Glyph pNode = (Glyph)pMan.genericAdd();

            Debug.Assert(pNode != null);

            pNode.setAll(name, key, textName, x, y, width, height);
            return(pNode);
        }
Example #20
0
        //----------------------------------------------------------------------
        // Static Manager methods can be implemented with base methods
        // Can implement/specialize more or less methods your choice
        //----------------------------------------------------------------------
        public static void Create(int reserveNum = 3, int reserveGrow = 1)
        {
            Debug.Assert(reserveNum >= 0);
            Debug.Assert(reserveGrow > 0);

            // Do the initialization
            if (pInstance == null)
            {
                pInstance = new GlyphManager(reserveNum, reserveGrow);
            }
        }
Example #21
0
        public static Glyph Add(Glyph.Name name, int key, Texture.Name textName, float x, float y, float width, float height)
        {
            GlyphManager pInstance = GlyphManager.PrivGetInstance();

            Glyph pNode = (Glyph)pInstance.BaseAdd();

            Debug.Assert(pNode != null);

            pNode.Set(name, key, textName, x, y, width, height);
            return(pNode);
        }
Example #22
0
        public static Glyph Find(int key)
        {
            GlyphManager pMan = GlyphManager.GetInstance();

            // Compare functions only compares two Nodes

            pMan.pNodeCompare.key = key;

            Glyph pData = (Glyph)pMan.BaseFind(pMan.pNodeCompare);

            return(pData);
        }
Example #23
0
        public static Glyph Find(Glyph.Name name, int key)
        {
            GlyphManager pInstance = GlyphManager.PrivGetInstance();

            // Compare functions only compares two Nodes
            pInstance.pRefNode.name = name;
            pInstance.pRefNode.key  = key;

            Glyph pData = (Glyph)pInstance.BaseFind(pInstance.pRefNode);

            return(pData);
        }
Example #24
0
        public static Glyph Find(Glyph.Name name, int key)
        {
            GlyphManager pMan = GlyphManager.PrivGetInstance();

            // Compare functions only compares two Nodes
            pMan.poNodeToCompare.name = name;
            pMan.poNodeToCompare.key  = key;

            Glyph pData = (Glyph)pMan.BaseFind(pMan.poNodeToCompare);

            return(pData);
        }
Example #25
0
        public static Glyph Find(Glyph.Name name, int key)
        {
            //get the singleton
            GlyphManager pMan = privGetInstance();

            // Compare functions only compares two Nodes
            pMan.pRefNode.SetName(name);
            pMan.pRefNode.key = key;

            Glyph pData = (Glyph)pMan.baseFindNode(pMan.pRefNode);

            return(pData);
        }
        public static void Create(int deltaRefillCount = 3, int prefillCount = 5)
        {
            Debug.WriteLine("Creating Tex Manager instance");

            Debug.Assert(deltaRefillCount > 0);
            Debug.Assert(prefillCount > 0);
            if (glyphMInst == null)
            {
                glyphMInst = new GlyphManager(deltaRefillCount, prefillCount);
            }

            Debug.Assert(glyphMInst != null);
        }
Example #27
0
        //----------------------------------------------------------------------------------
        // Static Methods
        //----------------------------------------------------------------------------------
        public static void Create(int initReserve = 36, int growthRate = 1)
        {
            // pre-conditions
            Debug.Assert(initReserve > 0);
            Debug.Assert(growthRate > 0);

            Debug.Assert(pInstance == null);

            // create the one an only instance.
            if (pInstance == null)
            {
                pInstance = new GlyphManager(initReserve, growthRate);
            }
        }
Example #28
0
        public void loadFont()
        {
            SpriteBatch pSB_Texts = SpriteBatchManager.add(SpriteBatch.SpriteBatchName.Text);

            GlyphManager.addXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.TextureName.Consolas36pt);
            FontManager.add(Font.FontName.Welcome, SpriteBatch.SpriteBatchName.Text, "Welcome To Space Inavders Game", Glyph.Name.Consolas36pt, 150, 800, Unit.whiteColor);
            //FontManager.add(Font.FontName.ModeSelection1, SpriteBatch.SpriteBatchName.Text, "Press 1 to Start Single Player Game", Glyph.Name.Consolas36pt, 100, 400,Unit.redColor);
            FontManager.add(Font.FontName.ModeSelection2, SpriteBatch.SpriteBatchName.Text, "Press 1 to Start Single Player Game", Glyph.Name.Consolas36pt, 100, 340, Unit.blueColor);

            FontManager.add(Font.FontName.Points, SpriteBatch.SpriteBatchName.Text, "30 Points", Glyph.Name.Consolas36pt, 400, 700, Unit.blueColor);
            FontManager.add(Font.FontName.Points, SpriteBatch.SpriteBatchName.Text, "20 Points", Glyph.Name.Consolas36pt, 400, 630, Unit.purpleColor);
            FontManager.add(Font.FontName.Points, SpriteBatch.SpriteBatchName.Text, "10 Points", Glyph.Name.Consolas36pt, 400, 560, Unit.whiteColor);
            FontManager.add(Font.FontName.Points, SpriteBatch.SpriteBatchName.Text, "100 Points", Glyph.Name.Consolas36pt, 400, 500, Unit.redColor);
        }
Example #29
0
        //----------------------------------------------------------------------
        // Static Manager methods can be implemented with base methods
        // Can implement/specialize more or less methods your choice
        //----------------------------------------------------------------------
        public static void Create(int reserveNum = 3, int reserveGrow = 1)
        {
            // make sure values are ressonable
            Debug.Assert(reserveNum > 0);
            Debug.Assert(reserveGrow > 0);

            // initialize the singleton here
            Debug.Assert(pInstance == null);

            // Do the initialization
            if (pInstance == null)
            {
                pInstance = new GlyphManager(reserveNum, reserveGrow);
            }
        }
        //Converts the character in XML to class Character
        public static void addXml(Glyph.Name glyphName, String assetName, Texture.TextureName textName)
        {
            Character     c;
            XmlSerializer serializer = new XmlSerializer(typeof(Character));
            XmlTextReader file       = new XmlTextReader(assetName);

            while (file.Read())
            {
                if (file.GetAttribute("key") != null)
                {
                    c = (Character)serializer.Deserialize(file);
                    GlyphManager.Add(glyphName, c.key, textName, c.x, c.y, c.width, c.height);
                }
            }
        }