protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); //_spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix()); //_spriteBatch.Draw(_backgroundTexture, new Rectangle(0, 0, _tiledMap.WidthInPixels, _tiledMap.HeightInPixels), Color.White); //_spriteBatch.End(); _tiledMap.Draw(_camera); _spriteBatch.Begin(); //_spriteBatch.DrawString(_bitmapFont, "This is MonoGame.Extended", new Vector2(50, 50), new Color(Color.Black, 0.5f)); //_spriteBatch.DrawString(_bitmapFont, string.Format("Camera: {0}", _camera.Position), new Vector2(50, 100), Color.Black); //_spriteBatch.DrawString(_bitmapFont, string.Format("Camera Direction: {0}", _cameraDirection), new Vector2(50, 150), Color.Black); //_spriteBatch.DrawString(_bitmapFont, // "Contrary to popular belief, Lorem Ipsum is not simply random text.\n\n" + // "It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard " + // "McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin " + // "words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, " + // "discovered the undoubtable source.", new Vector2(50, 100), new Color(Color.Black, 0.5f), _viewportAdapter.VirtualWidth - 50); _spriteBatch.End(); _spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix()); _spriteBatch.Draw(_textureRegion, _sprite.GetBoundingRectangle(), Color.White); _spriteBatch.Draw(_sprite); _spriteBatch.End(); base.Draw(gameTime); }
public override void Render(float deltaTime) { base.Render(deltaTime); _tiledMap.Draw(Game.Camera); _spriteBatch.Begin(Game.Camera.GetViewMatrix()); for (int y = 0; y < _tiledMap.Height; y++) { for (int x = 0; x < _tiledMap.Width; x++) { var tileInfo = _tiledMap.GetTileAt(1, x, y); var text = tileInfo.Id.ToString(); var tx = (int)tileInfo.Centre.X; var ty = (int)tileInfo.Centre.Y; var rectangle = _font.MeasureText(text, tx, ty); var color = new Color(Color.Black, 0.5f); _font.Draw(_spriteBatch, text, tx - rectangle.Width / 2, ty - rectangle.Height / 2, color); } } _blob.Draw(_spriteBatch); _spriteBatch.End(); }
/// <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); var transformMatrix = Camera.GetViewMatrix(); SpriteBatch.Begin(transformMatrix: transformMatrix); player.Draw(SpriteBatch); foreach (Enemy E in Enemies) { E.Draw(SpriteBatch); } Goal.Draw(SpriteBatch); Map.Draw(SpriteBatch); SpriteBatch.End(); SpriteBatch.Begin(); SpriteBatch.DrawString(Arialfont, "Score : " + Score.ToString(), new Vector2(20, 20), Color.Orange); for (int i = 0; i < Lives; i++) { SpriteBatch.Draw(Heart, new Vector2(ScreenWidth - 80 - i * 20, 20), Color.White); } SpriteBatch.End(); // TODO: Add your drawing code here AIE.StateManager.Draw(SpriteBatch); base.Draw(gameTime); }
/// <summary> /// Draw the map /// </summary> /// <param name="gameTime"></param> protected override void Draw(GameTime gameTime) { map.Draw(gameTime, Renderer); // draws the present context of the renderer to the window Renderer.RenderPresent(); }
public override void Draw(SpriteBatch spriteBatch) { var transformMatrix = camera.GetViewMatrix(); spriteBatch.Begin(transformMatrix: transformMatrix); map.Draw(spriteBatch); player.Draw(spriteBatch); goal.Draw(spriteBatch); foreach (Enemy e in enemies) { e.Draw(spriteBatch); } foreach (LockedWall lw in lockedWalls) { lw.Draw(spriteBatch); } if (showKey == true) { key.Draw(spriteBatch); } if (show1up == true) { extralife.Draw(spriteBatch); } spriteBatch.End(); spriteBatch.Begin(); spriteBatch.DrawString(ventureFont, "Score : " + score.ToString("f0"), new Vector2(20, 10), Color.White); spriteBatch.DrawString(ventureFont, timer.ToString("f0"), new Vector2((ScreenWidth / 2), 10), Color.White); for (int i = 0; i < lives; i++) { spriteBatch.Draw(heart, new Vector2(ScreenWidth - 30 - i * 20, 10), Color.White); } spriteBatch.End(); }
public override void Draw(SpriteBatch spriteBatch) { var transformMatrix = camera.GetViewMatrix(); spriteBatch.Begin(); spriteBatch.Draw(moon, new Vector2(0, -150), Color.White); spriteBatch.End(); spriteBatch.Begin(transformMatrix: transformMatrix); map.Draw(spriteBatch); player.Draw(spriteBatch); kitty.Draw(spriteBatch); map2.Draw(spriteBatch); fadein.Draw(spriteBatch); fadeout.Draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(); if (skipActive == true) { spriteBatch.DrawString(font, "press enter to skip", new Vector2(600, 450), Color.White); } //spriteBatch.DrawString(font, camera.Position.ToString(), new Vector2(30, 30), Color.White); //spriteBatch.DrawString(font, timer.ToString(), new Vector2(30, 50), Color.White); spriteBatch.End(); }
public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); currentLevel.Draw(spriteBatch, new Rectangle(Vector2.Zero.ToPoint(), ScreenManager.Instance.Dimensions.ToPoint())); player.Draw(spriteBatch); }
public void Draw(Camera2D camera, SpriteBatch spriteBatch) { spriteBatch.Begin(transformMatrix: camera.GetViewMatrix(), samplerState: SamplerState.PointClamp); _tiledMap.Draw(camera); if (SceneManager.Instance.DebugMode) { DrawColliders(spriteBatch); } spriteBatch.End(); }
public void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { foreach (var layer in _map.Layers.Where(l => l.Name != "UpperLayer")) { layer.IsVisible = true; } _map.GetLayer("UpperLayer").IsVisible = false; _map.Draw(_camera.GetViewMatrix()); }
/// <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); // TODO: Add your drawing code here spriteBatch.Begin(); TestMap.Draw(_camera); spriteBatch.End(); 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); spriteBatch.Begin(transformMatrix: camera.GetViewMatrix(), samplerState: SamplerState.PointClamp); map.Draw(spriteBatch); player.Draw(spriteBatch); spriteBatch.End(); 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); // TODO: Add your drawing code here var transformMatrix = camera.GetViewMatrix(); AIE.StateManager.Draw(spriteBatch); if (lives > 0) { spriteBatch.Begin(transformMatrix: transformMatrix); backgound.Draw(spriteBatch); player.Draw(spriteBatch); foreach (Enemy e in enemies) { e.Draw(spriteBatch); } foreach (BronzeLootPile b in bronzeLootPiles) { b.Draw(spriteBatch); } foreach (SilverLootPile s in silverLootPiles) { s.Draw(spriteBatch); } foreach (GoldLootPile g in goldLootPiles) { g.Draw(spriteBatch); } foreach (HealthPack h in healthPacks) { h.Draw(spriteBatch); } goal.Draw(spriteBatch); map.Draw(spriteBatch); spriteBatch.End(); } //draw all the GUI compoments in a seperate SpriteBatch section spriteBatch.Begin(); spriteBatch.DrawString(agency_FB, "Score :" + score.ToString(), new Vector2(20, 20), Color.Gold); for (int i = 0; i < lives; i++) { spriteBatch.Draw(heart, new Vector2(ScreenWidth - 80 - i * 20, 20), Color.White); } spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here var t = camera.GetViewMatrix(); map.Draw(camera); spriteBatch.Begin(transformMatrix: t); //if (player.IsJumping == false && player.Velocity.X != 0) { fireEmitter.Draw(spriteBatch); } player.Draw(spriteBatch); foreach (Enemy e in enemies) { e.Draw(spriteBatch); } foreach (Coin c in coins) { c.Draw(spriteBatch); } spriteBatch.End(); // All GUI components below spriteBatch.Begin(); spriteBatch.DrawString(arialFont, "Score : " + score.ToString(), new Vector2(30, 200), Color.White); for (int i = 0; i < player.lives; i++) { spriteBatch.Draw(heart, new Vector2(20 + i * 35, 20), null, Color.White, 0f, new Vector2(0, 0), 1.35f, SpriteEffects.None, 0f); } spriteBatch.End(); //All debugging outputs below //spriteBatch.Begin(); //spriteBatch.DrawString(arialFont, "Position X = " + player.Position.X.ToString() + "Position Y = " + player.Position.Y.ToString(), new Vector2(50, 80), Color.Black); //spriteBatch.DrawString(arialFont, "Position X = " + player.Position.X.ToString() + "Position Y = " + player.Position.Y.ToString(), new Vector2(50, 120), Color.White); //spriteBatch.End(); base.Draw(gameTime); }
public override void Render(Graphics graphics, Camera camera) { if (LayerIndicesToRender == null) { TiledMap.Draw(graphics.Batcher, Entity.Transform.Position + _localOffset, Transform.Scale, LayerDepth, camera.Bounds); } else { for (var i = 0; i < TiledMap.Layers.Count; i++) { if (TiledMap.Layers[i].Visible && LayerIndicesToRender.Contains(i)) { TiledMap.Layers[i].Draw(graphics.Batcher, Entity.Transform.Position + _localOffset, Transform.Scale, LayerDepth, camera.Bounds); } } } }
public override void Draw(GameTime gameTime, Renderer renderer) { base.Draw(gameTime, renderer); renderer.ClearScreen(); tiledMap.Draw(gameTime, renderer); foreach (var agent in simulationManager.TrackedAgents) { agent.Draw(gameTime, renderer); } DrawActiveNodeCenters(renderer); DrawEmployeCollisionBoxes(renderer); userInterfaceManager.Draw(gameTime, renderer); }
/// <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); // TODO: Add your drawing code here var transformMatrix = camera.GetViewMatrix(); spriteBatch.Begin(transformMatrix: transformMatrix); //spriteBatch.Begin(); player.Draw(spriteBatch); map.Draw(spriteBatch); spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); _spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix()); _tiledMap.Draw(_spriteBatch, _camera); _spriteBatch.End(); _spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix()); _zombie.Draw(_spriteBatch); _spriteBatch.End(); //_spriteBatch.Begin(); //_spriteBatch.DrawString(_bitmapFont, string.Format("FPS: {0} Zoom: {1}", _fpsCounter.AverageFramesPerSecond, _camera.Zoom), new Vector2(5, 5), new Color(0.5f, 0.5f, 0.5f)); //_spriteBatch.End(); 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.Gray); var transformMatrix = camera.GetViewMatrix(); spriteBatch.Begin(transformMatrix: transformMatrix); player.Draw(spriteBatch); map.Draw(spriteBatch); foreach (Enemy e in enemies) { e.Draw(spriteBatch); } goal.Draw(spriteBatch); spriteBatch.End(); // TODO: Add your drawing code here base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); batch.Begin(SpriteSortMode.Deferred, null, null, null, rasterizerState, basicEffect, null); map.Draw(batch); batch.End(); Matrix debugProjection = Matrix.CreateOrthographic(ConvertUnits.ToSimUnits(graphics.GraphicsDevice.Viewport.Width), ConvertUnits.ToSimUnits(-graphics.GraphicsDevice.Viewport.Height), ConvertUnits.ToSimUnits(0.1f), ConvertUnits.ToSimUnits(1000f)); Matrix _debugView = Matrix.CreateTranslation(ConvertUnits.ToSimUnits(new Vector3(cameraPosition - screenCenter, -1f))); debugView.RenderDebugData(debugProjection, _debugView); debugView.BeginCustomDraw(debugProjection, _debugView); debugView.DrawPoint(playerBody.Position, 0.05f, Color.Blue); debugView.EndCustomDraw(); base.Draw(gameTime); }
/// <summary> /// Draws the scene, taking into account the background, camera, and all active drawables. /// </summary> /// <param name="graphicsDevice">The Monogame GraphicsDevice to use for drawing.</param> /// <param name="gameTime">Information about how much real-world time has passed since the last update.</param> public void Draw(GraphicsDevice graphicsDevice, GameTime gameTime) { camera.UpdatePosition(); graphicsDevice.Clear(bgColor); spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, camera.GetViewMatrix()); map.Draw(spriteBatch, camera); int count = container.ActiveDrawables.Count; // Using explicit indexing becuase ActiveDrawables is an interface. for (int i = 0; i < count; ++i) { container.ActiveDrawables[i].Draw(spriteBatch); } spriteBatch.End(); }
protected void DrawGameState(SpriteBatch spritebatch) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here var transformMatrix = camera.GetViewMatrix(); spriteBatch.Begin(transformMatrix: transformMatrix); { foreach (Enemy e in enemies) { e.Draw(spriteBatch); } map.Draw(spriteBatch); Debug.WriteLine("goal" + (goal == null)); goal.Draw(spriteBatch); } player.Draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(); spriteBatch.DrawString(arialFont, "Score : " + score.ToString(), new Vector2(20, 20), Color.Orange); for (int i = 0; i < lives; i++) { Debug.WriteLine("heart" + (heart == null)); spriteBatch.Draw(heart, new Vector2(ScreenWidth - 80 - i * 20, 20), Color.White); } spriteBatch.End(); }
public override void Draw(GameTime gameTime) { SokobanGame.Instance.GraphicsDevice.Clear(Colors.GameScreenBackground); map.Draw(); sb.Begin(); var tex = map.Tileset.Texture; Rectangle r = new Rectangle((int)(playerPos.X * map.TileWidth + map.RenderOffset.X), (int)(playerPos.Y * map.TileHeight + map.RenderOffset.Y), map.TileWidth, map.TileHeight); sb.Draw(tex, r, map.Tileset.GetSourceRect(playerTile), Color.White); sb.End(); if (debugMode) { map.DrawDebug(); } int width = SokobanGame.Width; int height = SokobanGame.Height; sb.DrawRect(0, 0, width, topPad, Colors.PadBackground); sb.DrawRect(0, height - botPad, width, botPad, Colors.PadBackground); sb.DrawRect(0, topPad, width, borderSize, Colors.PadBorder); sb.DrawRect(0, height - botPad - borderSize, width, borderSize, Colors.PadBorder); string lvlName; if (!map.Properties.TryGetValue("Name", out lvlName)) { lvlName = "noname"; } sb.Begin(); float midTopPad = topPad * 0.5f; int s = topPad / 2 + 4; r.X = 40; r.Y = (int)(midTopPad - s); r.Width = s * 2; r.Height = s * 2; sb.Draw(Assets.Keys, r, Assets.SrcEsc, Color.White); var tr = sb.DrawString(font, "Go Back", new Vector2(r.Right, midTopPad), Colors.PadText, Align.MidLeft); r.X = tr.Right; sb.Draw(Assets.PadBtns, r, Assets.SrcB, Color.White); sb.DrawString(font, lvlName, new Vector2(width * 0.5f, midTopPad), Colors.PadText, Align.Center); string moves = string.Format("Moves: {0}", map.Room.Moves); sb.DrawString(font, moves, new Vector2(width * 0.75f, midTopPad), Colors.PadText, Align.MidLeft); float midBotPad = height - botPad * 0.5f; s = botPad / 2 + 4; r.X = width / 2 - s; r.Y = (int)(midBotPad - s); r.Width = s * 2; r.Height = s * 2; sb.Draw(Assets.Keys, r, Assets.SrcR, Color.White); tr = sb.DrawString(font, "Reset", new Vector2(r.Right, midBotPad), Colors.PadText, Align.MidLeft); r.X = r.X - r.Width - 48; sb.Draw(Assets.PadBtns, r, Assets.SrcDPad, Color.White); var mr = sb.DrawString(font, "Move", new Vector2(r.X - 8, midBotPad), Colors.PadText, Align.MidRight); r.X = mr.X - r.Width - 4; sb.Draw(Assets.Keys, r, Assets.SrcUp, Color.White); r.X = r.X - r.Width + 12; sb.Draw(Assets.Keys, r, Assets.SrcRight, Color.White); r.X = r.X - r.Width + 12; sb.Draw(Assets.Keys, r, Assets.SrcDown, Color.White); r.X = r.X - r.Width + 12; sb.Draw(Assets.Keys, r, Assets.SrcLeft, Color.White); r.X = tr.Right; sb.Draw(Assets.PadBtns, r, Assets.SrcY, Color.White); r.X = r.Right + 48; sb.Draw(Assets.Keys, r, Assets.SrcZ, Color.White); var ur = sb.DrawString(font, "Undo", new Vector2(r.Right, midBotPad), Colors.PadText, Align.MidLeft); r.X = ur.Right; sb.Draw(Assets.PadBtns, r, Assets.SrcX, Color.White); sb.End(); if (!debugMode) { return; } SokobanGame.Instance.DrawDebugMessage(string.Format("Solved: {0}", map.Room.IsSolved()), new Vector2(300, 60), Color.Black); SokobanGame.Instance.DrawDebugMessage(string.Format("Entities: {0}", map.Room.CurrentState.Entities.Count), new Vector2(SokobanGame.Width - 300, 60), Color.Black); int i = 0; foreach (Entity e in map.Room.CurrentState.Entities) { string info = string.Format("{0} => {1}", e.Pos, e.GetType().Name); SokobanGame.Instance.DrawDebugMessage(info, new Vector2(SokobanGame.Width - 300, 80 + i * 20), Color.Black); i++; } InputManager.DrawDebugThumbStick(100, 100, 200); }
public void Draw(GameTime gameTime, Renderer renderer, int x, int y, bool isOverlappingDeadZone) { tiledMap.Draw(gameTime, renderer, x, y, isOverlappingDeadZone); }
public void DrawEverything(SpriteBatch spriteBatch) { spriteBatch.Begin ( transformMatrix: AttachedCamera.GetViewMatrix(), sortMode: SpriteSortMode.FrontToBack, samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend ); Rectangle copy = new Rectangle ( (int)AttachedCamera.BoundingRectangle.X, (int)AttachedCamera.BoundingRectangle.Y, (int)AttachedCamera.BoundingRectangle.Width, (int)AttachedCamera.BoundingRectangle.Height ); MainMap.Draw(spriteBatch, copy); if (heroEntity.Visible) { heroEntity.Draw(spriteBatch); } foreach (var obstacle in obstacleEntities) { // if (obstacle.Visible) // obstacle.Draw(spriteBatch); } /* * foreach (var lad in Laders) * { * if (lad.Visible) * { * lad.Draw(spriteBatch); * } * } */ foreach (var monster in MonsterEntities) { monster.Draw(spriteBatch); //Console.WriteLine($"Monster: {monster.X}, {monster.Y}. Hero: {heroEntity.X}, {heroEntity.Y}"); } foreach (var fire in FiringMonsterEntities) { if (fire.Visible) { fire.Draw(spriteBatch); } } Background.Draw(spriteBatch, heroEntity.Camera.BoundingRectangle); /* * foreach(var trilad in TriangularLaders) * { * if (trilad.Visible) * { * trilad.Draw(spriteBatch); * } * } * d * foreach (var marsh in Marshes) * { * if (marsh.Visible) * { * marsh.Draw(spriteBatch); * } * }*/ FontManager.DigitFont.Scale = 1f; Vector2 pos = new Vector2(AttachedCamera.BoundingRectangle.Right - 70 - 55, AttachedCamera.BoundingRectangle.Top + 5); FontManager.DigitFont.DrawNumber(spriteBatch, pos, HeroCoins); pos = new Vector2(pos.X + FontManager.DigitFont.MeasureNumber(HeroCoins) + 2, pos.Y - 2); spriteBatch.Draw ( texture: CurrentCoinTexture, sourceRectangle: CurrentCoinSourceRect, position: pos, layerDepth: 1f ); }