public void Draw(GameTime gameTime) { //_background2.Draw(_spriteBatch); _spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Camera2D.View); //GraphicsHandler.DrawSprites(_backgroundSprites, _spriteBatch); _backgroundObjectsHandler.Draw(_spriteBatch); GraphicsHandler.DrawSprites(_spriteList, _spriteBatch); _player.Draw(_spriteBatch); foreach (var gameObject in _objectList) { gameObject.Draw(_spriteBatch); } _spriteBatch.End(); foreach (var item in _wallList) { item.Draw(_spriteBatch); } Matrix projection = Camera2D.SimProjection; Matrix view = Camera2D.SimView; _debugView.RenderDebugData(ref projection, ref view); }
protected override void Draw(GameTime gameTime) { terrain.RenderTerrain(); GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, null); //Todo: Idealy pick a Foregrounds Image that has a good Y-Axis height and determine the highest & lowest points of each level in order to make it look good // Background does not scroll, Foreground only scrolls on the X-Axis float paralaxBackgroundMultiplier = 1f; spriteBatch.Draw(background, -(badger.Position * paralaxBackgroundMultiplier), new Rectangle(0, 0, background.Width /*800*/, background.Height /* 480*/), Color.White); float paralaxForegroundMultiplier = 2f; spriteBatch.Draw(foreground, new Vector2(0, /*arbitrary offset*/ foreground.Height / 2f - (badger.Position.Y * paralaxForegroundMultiplier)), new Rectangle((int)(badger.Position.X * paralaxForegroundMultiplier), 0, foreground.Width, foreground.Height), Color.White); terrain.Draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, camera.Transformation); foreach (Segment item in entityList) { item.Draw(spriteBatch); } spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, null); playerController.Draw(spriteBatch); spriteBatch.End(); debugView.RenderDebugData(camera.Projection, camera.Transformation); base.Draw(gameTime); }
public void DrawDebug() { Matrix projection = Camera.SimProjection; Matrix view2 = Camera.SimView; view.RenderDebugData(ref projection, ref view2); }
public void Draw(GameTime gameTime) { var transform = _camera.GetTransformation(); _spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null, null, transform); _spriteBatch.Draw(_background, new Rectangle(0, 0, WorldWidth, WorldHeight), null, BackgroundColor); for (var i = 0; i < _walls.Count; i++) { _walls[i].Draw(); } _spriteBatch.End(); _spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, transform); _dragon.Draw(); for (var i = 0; i < _bubbles.Count; i++) { _bubbles[i].Draw(); } for (var i = 0; i < _enemies.Count; i++) { _enemies[i].Draw(); } _spriteBatch.End(); if (_gameInput.ShowDebug) { var projection = Matrix.CreateOrthographicOffCenter(0f, _camera.ViewportWidth, _camera.ViewportHeight, 0f, 0f, 1f); var scale = Matrix.CreateScale(32f) * transform; _debugView.RenderDebugData(projection, scale); } }
/// <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) { MousePosition = Mouse.GetState().Position; GraphicsDevice.Clear(Color.Chocolate); Camera.Pos = Player.GetPosition(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Camera.GetTransformation()); movePointer.Draw(spriteBatch); Noms.ForEach(nom => nom.Draw(spriteBatch)); #if DEBUG DebugDraw(); #endif var pos = Mouse.GetState().Position.ToVector2() + Camera.TopLeftPos; cursor.SetPos(pos); cursor.Draw(spriteBatch); spriteBatch.End(); #if DEBUG var transform = Matrix.CreateOrthographicOffCenter( ConvertUnits.ToSimUnits(Camera.TopLeftPos.X), ConvertUnits.ToSimUnits(Camera.TopLeftPos.X + GraphicsDevice.Viewport.Width), ConvertUnits.ToSimUnits(Camera.TopLeftPos.Y + GraphicsDevice.Viewport.Height), ConvertUnits.ToSimUnits(Camera.TopLeftPos.Y), 0f, 1f); DebugView.RenderDebugData(ref transform); #endif base.Draw(gameTime); }
public void Draw() { if (!isVisible) { return; } if (GraphicsEnabled) { _flipFlop.Draw(this); GameLoop.gameInstance.GraphicsDevice.SetRenderTarget(null); GameLoop.gameInstance.GraphicsDevice.Clear(Color.White); spriteBatch.Begin(); spriteBatch.Draw(_flipFlop.Result, Vector2.Zero, Color.White); Primitives.Instance.drawBoxFilled(spriteBatch, new Rectangle(0, 0, GameSettings.Default.resolutionWidth, 96), Color.Black); Primitives.Instance.drawBoxFilled(spriteBatch, new Rectangle(0, GameSettings.Default.resolutionHeight - 96, GameSettings.Default.resolutionWidth, 96), Color.Black); /*if (GameLoop.gameInstance.playerInstance.mState != null) * { * Primitives.Instance.drawCircleFilled(spriteBatch, new Vector2(GameLoop.gameInstance.playerInstance.mState.X, GameLoop.gameInstance.playerInstance.mState.Y), 5, Color.Gray); * }*/ spriteBatch.End(); } if (DebugViewEnabled) { debugView.RenderDebugData(ref proj, ref Camera.debugMatrix); } }
/// <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 spriteBatch = _resources.GetSpriteBatch(); spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, _cam.ViewMatrix); _gameObjectFactory.Draw(spriteBatch); spriteBatch.DrawString(_resources.GetFont(), _player.ToString(), _player.Body.Position * Globals.METER_IN_PIXEL, Color.Black); spriteBatch.End(); // calculate the projection and view adjustments for the debug view Matrix projection = Matrix.CreateOrthographicOffCenter(0f, _graphics.GraphicsDevice.Viewport.Width / Globals.METER_IN_PIXEL, _graphics.GraphicsDevice.Viewport.Height / Globals.METER_IN_PIXEL, 0f, 0f, 1f); Matrix view = Matrix.CreateTranslation(new Vector3((Vector2.Zero / Globals.METER_IN_PIXEL) - (_cam.ScreenCenter / Globals.METER_IN_PIXEL), 0f)) * Matrix.CreateTranslation(new Vector3((_cam.ScreenCenter / Globals.METER_IN_PIXEL), 0f)); if (_showDebug) { _debugView.RenderDebugData(ref projection, ref view); } 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); _gameState.Draw(gameTime); base.Draw(gameTime); spriteBatch.Begin(); Matrix projection = Matrix.CreateOrthographicOffCenter( 0f, graphics.GraphicsDevice.Viewport.Width / _displayUnitsToSimUnitsRatio, graphics.GraphicsDevice.Viewport.Height / _displayUnitsToSimUnitsRatio, 0f, 0f, 1f ); // draw the debug view DebugView.RenderDebugData(projection, Camera.GetScaledTransformMatrix()); spriteBatch.End(); //particleEngine.Draw(spriteBatch); }
public override void Draw() { return; #if WINDOWS || WINDOWS_PHONE base.Draw(); Matrix proj = Matrix.CreateOrthographic(BaseGame.Get.BackBufferWidth / Camera.Get.WorldScale.X / 100.0f, BaseGame.Get.BackBufferHeight / Camera.Get.WorldScale.Y / 100.0f, 0, 1000000); Vector3 campos = new Vector3(); campos.X = -Camera.Get.Position.X / 100.0f; campos.Y = Camera.Get.Position.Y / -100.0f; campos.Z = 0; Matrix tran = Matrix.Identity; tran.Translation = campos; Matrix view = tran; SpriteBatch.End(); _debugView.RenderDebugData(ref proj, ref view); float screenScale = Camera.CurrentCamera.UniformWorldScale; Matrix offset = Matrix.CreateTranslation(new Vector3(BaseGame.Get.HalfBackBufferWidth / screenScale, BaseGame.Get.HalfBackBufferHeight / screenScale, 0)); Matrix pos = Matrix.CreateTranslation(new Vector3(-Camera.Get.PosX, Camera.Get.PosY, 0)); Matrix scale = Matrix.CreateScale(screenScale); pos = pos * offset; pos *= scale; BaseGame.Get.Begin(); #endif }
public void DrawPhysicsObjects(ref Matrix view) { if (world.Enabled) { debugview.RenderDebugData(ref projection, ref view); } }
public override void Draw(SpriteBatch spriteBatch) { shipList.ElementAt(0).Draw(spriteBatch); asteroid.Draw(spriteBatch); //ship2.Draw(spriteBatch); debugView.RenderDebugData(ref projection); }
public override void Draw(GameTime gameTime) { Matrix projection = Camera.SimProjection; Matrix view = Camera.SimView; DebugView.RenderDebugData(ref projection, ref view); base.Draw(gameTime); }
public override void DrawOuterDebug() { #if DEBUG var pMatrix = Matrix.CreateTranslation(GDOwner.MapOffsetX, GDOwner.MapOffsetY, 0) * GDOwner.VAdapterGame.GetFarseerDebugProjectionMatrix(); var vMatrix = Matrix.CreateScale(GDConstants.PHYSICS_CONVERSION_FACTOR); debugView.RenderDebugData(ref pMatrix, ref vMatrix); #endif }
public static void DebugRender() { Vector3 cameraPos = Camera.MainCamera.Transform.WorldPosition; debugViewMatrix = Matrix.CreateLookAt(cameraPos / MInPx, new Vector3(cameraPos.X / MInPx, cameraPos.Y / MInPx, (cameraPos.Z - 2000f) / MInPx), Vector3.Up); debugProjMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(60f), 16f / 9f, 0.5f, 5000f); debugView.RenderDebugData(ref debugProjMatrix, ref debugViewMatrix); }
private void DrawDebugData() { Matrix proj = Matrix.CreateOrthographicOffCenter(0f, HUD.Width, HUD.Height, 0f, 0f, 1f); Matrix view2 = Matrix.CreateScale(64); view2 *= Camera.View; _debugView.RenderDebugData(ref proj, ref view2); }
public override void Draw(GameTime gameTime) { if (World != null) { DebugView.RenderDebugData(ref Camera2D.Projection, ref Camera2D.View); } base.Draw(gameTime); }
public override void Draw(Microsoft.Xna.Framework.Graphics.GraphicsDevice device, Camera cam) { if (ApplicationSettings.ShowDebugLines) { Debug.DrawLines(device, cam); } if (ApplicationSettings.ShowDebugPhysics) { Matrix proj = cam.projectionMatrix; Matrix view = cam.view; if (rayCastPlane.HasValue) { if (rayCastPlane.Value.normal == Vector3.up) { view = Matrix.CreateRotationX(MathHelper.ToRadians(90)) * view; } } physicsDebugView.RenderDebugData(ref proj, ref view, b => dontDrawColliders.Contains(b.UserData)); // NOTE: This only works for XY plane stuff PressPlay.FFWD.Vector3 inPos = Input.mousePosition; inPos.z = cam.nearClipPlane; PressPlay.FFWD.Vector2 castPos = cam.ScreenToWorldPoint(inPos); if (rayCastPlane.HasValue) { float dist; Ray ray = Camera.main.ScreenPointToRay(inPos); if (rayCastPlane.Value.Raycast(ray, out dist)) { Vector3 pt = ray.GetPoint(dist); castPos = new Vector2(pt.x, pt.z); } else { castPos = Vector2.zero; } } Debug.Display("Mouse / Physics", inPos + " / " + castPos); RaycastHit[] hits = Physics.PointcastAll(castPos, cam.cullingMask); if (hits.Length > 0) { Debug.Display("Over", String.Join("\n", hits.Select(h => h.collider.ToString()).OrderBy(s => s).ToArray())); } else { Debug.Display("Over", ""); } } if (ApplicationSettings.ShowDebugPhysicsCustom) { Physics.DrawDebug(); } }
void Draw_DebugData(GraphicsDevice graphics) { Matrix projection = Matrix.CreateOrthographicOffCenter(0f, screenManager.GraphicsDevice.Viewport.Width / MeterInPixels, screenManager.GraphicsDevice.Viewport.Height / MeterInPixels, 0f, 0f, 1f); Matrix view = Matrix.CreateTranslation(new Vector3((-Camera.Instance.Position / MeterInPixels), 0f)) * Matrix.CreateScale(Camera.Instance.Zoom, Camera.Instance.Zoom, 0f) * Matrix.CreateRotationZ(Camera.Instance.GetWorldRotation()) * Matrix.CreateTranslation(new Vector3(((new Vector2(graphics.Viewport.Width, graphics.Viewport.Height) * 0.5f) / MeterInPixels), 0f)); _debugView.RenderDebugData(ref projection, ref view); }
public void Draw() { Matrix proj = Engine.Renderer.RenderLayers["DebugPhysicsOverlay"].Camera.Projection; Matrix view = Engine.Renderer.RenderLayers["DebugPhysicsOverlay"].Camera.View; Matrix scale = Matrix.CreateScale(1.0f / PhysicsManager.Scale); view = scale * view; if (m_showDebug) { m_debugView.RenderDebugData(ref proj, ref view); } }
/// <summary> /// Draws this scene. /// </summary> /// <param name="spriteBatch"></param> public void Draw(SpriteBatch spriteBatch) { GameManager.Instance.GraphicsDevice.Clear(BackgroundColor); if (BackgroundTexture != null) { Matrix m = Camera.ViewMatrix; Rectangle rect = new Rectangle(0, 0, GameManager.Instance.GraphicsDevice.Viewport.Width * 4, GameManager.Instance.GraphicsDevice.Viewport.Height * 4); spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, transformMatrix: Camera.ViewMatrix); spriteBatch.Draw(BackgroundTexture, Camera.Position, rect, Color.White, 0f, Vector2.Zero, 0.25f, SpriteEffects.None, 0f); spriteBatch.End(); } spriteBatch.Begin(transformMatrix: Camera.ViewMatrix); foreach (GameObject gameObject in gameObjects.Values) { gameObject.Draw(spriteBatch); } OnDraw(spriteBatch); Matrix projection = Matrix.CreateOrthographicOffCenter(0f, ConvertUnits.ToSimUnits(GameManager.Instance.GraphicsDevice.Viewport.Width), ConvertUnits.ToSimUnits(GameManager.Instance.GraphicsDevice.Viewport.Height), 0f, 0f, 1f); spriteBatch.End(); spriteBatch.Begin(); foreach (GameObject gameObject in gameObjects.Values) { gameObject.DrawGUI(spriteBatch); } OnDrawGUI(spriteBatch); spriteBatch.End(); spriteBatch.Begin(transformMatrix: Camera.SimViewMatrix); DebugView.RenderDebugData(projection, Camera.SimViewMatrix); spriteBatch.End(); }
/// <summary> /// Draw /// </summary> /// <param name="gameTime"></param> public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { // Draw scene base.Draw(gameTime); if (!this.IsVisible || !(this.ScreenState == ScreenState.WaitingForTransition || this.ScreenState == Engine.Services.ScreenState.Hidden)) { return; } #if DEBUG Matrix mprojection = _fxcamera.SimProjection; Matrix mview = _fxcamera.SimView; #if !SILVERLIGHT if (_inputManager.Keyboard.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F12)) { view.RenderDebugData(ref mprojection, ref mview); } #endif if (PeaController.DebugNodes != null) { this.ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, _camera.View); var font = this.ScreenManager.SpriteFonts["Default"]; var goal = PeaController.DebugNodes[0].GoalValue; var posg = _spriteGrid.Position + new Vector2(goal.Position.X * 70, goal.Position.Y * 49); this.ScreenManager.SpriteBatch.DrawString(font, String.Format("A{0}-D{1}", goal.Action.ToString()[0].ToString(), goal.Dir.ToString()[0].ToString()), posg, Color.Red); foreach (var node in PeaController.DebugNodes) { var pos = _spriteGrid.Position + new Vector2(node.Value.Position.X * 70, node.Value.Position.Y * 49); pos += Vector2.UnitY * 10 * (Int32)node.Value.Action; this.ScreenManager.SpriteBatch.DrawString(font, String.Format("S{0}: A{1}-D{2}", node.NodeState.ToString()[0].ToString(), node.Value.Action.ToString()[0].ToString(), node.Value.Dir.ToString()[0].ToString() //(node.PreviousNode ?? new ArtificialIntelligence.AStar.Node<MoveNode>() { Value = new MoveNode() }).Value.Position), ), pos, Color.Black); } this.ScreenManager.SpriteBatch.End(); } #endif if (this.IsTransitioning) { this.ScreenManager.FadeBackBufferToBlack((Byte)(255 - this.TransitionAlpha)); } }
public override void Draw(GameTime gameTime) { Matrix projection = Camera.SimProjection; Matrix view = Camera.SimView; if (RenderDebug) { if (_flagsChanged) { DebugView.Flags = _flags; _flagsChanged = false; } DebugView.RenderDebugData(ref projection, ref view); } base.Draw(gameTime); }
void DebugDraw() { Matrix view2 = Matrix.CreateScale(32); //default 32 view2 *= Game1.DebugCam.view; // debugActive = true; DebugView = new DebugViewXNA(Game1.world); // DebugView.AppendFlags(FarseerPhysics.DebugViewFlags.DebugPanel); DebugView.DefaultShapeColor = Color.Red; DebugView.SleepingShapeColor = Color.Green; DebugView.StaticShapeColor = Color.Violet; DebugView.LoadContent(Setup.graphics.GraphicsDevice, Setup.ContentDevice); DebugView.RenderDebugData(ref Game1.DebugCam.projection, ref view2); }
/// <summary> /// Draws physics debug overlay to screen. /// </summary> /// <param name="camera"></param> public void DrawDebugOverlay(Camera camera) { if (_debugViewXna == null) { throw new Exception("Debug view not loaded, call 'LoadDebugView()'."); } // Position debug view // _debugTranPositionFromCamera.X = ConvertUnits.ToSimUnits(-camera.Position.X); _debugTranPositionFromCamera.Y = ConvertUnits.ToSimUnits(-camera.Position.Y); _debugTranFromCamera.Translation = _debugTranPositionFromCamera; // Draw debug. _debugViewXna.RenderDebugData(Matrix.CreateOrthographic(ConvertUnits.ToSimUnits(camera.ViewportSize.X), ConvertUnits.ToSimUnits(-camera.ViewportSize.Y), 0, 1000), _debugTranFromCamera); }
public override void OnRender(GameTime gameTime) { if (!_levelLoaded) { return; } base.OnRender(gameTime); if (_debugViewState) { float scale = (SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().Z / 1024.0f); float left = UnitsConverter.ToSimUnits(SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().X - Platform.Instance.Device.Viewport.Width / 2f * scale); float right = UnitsConverter.ToSimUnits(SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().X + Platform.Instance.Device.Viewport.Width / 2f * scale); float top = UnitsConverter.ToSimUnits(-SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().Y + Platform.Instance.Device.Viewport.Height / 2f * scale); float bottom = UnitsConverter.ToSimUnits(-SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().Y - Platform.Instance.Device.Viewport.Height / 2f * scale); _projection = Matrix.CreateOrthographicOffCenter( left, right, top, bottom, 0f, 1f ); if (_debugViewGrid) { _debugView.BeginCustomDraw(ref _projection, ref _view); for (float i = left - left % _debugViewGridstep; i < right; i += _debugViewGridstep) { _debugView.DrawSegment(new Vector2(i, top), new Vector2(i, bottom), _gridColor); } for (float i = bottom - bottom % _debugViewGridstep; i < top; i += _debugViewGridstep) { _debugView.DrawSegment(new Vector2(left, i), new Vector2(right, i), _gridColor); } _debugView.EndCustomDraw(); } _debugView.RenderDebugData(ref _projection, ref _view); } }
protected void DrawDebugScene(int playerIndex) { // get the current player representation PlayerRepresentation playerRepresentation = representationManager.GetPlayerRepresentationWithIndex((PlayerIndex)playerIndex); playerRepresentation.Cam.Zoom = resolutionRatio(); if (GameVariables.NumPlayers == 1) { playerRepresentation.Cam.Zoom *= 2; } //Matrix _projection = Matrix.CreateOrthographicOffCenter(0f, ConvertUnits.ToSimUnits(GraphicsDevice.Viewport.Width), ConvertUnits.ToSimUnits(GraphicsDevice.Viewport.Height), 0f, 0f, 1f); Matrix _projection = playerRepresentation.Cam.SimProjection; Matrix _view = playerRepresentation.Cam.SimView; DebugView.RenderDebugData(ref _projection, ref _view); }
/// <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); Matrix projection = Matrix.CreateOrthographicOffCenter(0f, _graphics.GraphicsDevice.Viewport.Width / MeterInPixels, _graphics.GraphicsDevice.Viewport.Height / MeterInPixels, 0f, 0f, 1f); Matrix view = Matrix.CreateTranslation(new Vector3((_cameraPosition / MeterInPixels) - (_screenCenter / MeterInPixels), 0f)) * Matrix.CreateTranslation(new Vector3((_screenCenter / MeterInPixels), 0f)); _batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); ctrl.drawInfo(_batch, _font); _batch.End(); _debugView.RenderDebugData(ref projection, ref view); //_debugView.BeginCustomDraw(ref projection, ref view); //_debugView.EndCustomDraw(); base.Draw(gameTime); }
public void Draw() { Matrix projection = Camera.Main.Transform; projection = Matrix.CreateOrthographicOffCenter( 0f, ConvertUnits.ToSimUnits(graphics.Viewport.Width), ConvertUnits.ToSimUnits(graphics.Viewport.Height), 0f, 0f, 1f); Matrix view = Matrix.CreateTranslation(ConvertUnits.ToSimUnits( new Vector3(-Camera.Main.Position.X, -Camera.Main.Position.Y, 0))) * Matrix.CreateScale(new Vector3(Camera.Main.Zoom, Camera.Main.Zoom, 1)) * Matrix.CreateTranslation(ConvertUnits.ToSimUnits(graphics.Viewport.Width) * 0.5f, ConvertUnits.ToSimUnits(graphics.Viewport.Height) * 0.5f, 0); debugView.DebugPanelPosition = -Vector2.One; debugView.RenderDebugData(ref projection, ref view); }
public override void OnRender(GameTime gameTime) { base.OnRender(gameTime); if (_debugViewState) { float scale = (SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().Z / 1024.0f); _projection = Matrix.CreateOrthographicOffCenter( UnitsConverter.ToSimUnits(SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().X - Platform.Instance.Device.Viewport.Width / 2f * scale), UnitsConverter.ToSimUnits(SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().X + Platform.Instance.Device.Viewport.Width / 2f * scale), UnitsConverter.ToSimUnits(-SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().Y + Platform.Instance.Device.Viewport.Height / 2f * scale), UnitsConverter.ToSimUnits(-SceneManager.Instance.GetCurrentCamera().Parent.GetPosition().Y - Platform.Instance.Device.Viewport.Height / 2f * scale), 0f, 1f ); _debugView.RenderDebugData(ref _projection, ref _view); } }
protected override void Draw() { GraphicsDevice.Clear(Color.CornflowerBlue); if (_gridSnap.Enabled) { int vertCount = this.Size.Height / _gridSnap.GridHeight; int horCount = this.Size.Width / _gridSnap.GridWidth; _spriteBatch.Begin(); for (int i = 0; i < vertCount + 1; i++) { _spriteBatch.Draw(_lineTexture, new Rectangle(0, i * _gridSnap.GridHeight, this.Size.Width, 1), Color.Gray); } for (int i = 0; i < horCount + 1; i++) { _spriteBatch.Draw(_lineTexture, new Rectangle(i * _gridSnap.GridWidth, 0, 1, this.Size.Height), Color.Gray); } _spriteBatch.End(); } if (_previewGameObject != null && DrawCurrentGameObject) { _previewGameObject.Camera.Position = -_mousePosition; _previewGameObject.Draw(GameTimer.GameTime); _previewGameObject.Camera.Position = Vector2.Zero; } if (_gameLevel != null) { _gameLevel.Draw(GameTimer.GameTime); } Matrix simProj = Matrix.CreateOrthographicOffCenter(0, ConvertUnits.ToSimUnits(this.Size.Width), ConvertUnits.ToSimUnits(this.Size.Height), 0, 0, 1); Matrix simView = _gameLevel.Camera.GetSimViewMatrix(); _selectedItemsDisplay.DrawSelectedItems(ref simProj, ref simView); if (_debugView != null) { _debugView.RenderDebugData(ref simProj, ref simView); } }
void DebugDraw() { Matrix view2 = Matrix.CreateScale(32); //default 32 view2 *= Game1.DebugCam.view; debugActive = true; DebugView = new DebugViewXNA(Game1.world); DebugView.AppendFlags(FarseerPhysics.DebugViewFlags.DebugPanel); DebugView.DefaultShapeColor = Color.Red; DebugView.SleepingShapeColor = Color.Green; DebugView.StaticShapeColor = Color.Violet; DebugView.LoadContent(Game1.graphics.GraphicsDevice, Game1.content); DebugView.RenderDebugData(ref Game1.DebugCam.projection, ref view2); }