本文整理汇总了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;
}
示例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;
}
示例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);
}