/// <summary> /// Affichage du nombre de FPS à l'écran et calcul du nombre d'affichages /// </summary> /// <param name="spriteBatch"></param> /// <param name="location"></param> public void Draw(SpriteBatchProxy spriteBatch, Vector2 location) { // On compte un affichage supplémentaire _totalFrames++; Color color = Color.Green; #if !WINDOWS_PHONE if (_fps < 40) color = Color.Coral; #endif if (_fps < 25) color = Color.Red; spriteBatch.DrawString(Application.MagicContentManager.Font, string.Format("FPS={0}", _fps), location, color); }
public void Draw(SpriteBatchProxy spritebatch) { if (currentState == STATE.INACTIVE) return; Rectangle rect = _dstRect; rect.Width = POSITIONS[currentIdx]; spritebatch.Draw(nullTex, rect, Color.Green); rect.Offset(POSITIONS[currentIdx], 0); rect.Width = _dstRect.Width - POSITIONS[currentIdx]; spritebatch.Draw(nullTex, rect, color); spritebatch.Draw(barcodeTex, _dstRect, Color.White); //render number Vector2 v = new Vector2(80, 248); v += position; for (int i = 0; i < BARCODE_LENGTH; i++) { spritebatch.DrawString(font, barcodeDigits[i].ToString(), v, (i < currentIdx) ? Color.Green : color); v.X += 30; if (i == 4) v.X += 25; } if (currentState == STATE.GOOD_ANIM) { v.Y += 50; v.X = _dstRect.X + (_dstRect.Width - font.MeasureString(RANK_TEXT[rank]).X) / 2; spritebatch.DrawString(font, RANK_TEXT[rank], v, Color.Pink); } }
public void Draw(SpriteBatchProxy spriteBatch) { if (_alpha > 0) { spriteBatch.BeginNoCamera(); string str = _currentSong.Artist + " - " + _currentSong.Name; Vector2 size = Application.MagicContentManager.Font.MeasureString(str); Vector2 loc = new Vector2(Resolution.VirtualWidth - size.X - 10, 50); var dstMenu = new Rectangle((int)(loc.X - 20), (int)loc.Y - 2 * (int)size.Y / 4, (int)size.X * 3 / 2, (int)size.Y * 2); var srcMenu = new Rectangle(0, 0, 127, 32); spriteBatch.Draw(Application.MagicContentManager.GetTexture("menu"), dstMenu, srcMenu, Color.White * _alpha, 0f, Vector2.Zero, Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally, 1.0f); spriteBatch.DrawString(Application.MagicContentManager.Font, str, loc, Color.White * _alpha); spriteBatch.End(); } }