private void PlaceVectors(NumberVector start) { //float angleSpan = 137.507f; float angleSpan = 360 / 72.0f; for (int i = 2; i <= 72; i++) { var vector = NumberVector.CreateForNumber(i); var distance = (vector - start).GetLength(); var position = new Vector2DF(1, 1); position.Degree = angleSpan * i; position.Length = distance * DistanceUnit; position += new Vector2DF(320, 320); var obj = new TextObject2D() { Text = i.ToString(), Font = font, Position = position, Color = vector.IsPrime() ? Helper.AccentColor1 : Helper.PlaneColor, DrawingPriority = 2, }; var size = font.CalcTextureSize(i.ToString(), WritingDirection.Horizontal); obj.CenterPosition = size.To2DF() / 2; layer.AddObject(obj); } }
/// <summary> /// 中心座標を設定する /// </summary> private void SetCenterPosition() { WritingDirection direction = WritingDirection.Horizontal; Vector2DF size = Font.CalcTextureSize(Text, direction).To2DF(); CenterPosition = size * CenteringPosition; }
public GeneralText(asd.Vector2DF pos, String text, int large, asd.Color mainColor, int aroundLarge, asd.Color aroundColor) { Font = asd.Engine.Graphics.CreateDynamicFont("Font.ttf", large, mainColor, aroundLarge, aroundColor); Position = pos; Text = text; var size = Font.CalcTextureSize(Text, asd.WritingDirection.Horizontal); CenterPosition = size.To2DF() / 2; }