Beispiel #1
0
        public void Set(Font.Name name, String pMessage, Glyph.Name glyphName, float xStart, float yStart)
        {
            Debug.Assert(pMessage != null);
            this.pMessage = pMessage;

            this.x = xStart;
            this.y = yStart;

            this.name = name;

            // TODO: for wash... this should be a nullGlyph
            this.glyphName = glyphName;

            // Force color to white
            Debug.Assert(this.pColor != null);
            this.pColor.Set(1.0f, 1.0f, 1.0f);

            float totalWidth = 0.0f;
            float maxHeight  = 0.0f;

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

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

                totalWidth += pGlyph.GetAzulSubRect().width;
                if (pGlyph.GetAzulSubRect().height > maxHeight)
                {
                    maxHeight = pGlyph.GetAzulSubRect().height;
                }
            }
            this.pColRect.Set(new Azul.Rect(this.x + totalWidth / 2, this.y, totalWidth, maxHeight));
        }
Beispiel #2
0
        public void Set(Font.Name name, String pMessage, Glyph.Name glyphName, float xStart, float yStart)
        {
            Debug.Assert(pMessage != null);

            this.name = name;
            this.pFontSprite.Set(name, pMessage, glyphName, xStart, yStart);
        }
Beispiel #3
0
        //----------------------------------------------------------------------------------
        // Methods
        //----------------------------------------------------------------------------------
        public void Set(Font.Name fontName, String pMessage, Glyph.Name glyphName, float px, float py)
        {
            Debug.Assert(pMessage != null);

            this.name = fontName;
            //Delegate to inner FontSprite
            this.pFontSprite.Set(fontName, pMessage, glyphName, px, py);
        }
Beispiel #4
0
        public Glyph Add(Glyph.Name name, int key, Texture.Name textName, float x, float y, float width, float height)
        {
            Glyph pNode = (Glyph)this.PullFromReserved();

            Debug.Assert(pNode != null);

            pNode.Set(name, key, textName, x, y, width, height);
            this.Add(pNode);
            return(pNode);
        }
Beispiel #5
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);
        }
Beispiel #6
0
        //----------------------------------------------------------------------------------
        // Methods
        //----------------------------------------------------------------------------------

        public void Set(Glyph.Name theName, int key, Texture.Name textName, float x, float y, float width, float height)
        {
            this.name     = theName;
            this.pTexture = TextureManager.Find(textName);

            Debug.Assert(this.pTexture != null);
            Debug.Assert(this.pSubRect != null);

            this.pSubRect.Set(x, y, width, height);
            this.key = key;
        }
Beispiel #7
0
 public void set(Font.FontName name, String text, Glyph.Name glyphName, float xStart, float yStart, Azul.Color color)
 {
     Debug.Assert(text != null);
     this.text      = text;
     this.x         = xStart;
     this.y         = yStart;
     this.fontName  = name;
     this.glyphName = glyphName;
     Debug.Assert(color != null);
     this.fontColor.Set(color);
 }
        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);
        }
Beispiel #9
0
        public FontSprite()
        {
            this.pAzulSprite = new Azul.Sprite();
            this.pScreenRect = new Azul.Rect();
            this.pColor      = new Azul.Color(1.0f, 1.0f, 1.0f);

            this.pMessage  = null;
            this.glyphName = Glyph.Name.Uninitialized;

            this.x = 0.0f;
            this.y = 0.0f;
        }
Beispiel #10
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);
        }
Beispiel #11
0
        public void Set(Glyph.Name name, int key, Texture.Name textName, float x, float y, float width, float height)
        {
            Debug.Assert(this.pSubRect != null);
            this.name = name;

            this.pTexture = TextureManager.getInstance().FindTextureByName(textName);
            Debug.Assert(this.pTexture != null);

            this.pSubRect.Set(x, y, width, height);

            this.key = key;
        }
