Beispiel #1
0
 public TextBox(Texture2D sprite, Vector2 position, SpriteFont font, String text, float size)
 {
     decreaseAlpha = false;
     this.sprite   = sprite;
     textBoxExists = TextBoxExists.Opaque;
     this.position = position;
     this.font     = font;
     this.text     = text;
     this.size     = size;
     opacity       = 1.0f;
 }
Beispiel #2
0
 public void Update(GameTime gameTime)
 {
     if (decreaseAlpha == false && textBoxExists == TextBoxExists.Opaque)
     {
         AlphaTimeSubtract -= (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
         color              = Color.White * MathHelper.Clamp(AlphaTimeSubtract / AlphaTime, 0, 1);
         fontColor          = Color.Black * MathHelper.Clamp(AlphaTimeSubtract / AlphaTime, 0, 1);
         if (AlphaTimeSubtract <= 0)
         {
             textBoxExists = TextBoxExists.Transparent;
         }
     }
     else if (decreaseAlpha && textBoxExists == TextBoxExists.Transparent)
     {
         AlphaTimeSubtract += (float)(gameTime.ElapsedGameTime.TotalMilliseconds);
         color              = Color.White * MathHelper.Clamp(AlphaTimeSubtract / AlphaTime, 0, 1);
         fontColor          = Color.Black * MathHelper.Clamp(AlphaTimeSubtract / AlphaTime, 0, 1);
         if (AlphaTimeSubtract >= 1000)
         {
             textBoxExists = TextBoxExists.Opaque;
         }
     }
 }
Beispiel #3
0
 public void setTextBoxExists(TextBoxExists textBoxExists)
 {
     this.textBoxExists = textBoxExists;
 }