コード例 #1
0
        public TextEntityView(IEntity entity, IFontScaler fontScaler, SpriteBatch spriteBatch, FontBank fontBank)
            : base(entity)
        {
            _fontScaler  = fontScaler ?? throw new ArgumentNullException();
            _spriteBatch = spriteBatch ?? throw new ArgumentNullException();
            _fontBank    = fontBank ?? throw new ArgumentNullException();

            _textEntity = this.GetEntityAs <ITextEntity>();
            _font       = _fontBank.GetFont(_textEntity.FontName, _textEntity.FontSize);

            _cachedFont = _font;
        }
コード例 #2
0
        private static ITextEntity ByCoordinateSystemCore(CoordinateSystem contextCoordinateSystem, Orientation orientation, string textString, double fontSize)
        {
            if (fontSize < 0.0001)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, fontSize, "Text fontSize"), "fontSize");
            }
            if (null == contextCoordinateSystem)
            {
                throw new System.ArgumentNullException("contextCoordinateSystem");
            }

            AssertUniScaledOrtho(contextCoordinateSystem.CSEntity);

            ITextEntity entity = HostFactory.Factory.TextByCoordinateSystem(contextCoordinateSystem.CSEntity, (int)orientation, textString, fontSize);

            if (null == entity)
            {
                throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "Text.ByCoordinateSystem"));
            }
            return(entity);
        }
コード例 #3
0
 protected TextEntityControllerBase(ITextEntity textEntity, IGameManager gameManager)
 {
     Model = textEntity;
     _gameManager = gameManager;
 }
コード例 #4
0
ファイル: TextEntityView.cs プロジェクト: swallentin/XNA.Pong
 public TextEntityView(IController controller, ITextEntity model)
 {
     Controller = controller;
     Model = model;
 }
コード例 #5
0
 /// <summary>
 /// Draws the specified text entity.
 /// </summary>
 /// <param name="textEntity">The text entity.</param>
 public void Draw(ITextEntity textEntity)
 {
     SpriteBatch.DrawString(textEntity.Font, textEntity.Text, textEntity.Position, textEntity.Color, textEntity.Rotation, Vector2.Zero, textEntity.Scale, textEntity.Effects, 1);
 }
コード例 #6
0
 private Text(ITextEntity entity, bool persist)
     : base(entity, persist)
 {
     InitializeGuaranteedProperties();
 }
コード例 #7
0
ファイル: Text.cs プロジェクト: samuto/designscript
 private Text(ITextEntity entity, bool persist)
     : base(entity, persist)
 {
     InitializeGuaranteedProperties();
 }