Beispiel #12
0
        //----------------------------------------------------------------------------------
        // Constructor
        //----------------------------------------------------------------------------------
        public FontSprite() : base()
        {
            // Make a dummy sprite.  Will be finished by Set() Method later.
            this.x         = 0.0f;
            this.y         = 0.0f;
            this.glyphName = Glyph.Name.Uninitialized;
            this.pMessage  = null;

            this.pAzulSprite = new Azul.Sprite();
            this.pScreenRect = new Azul.Rect();
            this.pColor      = new Azul.Color(1.0f, 1.0f, 1.0f);
        }
Beispiel #13
0
        public FontSprite()
            : base()
        {
            // Create a dummy sprite, it will get correctly linked in Set()

            this.pAzulSprite = new Azul.Sprite();
            this.pScreenRect = new Azul.Rect();
            this.pColor      = new Azul.Color(1.0f, 1.0f, 1.0f);

            this.pMessage  = null;
            this.glyphName = Glyph.Name.Uninitialized;
        }
Beispiel #14
0
        public FontSprite() : base()
        {
            this.azulSprite = new Azul.Sprite();
            this.screenRect = new Azul.Rect();
            this.fontColor  = new Azul.Color(1, 0, 0);

            this.text      = null;
            this.glyphName = Glyph.Name.Uninitialized;

            this.x = 0.0f;
            this.y = 0.0f;
        }
Beispiel #15
0
        public static Glyph Find(Glyph.Name name, int key)
        {
            GlyphMan pMan = GlyphMan.GetInstance();

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

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

            return(pData);
        }
Beispiel #16
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);
        }
Beispiel #17
0
        public void setAll(Glyph.Name name, int key, Texture.TextureName textName, float x, float y, float width, float height)
        {
            Debug.Assert(this.glyphRect != null);
            this.glyphName = name;

            this.glyphTex = TextureManager.find(textName);
            Debug.Assert(this.glyphTex != null);

            this.glyphRect.Set(x, y, width, height);

            this.key = key;
        }
Beispiel #18
0
        public static Glyph Find(Glyph.Name name, int key)
        {
            GlyphMan pGMan = GlyphMan.PrivGetInstance();

            Debug.Assert(pGMan != null);

            pGMan.pRefNode.name = name;
            pGMan.pRefNode.key  = key;

            Glyph pGlyphData = (Glyph)pGMan.BaseFind(pGMan.pRefNode);

            return(pGlyphData);
        }
Beispiel #19
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);
        }
Beispiel #20
0
        public void Set(FontNode.Name name, String pMessage, Glyph.Name glyphName, float xStart, float yStart)
        {
            Debug.Assert(pMessage != null);
            this.pMessage = pMessage;

            this.x = xStart;
            this.y = yStart;

            this.name      = name;
            this.glyphName = glyphName;

            // Force color to white
            Debug.Assert(this.pColor != null);
            this.pColor.Set(1.0f, 1.0f, 1.0f);
        }
        //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);
                }
            }
        }
Beispiel #22
0
        public void Set(Font.Name name, String pMessage, Glyph.Name glyphName, float x, float y)
        {
            Debug.Assert(pMessage != null);
            this.pMessage = pMessage;

            this.x = x;
            this.y = y;

            this.name      = name;
            this.glyphName = glyphName;

            //set color to white
            Debug.Assert(this.pColor != null);
            this.pColor.Set(1.0f, 1.0f, 1.0f);
        }
Beispiel #23
0
        public static Glyph Find(Glyph.Name name, int key)
        {
            DLink ptr = pMan.poActive;

            while (ptr != null)
            {
                if (((Glyph)ptr).GetKey() == key)
                {
                    return((Glyph)ptr);
                }

                ptr = ptr.pNext;
            }

            return(null);
        }
Beispiel #24
0
        public void Set(Font.Name fontName, String pMessage, Glyph.Name glyphName, float px, float py)
        {
            Debug.Assert(pMessage != null);
            this.pMessage = pMessage;

            this.name = fontName;
            this.x    = px;
            this.y    = py;

            // TODO: for wash... this should be a nullGlyph
            this.glyphName = glyphName;

            // Default white font
            Debug.Assert(this.pColor != null);
            this.pColor.Set(1.0f, 1.0f, 1.0f);
        }
        public static Glyph Find(Glyph.Name name, int key)
        {
            GlyphManager texManInst = GlyphManager.getSingleton();

            Debug.Assert(texManInst != null);
            Glyph pseudoTex = texManInst.refGlyph;

            Debug.Assert(pseudoTex != null);

            pseudoTex.glyphName = name;
            pseudoTex.key       = key;

            Glyph targetTex = (Glyph)texManInst.genericFind(pseudoTex);

            return(targetTex);
        }
