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;
        }
Beispiel #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);
        }
 protected TextEntityControllerBase(ITextEntity textEntity, IGameManager gameManager)
 {
     Model = textEntity;
     _gameManager = gameManager;
 }
Beispiel #4
0
 public TextEntityView(IController controller, ITextEntity model)
 {
     Controller = controller;
     Model = model;
 }
 /// <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);
 }
Beispiel #6
0
 private Text(ITextEntity entity, bool persist)
     : base(entity, persist)
 {
     InitializeGuaranteedProperties();
 }
Beispiel #7
0
 private Text(ITextEntity entity, bool persist)
     : base(entity, persist)
 {
     InitializeGuaranteedProperties();
 }