当前位置: 首页>>代码示例>>C#>>正文


C# AssetManager.GetFont方法代码示例

本文整理汇总了C#中AssetManager.GetFont方法的典型用法代码示例。如果您正苦于以下问题:C# AssetManager.GetFont方法的具体用法?C# AssetManager.GetFont怎么用?C# AssetManager.GetFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AssetManager的用法示例。


在下文中一共展示了AssetManager.GetFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Canvas

 /// <summary>
 /// Constructs a new Canvas object.
 /// </summary>
 /// <param name="assetManager">The AssetManager object used to import assets.</param>
 /// <param name="graphicsDevice">The GraphicsDevice object associated with the game.</param>
 /// <param name="spriteBatch">The SpriteBatch object used for drawing.</param>
 public Canvas(AssetManager assetManager, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
 {
     this.graphicsDevice = graphicsDevice;
     this.spriteBatch = spriteBatch;
     // initialize our tiny square. This square is used for drawing primitives.
     square1x1 = new Texture2D(graphicsDevice, 1, 1, false, SurfaceFormat.Color);
     Color[] data = new Color[1];
     data[0] = Color.White;
     square1x1.SetData<Color>(data);
     transformationStack = new List<CoordinateTransform>(4);
     spriteFont = assetManager.GetFont("default");
     displayDebugInformation = false;
 }
开发者ID:kjin,项目名称:Ribbons,代码行数:19,代码来源:Canvas.cs

示例2: IntegrateChild

 protected override bool IntegrateChild(AssetManager assets, LayoutTreeNode childNode)
 {
     bool orderError = false;
     switch (childNode.Key)
     {
         case "Font":
             font = assets.GetFont(childNode.Value);
             if (text != null)
                 sprite = new TextSprite(font, text);
             return true;
         case "Text":
             text = childNode.Value;
             if (font != null)
                 sprite = new TextSprite(font, text);
             return true;
         case "Position":
             if (sprite != null)
             {
                 sprite.Position = ExtendedConvert.ToVector2(childNode.Value);
                 return true;
             }
             else
                 orderError = true;
             break;
         case "Rotation":
             if (sprite != null)
             {
                 sprite.Rotation = Convert.ToSingle(childNode.Value);
                 return true;
             }
             else
                 orderError = true;
             break;
         case "Scale":
             if (sprite != null)
             {
                 sprite.Scale = ExtendedConvert.ToVector2(childNode.Value);
                 return true;
             }
             else
                 orderError = true;
             break;
         case "Color":
             if (sprite != null)
             {
                 sprite.Color = ExtendedConvert.ToColor(childNode.Value);
                 return true;
             }
             else
                 orderError = true;
             break;
         case "Anchor":
             if (sprite != null)
             {
                 sprite.Anchor = ExtendedConvert.ToEnum<Anchor>(childNode.Value);
                 return true;
             }
             else
                 orderError = true;
             break;
     }
     if (orderError)
     {
     #if DEBUG
         Console.WriteLine("ContextElement WARNING: Tried to set {0}'s {1} field before the Text and Font were specified.", LayoutName, childNode.Key);
     #endif
         return true;
     }
     return false;
 }
开发者ID:kjin,项目名称:Ribbons,代码行数:70,代码来源:ContextElement.cs

示例3: Initialize

 public override void Initialize(AssetManager assets, string themeName)
 {
     TextDictionary assetDictionary = new TextDictionary(assets.GetText("option"));
     fontFace = assets.GetFont(assetDictionary.LookupString(themeName, "fontFace"));
     try { fontColor = new Color(assetDictionary.LookupVector4(themeName, "fontColor")); }
     catch { fontColor = new Color(assetDictionary.LookupVector3(themeName, "fontColor")); }
     dimensions = fontFace.MeasureString(text) + new Vector2(0, -5);
 }
开发者ID:kjin,项目名称:TubeRacer,代码行数:8,代码来源:Option.cs


注:本文中的AssetManager.GetFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。