Beispiel #26
0
        public Glyph FindGlyph(Glyph.Name _name, int _key)
        {
            // Compare functions only compares two Nodes
            Glyph current = (Glyph)(this.poActiveHead);

            while (current != null)
            {
                if (current.name == _name && current.key == _key)
                {
                    return(current);
                }

                current = (Glyph)(current.pNext);
            }

            return(null);
        }
Beispiel #27
0
 public static void AddXml(Glyph.Name glyphName, String assetName, Texture.Name textName)
 {
     GlyphMan.AddXml(glyphName, assetName, textName);
 }
Beispiel #28
0
        public static Font Add(Font.Name name, SpriteBatch.Name SB_Name, String pMessage, Glyph.Name glyphName, float xStart, float yStart)
        {
            FontMan pMan = FontMan.GetInstance();

            Font pNode = (Font)pMan.baseAdd();

            Debug.Assert(pNode != null);

            pNode.set(name, pMessage, glyphName, xStart, yStart);

            // Add to sprite batch
            SpriteBatch pSB = SpriteBatchMan.Find(SB_Name);

            Debug.Assert(pSB != null);
            Debug.Assert(pNode.pFontSprite != null);
            pSB.attach(pNode.pFontSprite);

            return(pNode);
        }
Beispiel #29
0
        public static void AddXml(Glyph.Name glyphName, String assetName, Texture.Name textName)
        {
            System.Xml.XmlTextReader reader = new XmlTextReader(assetName);

            int key    = -1;
            int x      = -1;
            int y      = -1;
            int width  = -1;
            int height = -1;

            // I'm sure there is a better way to do this... but this works for now
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:     // The node is an element.
                    if (reader.GetAttribute("key") != null)
                    {
                        key = Convert.ToInt32(reader.GetAttribute("key"));
                    }
                    else if (reader.Name == "x")
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Text)
                            {
                                x = Convert.ToInt32(reader.Value);
                                break;
                            }
                        }
                    }
                    else if (reader.Name == "y")
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Text)
                            {
                                y = Convert.ToInt32(reader.Value);
                                break;
                            }
                        }
                    }
                    else if (reader.Name == "width")
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Text)
                            {
                                width = Convert.ToInt32(reader.Value);
                                break;
                            }
                        }
                    }
                    else if (reader.Name == "height")
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Text)
                            {
                                height = Convert.ToInt32(reader.Value);
                                break;
                            }
                        }
                    }
                    break;

                case XmlNodeType.EndElement:     //Display the end of the element
                    if (reader.Name == "character")
                    {
                        // have all the data... so now create a glyph
                        //Debug.WriteLine("key:{0} x:{1} y:{2} w:{3} h:{4}", key, x, y, width, height);
                        GlyphManager.Add(glyphName, key, textName, x, y, width, height);
                    }
                    break;
                }
            }

            // Debug.Write("\n");
        }
Beispiel #30
0
        public static Font Add(Font.Name name, SpriteBatch.Name SB_Name, String pMessage, Glyph.Name glyphName, float x, float y)
        {
            FontMan pFMan = FontMan.PrivGetInstance();

            Debug.Assert(pFMan != null);

            Font pFNode = (Font)pFMan.BaseAdd();

            Debug.Assert(pFNode != null);

            pFNode.Set(name, pMessage, glyphName, x, y);

            SpriteBatch pSpriteBatch = SpriteBatchMan.Find(SB_Name);

            Debug.Assert(pSpriteBatch != null);

            Debug.Assert(pFNode.pFontSprite != null);
            pSpriteBatch.Attach(pFNode.pFontSprite);

            return(pFNode);
        }