Exemplo n.º 1
0
        private TextElement(SpriteFont font)
        {
            if (this.text == null)
            {
                this.text = new TextValue();
            }

            Texture2D texture = null;

            if (font != null)
            {
                this.font       = font;
                this.spriteFont = font;
                texture         = this.font.textureValue;
            }

            sprite = new SpriteElement(texture);
            sprite.VerticalAlignment = VerticalAlignment.Top;
            this.VerticalAlignment   = VerticalAlignment.Top;

            children = new TextChildren(sprite);
            SetParentToThis(sprite);

            sprite.AlphaBlendState = AlphaBlendState.Alpha;
        }
Exemplo n.º 2
0
        private TextElementRect(Vector2 sizeInPixels, SpriteFont font)
            : base(sizeInPixels)
        {
            if (font != null)
            {
                this.font = font;
            }

            this.spriteFont = font;

            sprite = new SpriteElement(font == null ? null : this.font.textureValue);
            sprite.VerticalAlignment = VerticalAlignment.Top;
            this.VerticalAlignment   = VerticalAlignment.Top;

            Add(sprite);

            this.children = new TextChildren(this.Children);

            sprite.AlphaBlendState = AlphaBlendState.Alpha;
        }
Exemplo n.º 3
0
		//this will be called once this game state is up and running.
		public void Initalise(IGameStateManager stateManager)
		{
			this.stateManager = stateManager;

			//create the sprites, which will bounce around the screen

			//sprite drawer
			this.spriteElement = new SpriteElement();

			//the sprite positions / velocities
			for (int i = 0; i < SpriteCount; i++)
			{
				this.spritePosition[i] = new Vector2((float)rand.NextDouble() * stateManager.Application.WindowWidth * 0.25f, (float)rand.NextDouble() * stateManager.Application.WindowHeight * 0.25f);
				this.spriteVelocity[i] = new Vector2((float)rand.NextDouble() * 2000 - 1000, (float)rand.NextDouble() * 2000 - 1000);

				//add a sprite for each to the sprite drawer
				this.spriteElement.AddSprite(spritePosition[i], new Vector2(1.5f, 1.5f));
			}
		}
Exemplo n.º 4
0
 public TextChildren(SpriteElement rootSprite)
 {
     this.children = new List <Element>(1);
     this.children.Add(rootSprite);
 }