public override void Draw(SpriteBatchProxy spritebatch) { base.Draw(spritebatch); if (_question > 0) { spritebatch.Draw(Application.MagicContentManager.GetTexture("ship"), new Rectangle((int)Location.X+ 68, (int)Location.Y + 111, 64, 64), new Rectangle(0, 192, 64, 64), Color.White); } }
public void Draw(SpriteBatchProxy spriteBatch) { Rectangle dst = new Rectangle((int)m_location.X - MARGIN, (int)m_location.Y - MARGIN, 16, 16); m_srcRect.X = m_srcRect.Y = 0; for (int j = 0; j <= Math.Floor((double)((m_size.Y + MARGIN * 2) / m_srcRect.Height)); j++) { for (int i = 0; i <= Math.Floor((double)((m_size.X + MARGIN * 2) / m_srcRect.Width)); i++) { spriteBatch.Draw(Application.MagicContentManager.GetTexture("textbox"), dst, m_srcRect, Color.White); dst.Offset(16, 0); if (i == 0) { // first so offset for srcRect m_srcRect.Offset(16, 0); } else if (i == Math.Floor((double)((m_size.X + MARGIN * 2) / m_srcRect.Width)) - 1) { //last m_srcRect.Offset(16, 0); } } dst.Offset(-16 * (int)(Math.Floor((double)((m_size.X + MARGIN * 2) / m_srcRect.Width)) + 1), 16); m_srcRect.X = 0; if (j == 0) { // first so offset for srcRect m_srcRect.Offset(0, 16); } else if (j == Math.Floor((double)((m_size.Y + MARGIN * 2) / m_srcRect.Height)) - 1) { //last m_srcRect.Offset(0, 16); } } m_srcRect.X = m_anim * 16; m_srcRect.Y = 48; dst.Offset((int)(m_size.X + MARGIN * 2) - (16 + (int)m_skip_size.X + 8), -((int)m_skip_size.Y + 8)); spriteBatch.Draw(Application.MagicContentManager.GetTexture("textbox"), dst, m_srcRect, Color.White); dst.Offset(16, 0); spriteBatch.DrawString(Application.MagicContentManager.Font, m_skip, dst.Location.ToVector2(), Color.Black); spriteBatch.DrawString(Application.MagicContentManager.Font, m_text, m_location, Color.Black); }
public override void Draw(SpriteBatchProxy spriteBatch) { ParticuleManager.Draw(true); spriteBatch.BeginNoCamera(); spriteBatch.Draw(Application.MagicContentManager.GetTexture("splash1"), new Rectangle(0, 0, Resolution.VirtualWidth, Resolution.VirtualHeight), Color.White); spriteBatch.Draw(Application.MagicContentManager.GetTexture("team"), _dst, _src, new Color(1, 1, 1, _currentAlpha)); spriteBatch.End(); ParticuleManager.Draw(false); }
public void Draw(SpriteBatchProxy spriteBatch) { spriteBatch.BeginNoCamera(); // Draw compass spriteBatch.Draw(Application.MagicContentManager.GetTexture("compass"), dRect, sRect, Color.White); foreach (CompassElement element in _elements.Values) { element.Draw(spriteBatch); } spriteBatch.End(); }
/// <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); }
/// <summary> /// Draw the gris and its element /// </summary> /// <param name="spriteBatch"></param> public void Draw(SpriteBatchProxy spriteBatch) { foreach (Vector2 loc in _grid.Keys) { Tile tile = _grid[loc]; if (Application.GameStateManager.CurrentGameState.SceneCamera.VisibilityRectangle.Intersects(tile.DestRect)) { if (String.IsNullOrEmpty(tile.Spritesheet)) { spriteBatch.Draw(Application.MagicContentManager.EmptyTexture, tile.DestRect, tile.SourceRect, Color.Black); } else { spriteBatch.Draw(Application.MagicContentManager.GetTexture(tile.Spritesheet), tile.DestRect, tile.SourceRect, Color.White); } } } }
public virtual void Draw(SpriteBatchProxy spriteBatch) { DstRect = new Rectangle((int)Location.X, (int)Location.Y, SrcRect.Width, SrcRect.Height); if (IsRevealed) { spriteBatch.Draw(Application.MagicContentManager.GetTexture("compass"), DstRect, SrcRect, Color.White); } }
public void Draw(SpriteBatchProxy spriteBatch) { Rectangle dst = new Rectangle((int)_location.X - MARGIN, (int)_location.Y - MARGIN, 16, 16); _srcRect.X = _srcRect.Y = 0; for (int j = 0; j <= Math.Floor((double)((_size.Y + MARGIN * 2) / _srcRect.Height)); j++) { for (int i = 0; i <= Math.Floor((double)((_size.X + MARGIN * 2) / _srcRect.Width)); i++) { spriteBatch.Draw(Application.MagicContentManager.GetTexture("textbox"), dst, _srcRect, Color.White); dst.Offset(16, 0); if (i == 0) { // first so offset for srcRect _srcRect.Offset(16, 0); } else if (i == Math.Floor((double)((_size.X + MARGIN * 2) / _srcRect.Width)) - 1) { //last _srcRect.Offset(16, 0); } } dst.Offset(-16 * (int)(Math.Floor((double)((_size.X + MARGIN * 2) / _srcRect.Width)) + 1), 16); _srcRect.X = 0; if (j == 0) { // first so offset for srcRect _srcRect.Offset(0, 16); } else if (j == Math.Floor((double)((_size.Y + MARGIN * 2) / _srcRect.Height)) - 1) { //last _srcRect.Offset(0, 16); } } _srcRect.X = _anim * 16; _srcRect.Y = 48; dst.Offset((int)(_size.X + MARGIN * 2) - (16 + (int)_skip_size.X + 8), -((int)_skip_size.Y + 8)); spriteBatch.Draw(Application.MagicContentManager.GetTexture("textbox"), dst, _srcRect, Color.White); dst.Offset(16, 0); spriteBatch.DrawString(Application.MagicContentManager.Font, _skip, dst.Location.ToVector2(), Color.Black); // Draw controls var devices = Application.InputManager.GetLinkedDevices(LogicalPlayerIndex.One).FindAll(d => d.IsConnected); int x = COLSIZE; for (int i = 0; i < devices.Count; i++) { var device = devices[i]; Vector2 loc = _location; // Display name string name = LocalizedStrings.GetString("Move"); spriteBatch.DrawString(Application.MagicContentManager.Font, name, loc, Color.White); ButtonPrinter.DrawThumbstickLeft(spriteBatch, device, loc + new Vector2(i == 1 ? x - (COLSIZE / 3) : x, i == 1 ? 40 : 0), Color.White); name = LocalizedStrings.GetString("Jump"); loc.Y += 40 * devices.Count; spriteBatch.DrawString(Application.MagicContentManager.Font, name, loc, Color.White); ButtonPrinter.Draw(spriteBatch, MappingButtons.A, device, loc + new Vector2(x, 0), Color.White); name = LocalizedStrings.GetString("Walk"); loc.Y += 40; spriteBatch.DrawString(Application.MagicContentManager.Font, name, loc, Color.White); ButtonPrinter.Draw(spriteBatch, MappingButtons.X, device, loc + new Vector2(x, 0), Color.White); name = LocalizedStrings.GetString("Action"); loc.Y += 40; spriteBatch.DrawString(Application.MagicContentManager.Font, name, loc, Color.White); ButtonPrinter.Draw(spriteBatch, MappingButtons.Y, device, loc + new Vector2(x, 0), Color.White); x += COLSIZE / 2; } }
/// <summary> /// Display sprite on screen /// </summary> /// <param name="spriteBatch"></param> public virtual void Draw(SpriteBatchProxy spriteBatch) { if (IsOnScreen()) { spriteBatch.Draw(Application.MagicContentManager.GetTexture(assetName), dRect, sRect, Color, (float)rotation, spriteOrigin, flip, 1.0f); if (Application.IsDebugMode) { if (hitbox != null) { hitbox.Draw(spriteBatch); } if (awarenessbox != null) { awarenessbox.Draw(spriteBatch); } } } }
/// <summary> /// Render the game state /// </summary> /// <param name="spriteBatch"></param> public abstract void Draw(SpriteBatchProxy spriteBatch);
/// <summary> /// Render the game state /// </summary> /// <param name="spriteBatch"></param> public override void Draw(SpriteBatchProxy spriteBatch) { }
public void DrawFade(SpriteBatchProxy spriteBatch) { spriteBatch.DrawRectangle(new Rectangle(0, 0, Resolution.VirtualWidth, Resolution.VirtualHeight), _fadingColor * _currentFadeInOut); }
public override void Draw(SpriteBatchProxy spriteBatch) { // Draw the skybox _skybox.Draw(spriteBatch); ParticuleManager.Draw(true); spriteBatch.Begin(SceneCamera); _level.Draw(spriteBatch); if (Application.IsDebugMode) { // World base axis spriteBatch.DrawRectangle(new Rectangle(-1, -1, 2, _level.Dimensions.Height), Color.Red); spriteBatch.DrawRectangle(new Rectangle(-1, -1, _level.Dimensions.Width, 2), Color.Green); Application.PhysicsManager.Draw(spriteBatch); } spriteBatch.End(); ParticuleManager.Draw(false); // Draw HUD and Compass out of the camera if (_isEnded == false) { _hud.Draw(spriteBatch); _compass.Draw(spriteBatch); } spriteBatch.BeginNoCamera(); spriteBatch.DrawRectangle(new Rectangle(0, 0, Resolution.VirtualWidth, Resolution.VirtualHeight), Color.Black * _alphaPause); if (_isPaused) { // Draw "PAUSE" Vector2 _pauseLoc = new Vector2(Resolution.VirtualWidth / 2 - Application.MagicContentManager.Font.MeasureString("PAUSE").X / 2, 300); spriteBatch.DrawString(Application.MagicContentManager.Font, "PAUSE", _pauseLoc, Color.White * _alphaPause); // Draw controls var devices = Application.InputManager.GetLinkedDevices(LogicalPlayerIndex.One).FindAll(d => d.IsConnected); Vector2 buttonLoc = new Vector2((int)_pauseLoc.X - 150, _pauseLoc.Y + 60); for (int i = 0; i < devices.Count; i++) { ButtonPrinter.Draw(spriteBatch, MappingButtons.Start, devices[i], buttonLoc, Color.White * _alphaPause); buttonLoc.X += 50; } Vector2 textLoc = buttonLoc + new Vector2(100,0); spriteBatch.DrawString(Application.MagicContentManager.Font, LocalizedStrings.GetString("BackToGame"), textLoc, Color.White * _alphaPause); buttonLoc = new Vector2((int)_pauseLoc.X - 150, _pauseLoc.Y + 100); for (int i = 0; i < devices.Count; i++) { ButtonPrinter.Draw(spriteBatch, MappingButtons.Back, devices[i], buttonLoc, Color.White * _alphaPause); buttonLoc.X += 50; } textLoc = buttonLoc + new Vector2(100, 0); spriteBatch.DrawString(Application.MagicContentManager.Font, LocalizedStrings.GetString("BackToHome"), textLoc, Color.White * _alphaPause); } spriteBatch.End(); }
public override void Draw(SpriteBatchProxy spriteBatch) { ParticuleManager.Draw(true); spriteBatch.BeginNoCamera(); spriteBatch.Draw(Application.MagicContentManager.GetTexture("homebg"), _dstBg, _srcBg, _bgColor); spriteBatch.End(); //----------------------------------------------------------------------------------------------- spriteBatch.Begin(SceneCamera); if (!_isInitialized) { spriteBatch.Draw(Application.MagicContentManager.GetTexture("star"), _dstStar, _srcStar, Color.White); } spriteBatch.Draw(Application.MagicContentManager.GetTexture("title"), _dstTitle, _srcTitle, Color.White, TitltForTitle, Vector2.Zero, SpriteEffects.None, 1); foreach (Entity e in _asteroidLayer.Entities) { e.Draw(spriteBatch); } spriteBatch.End(); //----------------------------------------------------------------------------------------------- ParticuleManager.Draw(false); spriteBatch.Begin(SceneCamera); spriteBatch.Draw(Application.MagicContentManager.GetTexture("fore"), _dstFore, _srcFore, _generalColor); if (_textDisplayed && !_isInitialized) { spriteBatch.DrawString(Application.MagicContentManager.Font, _startStr, _startLoc, Color.White); } if (_isMenuDisplayed) { drawMenu(spriteBatch); } //----------------------------------------------------------------------------------------------- spriteBatch.End(); }
public override void Draw(SpriteBatchProxy spriteBatch) { // Do not draw spawn }
public override void Draw(SpriteBatchProxy spriteBatch) { ParticuleManager.Draw(true); spriteBatch.BeginNoCamera(); //----------------------------- // Bakcground spriteBatch.Draw(Application.MagicContentManager.GetTexture((_lose) ? "end_sad" : "end_happy"), new Rectangle(0, 0, Resolution.VirtualWidth, Resolution.VirtualHeight), Color.White); // Title spriteBatch.DrawString(Application.MagicContentManager.Font, _gameoverStr, _gameoverLoc, Color.White); Color color = Color.White; if (_lastItem >= 1) { string sEnd; if (_lose) { color = Color.Red; sEnd = LocalizedStrings.GetString("Defeat"); } else { color = Color.Green; sEnd = LocalizedStrings.GetString("Victory"); } if (_lastItem == 0) color *= _currentAlpha; var loc = new Vector2( Resolution.VirtualWidth / 2 - Application.MagicContentManager.Font.MeasureString(sEnd).X / 2, 100 ); spriteBatch.DrawString(Application.MagicContentManager.Font, sEnd, loc, color); } color = Color.White; int x = 200; int colSize = 300; int lineSize = 30; int y = 160; if (_lastItem >= 2) { if (_lastItem == 1) color *= _currentAlpha; var livesLoc = new Vector2(x + colSize, y); // Stats spriteBatch.DrawString(Application.MagicContentManager.Font, "Remaining lives: ", new Vector2(x, y), color); for (int i = 0; i < _lives; i++) { spriteBatch.Draw(Application.MagicContentManager.GetTexture("hud"), livesLoc, new Rectangle(0, 0, 32, 32), Color.White); livesLoc.X += 32; } } y += lineSize; if (_lastItem >= 3) { if (_lastItem == 1) color *= _currentAlpha; string sCarot = _carrotes.ToString("0000000"); spriteBatch.DrawString(Application.MagicContentManager.Font, "Carrottes: ", new Vector2(x, y), color); spriteBatch.DrawString(Application.MagicContentManager.Font, _carrotes.ToString("0000000"), new Vector2(x + colSize, y), color); Vector2 carotLoc = new Vector2(x + Application.MagicContentManager.Font.MeasureString(sCarot).X + colSize + 16, y - 4); spriteBatch.Draw(Application.MagicContentManager.GetTexture("hud"), carotLoc, new Rectangle(64, 0, 32, 32), Color.White); } y += lineSize; if (_lastItem >= 4) { if (_lastItem == 1) color *= _currentAlpha; spriteBatch.DrawString(Application.MagicContentManager.Font, "Time left: ", new Vector2(x, y), color); spriteBatch.DrawString(Application.MagicContentManager.Font, _timeLeft.Minutes.ToString("00") + ":" + _timeLeft.Seconds.ToString("00"), new Vector2(x + colSize, y), color); } y += lineSize; if (_lastItem >= 5) { if (_lastItem == 1) color *= _currentAlpha; spriteBatch.DrawString(Application.MagicContentManager.Font, "Keys: ", new Vector2(x, y), color); if (_hasKeys) { spriteBatch.Draw(Application.MagicContentManager.GetTexture("keys"), new Vector2(x + colSize, y) + new Vector2(0, -8), new Rectangle(0, 0, 32, 32), Color.White); } } y += lineSize; if (_lastItem >= 6) { if (_lastItem == 1) color *= _currentAlpha; spriteBatch.DrawString(Application.MagicContentManager.Font, "Letters: " + _letters.Count + "/" + OLetterSpawn.LetterCount, new Vector2(x, y), color); int letterScore = 2000 * _letters.Count + (_letters.Count == OLetterSpawn.LetterCount ? 10000 : 0); spriteBatch.DrawString(Application.MagicContentManager.Font, letterScore.ToString("000000000"), new Vector2(x + colSize, y), color); } y += lineSize * 2; if (_lastItem >= 7) { color = Color.Yellow; if (_lastItem == 1) color *= _currentAlpha; spriteBatch.DrawString(Application.MagicContentManager.Font, "Score: ", new Vector2(x, y), color); spriteBatch.DrawString(Application.MagicContentManager.Font, _score.ToString("000000000"), new Vector2(x + colSize, y), color); } //----------------------------- // Draw highscores button if (_lastItem >= ScoreLines) { spriteBatch.Draw(Application.MagicContentManager.GetTexture("menu"), _dstMenu, _srcMenu, Color.White, 0f, Vector2.Zero, Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally, 1.0f); spriteBatch.Draw(Application.MagicContentManager.GetTexture("hud"), _dstMenu.Location.ToVector2() + new Vector2(20, 16), new Rectangle(64, 0, 32, 32), Color.White); spriteBatch.DrawString(Application.MagicContentManager.Font, LocalizedStrings.GetString("Highscores"), _dstMenu.Location.ToVector2() + new Vector2(60, 20), Color.Yellow ); } spriteBatch.End(); ParticuleManager.Draw(false); }
public void Draw(SpriteBatchProxy spriteBatch) { spriteBatch.BeginNoCamera(); spriteBatch.Draw(Application.MagicContentManager.GetTexture("skybox"), new Rectangle(0, 0, Resolution.VirtualWidth, Resolution.VirtualHeight), _color); spriteBatch.End(); }
private void drawMenu(SpriteBatchProxy spriteBatch) { int tmp = _dstMenu.Bottom; for (int i = 0; i < MenuValuesSize; i++) { spriteBatch.Draw(Application.MagicContentManager.GetTexture("menu"), _dstMenu, _srcMenu, Color.White); Color color = Color.White; // Draw a carott if (i == (int)_menuCurrent) { color = Color.Yellow; spriteBatch.Draw(Application.MagicContentManager.GetTexture("hud"), _dstMenu.Location.ToVector2() + new Vector2(20, 16), new Rectangle(64, 0, 32, 32), Color.White); } spriteBatch.DrawString(Application.MagicContentManager.Font, LocalizedStrings.GetString(((MenuValues)i).ToString()), _dstMenu.Location.ToVector2() + new Vector2(60, 20), color ); _dstMenu.Offset(0, _dstMenu.Height + 20); } _dstMenu.Offset(0, -(_dstMenu.Bottom - tmp)); }