Пример #1
0
        public Models(ContentPool content, Device device)
        {
            ClientCommon.Mesh billboard = Meshes.PositionTexcoord(content.Device, Meshes.IndexedPlane(
                -0.5f, 0,
                1, 1));
            content.Register("modelsBillboard", billboard);

            //==========================================//
            //========== SKINNED MESHES BEGIN ==========//
            //==========================================//

            effects[Common.Effect.AngelWings] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("shinealight1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("shinealight1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = Matrix.RotationX((float)Math.PI / 2) * Matrix.RotationZ((float)Math.PI) * Matrix.Scaling(0.3f, 0.3f, 0.3f) * Matrix.Translation(0, 0, 0.7f),
                HasAlpha = true,
            };

            effects[Common.Effect.Wave] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("bash1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("bash1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = Matrix.RotationX((float)Math.PI/2) * Matrix.RotationZ((float)Math.PI) * Matrix.Scaling(0.5f, 0.5f, 0.5f) * Matrix.Translation(0, 0, 0.7f),
                HasAlpha = true,
            };

            effects[Common.Effect.Explosion] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("fireballhit1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("fireballhit1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = Matrix.RotationX((float)Math.PI / 2) * Matrix.Scaling(0.15f, 0.15f, 0.15f) * Matrix.Translation(0, 0, 1f),
                HasAlpha = true,
            };

            effects[Common.Effect.Hit] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("cc_instant1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("cc_instant1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = Matrix.RotationY((float)Math.PI / 2) * Matrix.Scaling(0.15f, 0.15f, 0.15f) * Matrix.Translation(0, 0, 1f),
                HasAlpha = true,
            };

            effects[Common.Effect.Fear] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("fear_duration1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("fear_duration1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = Matrix.RotationX((float)Math.PI / 2) * Matrix.RotationZ((float)-Math.PI / 2) * Matrix.Scaling(0.1f, 0.1f, 0.1f) * Matrix.Translation(0, 0, 2f),
                HasAlpha = true,
            };

            effects[Common.Effect.Fireball] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("fireball1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("fireball1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = Matrix.RotationX((float)Math.PI / 2) * Matrix.RotationZ((float)-Math.PI / 2) * Matrix.Scaling(0.175f, 0.175f, 0.175f) * Matrix.Translation(0, 0, 0.75f),
                HasAlpha = true,
            };

            effects[Common.Effect.Cast] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("cast.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("crusaders_building_death1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.025f, 0.025f, 0.025f) * Matrix.Translation(0, 0, 0.75f),
                HasAlpha = true,
            };

            effects[Common.Effect.Hot] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("heal_duration1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("heal_duration1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.25f, 0.25f, 0.25f) * Matrix.Translation(0, 0, 0.75f),
                HasAlpha = true,
            };

            effects[Common.Effect.Dot] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("dot.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("bloodsplatter1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.15f, 0.15f, 0.15f) * Matrix.Translation(0, 0, 0.75f),
                HasAlpha = true,
            };

            effects[Common.Effect.Channeling] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("channeling.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("bloodsplatter1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.5f, 0.5f, 0.5f) * Matrix.Translation(0, 0, 0.75f),
                HasAlpha = true,
            };

            effects[Common.Effect.UnitHealed] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("heal_instant1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("heal_instant1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.25f, 0.25f, 0.25f) * Matrix.Translation(0, 0, 0.75f),
                HasAlpha = true,
            };

            effects[Common.Effect.RuffianBuildingDemolished] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("ruffians_building_death1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("ruffians_building_death1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = Matrix.Scaling(0.75f, 0.75f, 0.75f),
                HasAlpha = true,
            };

            effects[Common.Effect.HumanBuildingDemolished] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("crusaders_building_death1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("crusaders_building_death1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = Matrix.Scaling(0.75f, 0.75f, 0.75f),
                HasAlpha = true,
            };

            effects[Common.Effect.UnitKilled] = new Model
            {
                Texture = content.Get<SlimDX.Direct3D9.Texture>("bloodsplatter1.png"),
                SkinnedMesh = content.Get<SkinnedMesh>("bloodsplatter1.x"),
                Effect = content.Get<SlimDX.Direct3D9.Effect>("effects.fx"),
                World = Matrix.Scaling(3.5f, 3.5f, 3.5f) * Matrix.Translation(0, 10, 0),
                HasAlpha = true,
            };

            models[Common.Model.Butterfly] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("butterflies1.x"),
                Texture = content.Get<Texture>("butterflies1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.25f, 0.25f, 0.25f),
                IsBillboard = false,
                Id = "butterflies1"
            };

            models[Common.Model.DemonSpawn] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("demonspawn1.x"),
                Texture = content.Get<Texture>("demonspawn1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.25f, 0.25f, 0.25f) * Matrix.RotationZ((float)Math.PI),
                IsBillboard = false,
                Id = "demonspawn1"
            };

            models[Common.Model.HumanBarrack1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("crusaders_castle_tier1.x"),
                Texture = content.Get<Texture>("crusaders_castle_tier3.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.25f, 0.25f, 0.25f),
                IsBillboard = false,
                Id = "crusaders_castle_tier3"
            };

            models[Common.Model.HumanBarrack2] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("crusaders_castle_tier2.x"),
                Texture = content.Get<Texture>("crusaders_castle_tier3.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.25f, 0.25f, 0.25f),
                Id = "crusaders_castle_tier3"
            };

            models[Common.Model.HumanBarrack3] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("crusaders_castle_tier3.x"),
                Texture = content.Get<Texture>("crusaders_castle_tier3.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.25f, 0.25f, 0.25f),
                Id = "crusaders_castle_tier3"
            };

            models[Common.Model.HumanUnit] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("human_cleric1.x"),
                Texture = content.Get<Texture>("human_cleric1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
                IsBillboard = false,
                Id = "human_cleric1"
            };

            models[Common.Model.Robber1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("robber1.x"),
                Texture = content.Get<Texture>("robber1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                IsBillboard = false,
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
                Id = "robber1"
            };

            models[Common.Model.WolfenBarrack1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("ruffians_fortress_tier1.x"),
                Texture = content.Get<Texture>("ruffians_fortress_tier2.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.7f, 0.7f, 0.7f),
                IsBillboard = false,
                Id = "ruffians_fortress_tier2"
            };

            models[Common.Model.WolfenBarrack2] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("ruffians_fortress_tier2.x"),
                Texture = content.Get<Texture>("ruffians_fortress_tier2.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.5f, 0.5f, 0.5f),
                IsBillboard = false,
                Id = "ruffians_fortress_tier2"
            };

            models[Common.Model.WolfenBarrack3] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("ruffians_fortress_tier3.x"),
                Texture = content.Get<Texture>("ruffians_fortress_tier2.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.4f, 0.4f, 0.4f),
                IsBillboard = false,
                Id = "ruffians_fortress_tier2"
            };

            models[Common.Model.WolfenUnit] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("goblin_blade_master1.x"),
                Texture = content.Get<Texture>("goblin_blade_master1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
                IsBillboard = false,
                Id = "goblin_blade_master1"
            };

            models[Common.Model.Footman1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("footman1.x"),
                Texture = content.Get<Texture>("footman1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
                IsBillboard = false,
                Id = "footman1"
            };

            models[Common.Model.Paladin1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("paladin1.x"),
                Texture = content.Get<Texture>("paladin1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
                IsBillboard = false,
                Id = "paladin1"
            };

            models[Common.Model.HolyKnight1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("holy_knight1.x"),
                Texture = content.Get<Texture>("holy_knight1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
                IsBillboard = false,
                Id = "holy_knight1"
            };

            models[Common.Model.Ogre1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("facebreaker1.x"),
                Texture = content.Get<Texture>("facebreaker1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.2f, 0.2f, 0.2f),
                IsBillboard = false,
                Id = "facebreaker1",
            };

            models[Common.Model.WolfRider1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("wolfrider1.x"),
                Texture = content.Get<Texture>("wolfrider1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.1f, 0.1f, 0.1f),
                IsBillboard = false,
                Id = "wolfrider1"
            };

            models[Common.Model.Warlock1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("warlock1.x"),
                Texture = content.Get<Texture>("warlock1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(0.2f, 0.2f, 0.2f),
                IsBillboard = false,
                Id = "warlock1"
            };

            models[Common.Model.Tower1] = new Model
            {
                SkinnedMesh = content.Get<SkinnedMesh>("tower1.x"),
                Texture = content.Get<Texture>("tower1.png"),
                Effect = content.Get<Effect>("effects.fx"),
                World = InitSkinnedMeshFromMaya * Matrix.Scaling(1f, 1f, 1f),
                IsBillboard = false,
                Id = "tower1"
            };

            //==========================================//
            //========== SKINNED MESHES END ============//
            //==========================================//

            //==========================================//
            //========== X-MESHES BEGIN ================//
            //==========================================//

            models[Common.Model.Default] = new Model
            {
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("unitcylinder.x"),
                Texture = content.Get<Texture>("ground.jpg"),
                World = Matrix.Scaling(0.25f, 0.25f, 0.25f)
            };

            models[Common.Model.SkyBox] = new Model
            {
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("skybox1.x"),
                Texture = content.Get<Texture>("skybox1.png"),
                World = Matrix.Identity,
                IsBillboard = false
            };

            models[Common.Model.Tree] = new Model
            {
                //Effect = content.Get<SlimDX.Direct3D9.Effect>("ground.fx"),
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("spruce1.x"),
                Texture = content.Get<Texture>("spruce1.png"),
                //Lowering scale a bit while development still going on.
                World = Matrix.RotationY((float)Math.PI) * Matrix.RotationX((float)Math.PI / 2) * Matrix.Scaling(0.25f, 0.25f, 0.25f),
                IsBillboard = false
            };

            models[Common.Model.Stone] = new Model
            {
                //Effect = content.Get<SlimDX.Direct3D9.Effect>("ground.fx"),
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("stone1.x"),
                Texture = content.Get<Texture>("stone1.png"),
                World = Matrix.RotationY((float)Math.PI) * Matrix.RotationX((float)Math.PI / 2) * Matrix.Scaling(0.15f, 0.15f, 0.15f),
                IsBillboard = false
            };

            models[Common.Model.Stone2] = new Model
            {
                //Effect = content.Get<SlimDX.Direct3D9.Effect>("ground.fx"),
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("stone2.x"),
                Texture = content.Get<Texture>("stone1.png"),
                World = Matrix.RotationY((float)Math.PI) * Matrix.RotationX((float)Math.PI / 2) * Matrix.Scaling(0.10f, 0.10f, 0.10f),
                IsBillboard = false
            };

            models[Common.Model.Mushroom] = new Model
            {
                //Effect = content.Get<SlimDX.Direct3D9.Effect>("ground.fx"),
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("mushroom1.x"),
                Texture = content.Get<Texture>("mushroom1.png"),
                World = Matrix.RotationY((float)Math.PI) * Matrix.RotationX((float)Math.PI / 2) * Matrix.Scaling(0.20f, 0.20f, 0.20f),
                IsBillboard = false
            };

            models[Common.Model.Mushroom2] = new Model
            {
                //Effect = content.Get<SlimDX.Direct3D9.Effect>("ground.fx"),
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("mushroom2.x"),
                Texture = content.Get<Texture>("mushroom1.png"),
                World = Matrix.RotationY((float)Math.PI) * Matrix.RotationX((float)Math.PI / 2) * Matrix.Scaling(0.10f, 0.10f, 0.10f),
                IsBillboard = false
            };

            models[Common.Model.Mushroom3] = new Model
            {
                //Effect = content.Get<SlimDX.Direct3D9.Effect>("ground.fx"),
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("mushroom3.x"),
                Texture = content.Get<Texture>("mushroom1.png"),
                World = Matrix.RotationY((float)Math.PI) * Matrix.RotationX((float)Math.PI / 2) * Matrix.Scaling(0.10f, 0.10f, 0.10f),
                IsBillboard = false
            };

            models[Common.Model.Grass] = new Model
            {
                //Effect = content.Get<SlimDX.Direct3D9.Effect>("ground.fx"),
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("grass1.x"),
                Texture = content.Get<Texture>("grass1.png"),
                World = Matrix.RotationY((float)Math.PI) * Matrix.RotationX((float)Math.PI / 2) * Matrix.Scaling(0.10f, 0.10f, 0.10f),
                IsBillboard = false
            };
            models[Common.Model.Shrub1] = new Model
            {
                //Effect = content.Get<SlimDX.Direct3D9.Effect>("ground.fx"),
                XMesh = content.Get<SlimDX.Direct3D9.Mesh>("shrub1.x"),
                Texture = content.Get<Texture>("shrub1.png"),
                World = Matrix.RotationY((float)Math.PI) * Matrix.RotationX((float)Math.PI / 2) * Matrix.Scaling(0.10f, 0.10f, 0.10f),
                IsBillboard = false
            };

            //==========================================//
            //========== X-MESHES END ==================//
            //==========================================//

            //==========================================//
            //========== BILLBOARDS BEGIN ==============//
            //==========================================//

            models[Common.Model.Waypoint] = new Model
            {
                Mesh = billboard,
                Texture = content.Get<Texture>("ground.jpg"),
                IsBillboard = true
            };

            /*effects[Common.Effect.Fireball] = new Model
            {
                Mesh = billboard,
                Texture = content.Get<Texture>("fireball.tga"),
                //Texture = content.Get<Texture>("selectioncircle1.png"),
                World = Matrix.Translation(0, -1f, 0),
                Effect = content.Get<Effect>("billboard.fx"),
                HasAlpha = true,
                IsBillboard = true
            };*/

            effects[Common.Effect.Arrow] = new Model
            {
                Mesh = billboard,
                Texture = content.Get<Texture>("arrow.tga"),
                World = Matrix.Translation(0, -1f, 0),
                Effect = content.Get<Effect>("billboard.fx"),
                IsBillboard = true
            };

            effects[Common.Effect.SwordThrust] = new Model
            {
                Mesh = billboard,
                Texture = content.Get<Texture>("swordThrust.tga"),
                World = Matrix.Translation(0, -1f, 0),
                Effect = content.Get<Effect>("billboard.fx"),
                IsBillboard = true
            };

            //==========================================//
            //========== BILLBOARDS END ================//
            //==========================================//
        }
Пример #2
0
 public Font(Device device, ContentPool content, String fontFamiliy, FontStyle fontStyle, int characterWidth, Color color, Color backDrop)
 {
     System.Drawing.Font f = new System.Drawing.Font(fontFamiliy, characterWidth, fontStyle, GraphicsUnit.Pixel);
     if (backDrop != Color.Transparent) characterWidth++;
     Bitmap b = new Bitmap(100, 100);
     Graphics g = Graphics.FromImage(b);
     CharacterHeight = (int)Math.Ceiling(g.MeasureString(".", f).Height);
     TextureSize = (int)Math.Ceiling(Math.Sqrt(characterWidth * (int)CharacterHeight * 256));
     TextureSize = (int)Math.Pow(2, Math.Ceiling(Math.Log(TextureSize, 2)));
     b = new Bitmap(TextureSize, TextureSize);
     g = Graphics.FromImage(b);
     //g.Clear(Color.Orange);
     /*LinearGradientBrush lgb = new LinearGradientBrush(new Rectangle(0, 0, 256, 256), Color.White, Color.DarkRed, -45);
     g.FillRectangle(lgb, 0, 0, 256, 256);*/
     g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
     g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
     PointF p = PointF.Empty;
     CharacterUV = new PointF[256];
     CharacterWidth = new float[256];
     //StringFormat stringFormat = new StringFormat { Alignment = StringAlignment.Near, Trimming = StringTrimming.None, LineAlignment = StringAlignment.Near, FormatFlags = StringFormatFlags.FitBlackBox | StringFormatFlags.NoClip };
     Brush brush = new SolidBrush(color);
     Brush brushBackDrop = new SolidBrush(backDrop);
     for (char i = (char)0; i < 256; i++)
     {
         if (i == CaretChar)
         {
             if (backDrop != Color.Transparent)
             g.DrawLine(new Pen(brushBackDrop), p, new PointF(p.X + 1, p.Y + CharacterHeight + 1));
             g.DrawLine(new Pen(brush), p, new PointF(p.X, p.Y + CharacterHeight));
             CharacterWidth[i] = 1;
             if (backDrop != Color.Transparent) CharacterWidth[i]++;
         }
         else
         {
             String s2 = "";
             s2 += i;
             if(backDrop != Color.Transparent)
                 g.DrawString(s2, f, brushBackDrop, new PointF(p.X + 1, p.Y + 1), StringFormat.GenericTypographic);
             g.DrawString(s2, f, brush, p, StringFormat.GenericTypographic);
             SizeF si = g.MeasureString(s2, f, characterWidth, StringFormat.GenericTypographic);
             CharacterWidth[i] = si.Width;
             if (backDrop != Color.Transparent)
                 CharacterWidth[i]++;
         }
         CharacterUV[i] = p;
         CharacterUV[i].X /= ((float)TextureSize);
         CharacterUV[i].Y /= ((float)TextureSize);
         p.X += characterWidth;
         if (p.X > 256 - characterWidth)
         {
             p.X = 0;
             p.Y += CharacterHeight;
         }
     }
     // MeasureString has some problems with space so we use the width of the font's underscore instead
     CharacterWidth[' '] = g.MeasureString("_", f, characterWidth, StringFormat.GenericTypographic).Width;
     g.Flush();
     MemoryStream m = new MemoryStream();
     b.Save(m, System.Drawing.Imaging.ImageFormat.Png);
     Texture = Texture.FromMemory(device, m.ToArray());
     content.Register(fontFamiliy + this.GetHashCode(), this);
 }