Exemplo n.º 1
0
 public override void DrawLabels(SpriteBatch spriteBatch)
 {
     if (IsReady)
     {
         base.DrawLabels(spriteBatch);
     }
     else
     {
         spriteBatch.DrawString(Textures.GetFont("Medium"), "Downloading " + this.Name, (this.Position + new Vector2(28f, 148f)) + Level.Offset, Color.Yellow, 0f, Vector2.Zero, 0.7f, 0, 0.9f);
     }
 }
Exemplo n.º 2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.DrawString(Textures.GetFont("Medium"), "GPU = " + _totalFrameList[SecondsTicked].ToString(), new Vector2(20, 50), this.colour, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
            CurrentFrames++;

            spriteBatch.DrawString(Textures.GetFont("Medium"), "CPU = " + CurrentFPS.ToString(), new Vector2(20, 90), this.colour, 0, Vector2.Zero, 1, SpriteEffects.None, 1);


            if (AvgFPS != -1)
            {
                spriteBatch.DrawString(Textures.GetFont("Medium"), "Average:" + AvgFPS, new Vector2(120, 50), this.colour, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
            }
        }
Exemplo n.º 3
0
        public virtual void DrawLabels(SpriteBatch spriteBatch)
        {
            spriteBatch.DrawString(Textures.GetFont("Medium"), _level.ToString(), (this.Position + new Vector2(22f, 18f)) + Level.Offset, Color.Black, 0f, Vector2.Zero, 1f, 0, 0.9f);

            if (this.Status == "Locked")
            {
                spriteBatch.DrawString(Textures.GetFont("Medium"), "Locked", (this.Position + new Vector2(28f, 148f)) + Level.Offset, Color.LightGray, 0f, Vector2.Zero, 1f, 0, 0.9f);
            }
            else if (this.CoastersCollected != -1)
            {
                spriteBatch.DrawString(Textures.GetFont("Medium"), "Coasters: " + this.CoastersCollected.ToString() + "/3", (this.Position + new Vector2(28f, 148f)) + Level.Offset, Color.Wheat, 0f, Vector2.Zero, 1f, 0, 0.9f);
            }
        }
Exemplo n.º 4
0
        public MessageBox(string text, Vector2 StartLocation, int lifetime)
        {
            text = text + " ";

            startLocation = StartLocation;
            this.LifeTime = lifetime;
            this.Row      = "";
            int h = 0;
            int k = 0;

            text = CheckForSpSymbols(text);
            while (h != text.Length)
            {
                for (int i = 50; i > 0; i--)
                {
                    if (text.Length < (i + h))
                    {
                        i = text.Length - h;
                    }
                    if (Textures.GetFont("Medium").MeasureString(text.Substring(h, i)).X < 800f)
                    {
                        string   tx    = text.Substring(h, i);
                        string[] split = tx.Split(new char[] { ' ' });
                        if (split[split.Length - 1].Length != 0)
                        {
                            if (text.Length < (split[split.Length - 1].Length + h))
                            {
                                i = text.Length - h;
                            }
                            else
                            {
                                if (i != split[split.Length - 1].Length)
                                {
                                    i -= split[split.Length - 1].Length;
                                }
                                tx = text.Substring(h, i);
                            }
                        }
                        this.Row = this.Row + "\n" + tx;
                        if (k > 2)
                        {
                            //used to be k = k.  /Eoin
                            k = h;
                        }
                        h += i;
                        break;
                    }
                }
                k++;
            }
        }
Exemplo n.º 5
0
 public PopupBox(string[] message, PopupType type)
 {
     this.MessageList = new TextSprite[message.Length];
     //this.MessageList[0] = new TextSprite(message[0], "Small", new Vector2(300f, 110f), Color.Red);
     for (int i = 0; i < message.Length; i++)
     {
         float PositionX = (Textures.GetTexture("Pause_Menu").Width - Textures.GetFont("Medium").MeasureString(message[i]).X) / 2f + 200;
         this.MessageList[i] = new TextSprite(message[i], "Medium", new Vector2(PositionX, (float)(140 + (30 * i))), Color.Red);
     }
     this.ButtonList = new List <Button>();
     this.ButtonList.Add(new Button(new TextSprite("Yes", "Small", new Vector2(200f, 250f), Color.Red), new Vector2(263f, 255f), 4, 0.9998f));
     this.ButtonList.Add(new Button(new TextSprite("No", "Small", new Vector2(445f, 250f), Color.Red), new Vector2(415f, 255f), 4, 0.9998f));
     this.type = type;
 }
Exemplo n.º 6
0
        private string splitTextAcrossLines(string text)
        {
            float  MaxNameWidth = 160f;
            string newText      = "";

            string[] tokens      = text.Split(' ');
            string   currentLine = "";

            for (int t = 0; t < tokens.Length; t++)
            {
                if (currentLine.Length == 0)
                {
                    currentLine += tokens[t];
                }
                else if (Textures.GetFont("Small").MeasureString(currentLine + ' ' + tokens[t]).X < MaxNameWidth)
                {
                    currentLine += ' ' + tokens[t];
                }
                else
                {
                    string overflow = "";
                    while (Textures.GetFont("Small").MeasureString(currentLine).X > MaxNameWidth)
                    {
                        overflow   += currentLine[currentLine.Length - 1];
                        currentLine = currentLine.Substring(0, currentLine.Length - 1);
                    }

                    newText    += currentLine + '\n';
                    currentLine = overflow;
                    t--;                     // Repeat for this token as we haven't used it yet
                }
            }
            if (currentLine.Trim().Length == 0)
            {
                newText.Substring(0, newText.Length - 1);                 // Remove trailing newline character
            }
            else
            {
                if (Textures.GetFont("Small").MeasureString(currentLine).X > MaxNameWidth)
                {
                    newText += splitBigWord(currentLine, MaxNameWidth);
                }
                else
                {
                    newText += currentLine;
                }
            }
            return(newText);
        }
Exemplo n.º 7
0
        public void Draw(SpriteBatch spriteBatch, bool isStatus = false)
        {
            Color colour           = new Color(isStatus ? 0.9f: 0.75f, isStatus? 0.6f : 0.1f, isStatus ? 0.9f : 0.75f, 1);
            float alpha            = 0.035f * this.LifeTime;
            float brightness       = alpha > 0.4f ? 0.2f : 0;
            Color backgroundColour = new Color(brightness, brightness, 0.5f + brightness, alpha > 0.4f ? alpha : 0f);

            if (LifeTime < 61)
            {
                colour = new Color(this.LifeTime / 80f, this.LifeTime / 100f, this.LifeTime / 80f, 0.035f * this.LifeTime);
            }

            if (isStatus)
            {
                spriteBatch.Draw(Textures.GetTexture("StatusBackground"), startLocation + new Vector2(-10, 17), null, backgroundColour, 0, Vector2.Zero, 1f, SpriteEffects.None, 0.9999f);
            }
            spriteBatch.DrawString(Textures.GetFont("Medium"), this.Row, startLocation, colour, 0f, Vector2.Zero, 1f, 0, 1f);
        }
Exemplo n.º 8
0
 public static void Draw(SpriteBatch spriteBatch)
 {
     if (BlinkCooldown < 0)
     {
         try
         {
             spriteBatch.DrawString(Textures.GetFont("Tiny"), CurrentText.Substring(0, CurrentText.Length - 1), new Vector2(30, 560), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.9f);
         }
         catch
         {
         }
     }
     else
     {
         try
         {
             spriteBatch.DrawString(Textures.GetFont("Tiny"), CurrentText, new Vector2(30, 560), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.9f);
         }
         catch
         {
         }
     }
 }
Exemplo n.º 9
0
        private string splitBigWord(string word, float MaxNameWidth)
        {
            string newText     = "";
            string currentLine = "";

            while (word.Length != 0)
            {
                if (newText.Length > 0)
                {
                    newText += '\n';
                }
                while (word.Length > 0 &&
                       Textures.GetFont("Small").MeasureString(currentLine + word[word.Length - 1]).X < MaxNameWidth)
                {
                    currentLine += word[word.Length - 1];
                    word         = word.Substring(0, word.Length - 1);
                }
                newText    += currentLine;
                currentLine = "";
            }

            return(newText);
        }
Exemplo n.º 10
0
 private static void Load_Labels()
 {
     Label = new TextSprite("Game Paused", "Large", new Vector2((800 - Textures.GetFont("Large").MeasureString("Game Paused").X) / 2f, 100), Color.White);
 }
Exemplo n.º 11
0
 public override void DrawLabels(SpriteBatch spriteBatch)
 {
     spriteBatch.DrawString(Textures.GetFont("Medium"), "New Map", (this.Position + new Vector2(28f, 148f)) + Level.Offset, Color.Yellow, 0f, Vector2.Zero, 1f, 0, 0.9f);
 }
Exemplo n.º 12
0
 public override void DrawLabels(SpriteBatch spriteBatch)
 {
     spriteBatch.DrawString(Textures.GetFont("Small"), this.LabelText, (this.Position + new Vector2(22f, 140f)) + Level.Offset, Color.White, 0f, Vector2.Zero, 1f, 0, 0.9f);
 }