protected override void Draw(GameTime gameTime) { _fpsCounter.Draw(gameTime); var fps = $"FPS: {_fpsCounter.FramesPerSecond}"; GraphicsDevice.Clear(Color.Black); _spriteBatch.Begin(); _ecs.Draw(gameTime); _spriteBatch.DrawString(_font, fps, new Vector2(16, 16), Color.White); #if DEBUG var entityCount = $"Active Entities Count: {_entityManager.ActiveEntitiesCount}"; //var removedEntityCount = $"Removed Entities TotalCount: {_ecs.TotalEntitiesRemovedCount}"; var totalEntityCount = $"Allocated Entities Count: {_entityManager.TotalEntitiesCount}"; _spriteBatch.DrawString(_font, entityCount, new Vector2(16, 62), Color.White); _spriteBatch.DrawString(_font, totalEntityCount, new Vector2(16, 92), Color.White); //_spriteBatch.DrawString(_font, removedEntityCount, new Vector2(32, 122), Color.Yellow); #endif _spriteBatch.End(); }
public override void Draw(GameTime gameTime) { // TODO: Add your drawing code here GraphicsDevice.BlendState = BlendState.AlphaBlend; GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; GraphicsDevice.RasterizerState = RasterizerState.CullNone; var viewMatrix = _camera.GetViewMatrix(); var projectionMatrix = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0f, -1f); _mapRenderer.Draw(_map, ref viewMatrix, ref projectionMatrix); DrawText(); _fpsCounter.Draw(gameTime); _player.Draw(GameRef.SpriteBatch, _camera); foreach (var p in _players) { p.Draw(GameRef.SpriteBatch, _camera); } base.Draw(gameTime); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); Viewport viewport = GraphicsDevice.Viewport; base.Draw(gameTime); // Only draw if we are Debugging #if DEBUG fps.Draw(gameTime); string fpsText = "FPS: " + fps.FramesPerSecond; float fpsTextWidth = bitmapFont.MeasureString(fpsText).Width; spriteBatch.Begin(); spriteBatch.DrawString(bitmapFont, fpsText, new Vector2(viewport.Width - fpsTextWidth, 0), Color.White); spriteBatch.End(); #endif if (MusicPlayer.GotBeat()) { spriteBatch.Begin(); spriteBatch.Draw(circle32, new Rectangle((int)(viewport.Width - 256), 8, 16, 16), Color.Red); spriteBatch.End(); } UserInterface.Active.Draw(spriteBatch); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); _spriteBatch.Begin(); _fpsCounter.Draw(gameTime); Window.Title = $"{"FPS"} {_fpsCounter.FramesPerSecond}"; //draw board foreach (var tile in _board) { if (tile.Selected) { _spriteBatch.Draw(_sudokuTiles, tile.Rect, CreateTileRectangle(tile.Value), Color.Yellow); } else if (tile.Editable) { _spriteBatch.Draw(_sudokuTiles, tile.Rect, CreateTileRectangle(tile.Value), Color.Beige); } else { _spriteBatch.Draw(_sudokuTiles, tile.Rect, CreateTileRectangle(tile.Value), Color.White); } } for (var i = 0; i < _logLines.Count; i++) { var logLine = _logLines[i]; _spriteBatch.DrawString(_bitmapFont, logLine, new Vector2(4, i * _bitmapFont.LineHeight), Color.Red * 0.2f); } if (_currentState == GameStates.PLAYING) { _spriteBatch.DrawString(_impactFont, _gameTimer.Elapsed.ToString("mm\\:ss"), new Vector2((Window.ClientBounds.Width / 4) * 3, 0), Color.Gray); _spriteBatch.DrawString(_impactFont, "Score: " + _score.ToString(), new Vector2((Window.ClientBounds.Width / 4) * 3, 30), Color.White); } if (_currentState == GameStates.WIN || _currentState == GameStates.LOSE) { _spriteBatch.DrawString(_impactFont, "Score: " + _score.ToString(), new Vector2((Window.ClientBounds.Width / 4) * 3, 5), Color.White); } if (_currentState == GameStates.WIN) { _spriteBatch.Draw(_youWin, new Vector2((Window.ClientBounds.Width - _youWin.Width) / 2, Window.ClientBounds.Height / 3), Color.White); } if (_currentState == GameStates.LOSE) { _spriteBatch.Draw(_youLose, new Vector2((Window.ClientBounds.Width - _youWin.Width) / 2, Window.ClientBounds.Height / 3), Color.White); } _spriteBatch.End(); // TODO: Add your drawing code here base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { #if DEBUG _frames.Draw(gameTime); Window.Title = $"Alien Hunt (Debug) - {_frames.FramesPerSecond} fps"; #endif base.Draw(gameTime); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { _fpsCounter.Draw(gameTime); DrawSceneToTexture(renderTarget, gameTime); GraphicsDevice.Clear(Color.Black); UserInterface.Active.Draw(spriteBatch); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone); spriteBatch.Draw(renderTarget, new Rectangle(0, 0, Globals.PreferredBackBufferWidth, Globals.PreferredBackBufferHeight), Globals.Luminosity); spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); _fpsCounter.Draw(gameTime); Window.Title = $"{_currentDemo?.Name} {_fpsCounter.FramesPerSecond}"; base.Draw(gameTime); _currentDemo?.OnDraw(gameTime); _guiSystem.Draw(gameTime); }
public void Draw(SpriteBatch spriteBatch) { var originalViewport = spriteBatch.GraphicsDevice.Viewport; spriteBatch.GraphicsDevice.Viewport = _viewport; spriteBatch.Begin(samplerState: SamplerState.PointWrap, transformMatrix: _viewportAdapter.GetScaleMatrix()); Controls.Draw(spriteBatch); _fps.Draw(); spriteBatch.End(); spriteBatch.GraphicsDevice.Viewport = originalViewport; }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); Viewport viewport = GraphicsDevice.Viewport; // Only draw if we are Debugging #if DEBUG fps.Draw(gameTime); string fpsText = "FPS: " + fps.FramesPerSecond; spriteBatch.Begin(); spriteBatch.DrawString(bitmapFont, fpsText, new Vector2(viewport.Width - (bitmapFont.MeasureString(fpsText).Width), 0), Color.White); spriteBatch.End(); #endif base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { base.Draw(gameTime); GraphicsDevice.Clear(Color.Black); DrawModel(); _mainPanel._labelCamera.Text = "Camera: " + _scene.Camera.ToString(); _mainPanel._labelFps.Text = "FPS: " + _fpsCounter.FramesPerSecond; _mainPanel._labelMeshes.Text = "Meshes: " + _renderer.Statistics.MeshesDrawn; Desktop.Render(); _fpsCounter.Draw(gameTime); }
public override void Draw(GameTime gameTime) { fpsCounter.Draw(gameTime); Nocubeless.SpriteBatch.DrawString(font, "Player coordinates:\n" + PlayerCoordinates.ToString() + "\nIn chunk: " + ChunkCoordinates.ToString() + "\nPreviewable cube coordinates:\n" + ((Nocubeless.CubeWorld.PreviewableCube is null) ? "{None}" : Nocubeless.CubeWorld.PreviewableCube.Coordinates.ToString()) + "\n\nCurrent state: " + state, coordinatesDrawPosition, Color.Black); Nocubeless.SpriteBatch.DrawString(font, "FPS: " + fpsCounter.FramesPerSecond.ToString(CultureInfo.CurrentCulture), fpsDrawPosition, Color.Black); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.BlendState = BlendState.AlphaBlend; GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; GraphicsDevice.RasterizerState = RasterizerState.CullNone; var viewMatrix = _camera.GetViewMatrix(); var projectionMatrix = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0f, -1f); _mapRenderer.Draw(_map, ref viewMatrix, ref projectionMatrix, _customEffect); DrawText(); _fpsCounter.Draw(gameTime); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { base.Draw(gameTime); _gcMemoryLabel.Text = string.Format("GC Memory: {0} kb", GC.GetTotalMemory(false) / 1024); _fpsLabel.Text = string.Format("FPS: {0}", _fpsCounter.FramesPerSecond); _widgetsCountLabel.Text = string.Format("Visible Widgets: {0}", _desktop.CalculateTotalWidgets(true)); GraphicsDevice.Clear(Color.Black); _desktop.Bounds = new Rectangle(0, 0, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight); _desktop.Render(); _drawCallsLabel.Text = string.Format("Draw Calls: {0}", GraphicsDevice.Metrics.DrawCount); _fpsCounter.Draw(gameTime); }
public void Draw(SpriteBatch spriteBatch) { _drawFrames++; _drawStopwatch.Start(); _fps.Draw(); //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive); _scrollingBackground.Draw(spriteBatch); _gameState.Draw(spriteBatch); _lblTest.Draw(spriteBatch); _lblFps.Text = $"FPS: {_fps.FramesPerSecond}"; _lblFps.Draw(spriteBatch); spriteBatch.End(); _drawStopwatch.Stop(); BenchmarkMetrics.Instance.Metrics["SpaceShooterGame.Draw"] = new Metric(_drawStopwatch.Elapsed.TotalMilliseconds, _drawFrames); }
protected override void Draw(GameTime gameTime) { Window.Title = _fpsCounter.FramesPerSecond.ToString(); var graphicsDevice = GraphicsDevice; graphicsDevice.Clear(Color.CornflowerBlue); // update the matrices _worldMatrix = Matrix.Identity; _viewMatrix = _effect.View = Matrix.Identity; _projectionMatrix = _effect.Projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, -1); // comment and uncomment either of the two below lines to compare DrawSpritesWithBatcher2D(); //DrawSpritesWithSpriteBatch(); base.Draw(gameTime); _fpsCounter.Draw(gameTime); }
public override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.SlateGray); spriteBatch.Begin(samplerState: SamplerState.PointClamp); spriteBatch.Draw(ball.Sprite, ball.Position, ball.Rotation, ball.Scale); spriteBatch.Draw(playerPaddle.Sprite, playerPaddle.Position, playerPaddle.Rotation, playerPaddle.Scale); spriteBatch.Draw(aiPaddle.Sprite, aiPaddle.Position, aiPaddle.Rotation, aiPaddle.Scale); spriteBatch.DrawString( gameFont, "Score", new Vector2(ScreenWidth / 2.35f, ScreenHeight / 8f), Color.WhiteSmoke ); spriteBatch.DrawString( gameFont, playerScore + " | " + aiScore, new Vector2(ScreenWidth / 2.35f, ScreenHeight / 6f), Color.WhiteSmoke ); fpsCounter.Draw(gameTime); if (debug) { spriteBatch.DrawString( gameFont, "FPS: " + fpsCounter.FramesPerSecond, new Vector2(50, 50), Color.WhiteSmoke ); spriteBatch.DrawRectangle(playerPaddle.BoundingRectangle, Color.Red, 1); spriteBatch.DrawRectangle(aiPaddle.BoundingRectangle, Color.Red, 1); spriteBatch.DrawRectangle(ball.BoundingRectangle, Color.Red, 1); } spriteBatch.End(); }
protected override void Draw(GameTime gameTime) { base.Draw(gameTime); GraphicsDevice.Clear(Color.Black); DrawModel(); _mainPanel._labelCamera.Text = "Camera: " + _scene.Camera.ToString(); _mainPanel._labelFps.Text = "FPS: " + _fpsCounter.FramesPerSecond; _mainPanel._labelMeshes.Text = "Meshes: " + _renderer.Statistics.MeshesDrawn; Desktop.Render(); /* _spriteBatch.Begin(); * * _spriteBatch.Draw(_renderer.WaterReflection, * new Rectangle(0, 500, 600, 300), * Color.White); * * _spriteBatch.End();*/ _fpsCounter.Draw(gameTime); }
public void Draw(SpriteBatch spriteBatch, GameTime gameTime) { _fps.Draw(gameTime); spriteBatch.DrawString(_font, _fps.FramesPerSecond.ToString(), _position, _color); }