//----------------------------------------------------------------------------------------------------------------------------------------------------------- protected override void Draw(GameTime gameTime) { penumbra.BeginDraw(); GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, player.camera.view); player.Draw(spriteBatch); // draw player if (drawDebugging) { DrawDebug(); } if (multiplayer) { /*foreach (var p in net.connectedClients) * { * net.DrawPlayer(spriteBatch, ); * }*/ } DrawWorld(gameTime); spriteBatch.End(); penumbra.Draw(gameTime); //spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, player.camera.view); //player.Draw(spriteBatch); // draw player //spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { penumbra.BeginDraw(); GraphicsDevice.Clear(BackgroundColor); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { _penumbra.BeginDraw(); GraphicsDevice.Clear(Color.CornflowerBlue); _spriteBatch.Begin(sortMode: SpriteSortMode.Deferred, samplerState: SamplerState.PointClamp, transformMatrix: _camera2D.Transform); _mapRenderer.Draw(_spriteBatch); DrawGameObjects(); if (DebugTools.ShowPathFindingIgnoredTiles) { foreach (var bla in _pathFindingService.NotIncludedTiles) { _temp.Draw(_spriteBatch, new Rectangle(bla.X * 32, bla.Y * 32, 32, 32)); } } _spriteBatch.End(); _penumbra.Draw(gameTime); _uiManager.Draw(); }
public override void Draw(GameTime gameTime) { PenumbraComponent Penumbra = Game.Services.GetService <PenumbraComponent>(); Penumbra.BeginDraw(); if (_tileSheet == null) { return; } SpriteBatch sp = Game.Services.GetService <SpriteBatch>(); // Draw the tiles sp.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, Camera.CurrentCameraTranslation); // Draw the Tiles foreach (Tile t in Tiles) { Vector2 position = new Vector2(t.X * t.TileWidth, t.Y * t.TileHeight); sp.Draw(_tileSheet, new Rectangle(position.ToPoint(), new Point(t.TileWidth, t.TileHeight)), new Rectangle(t.TileRef._sheetPosX * t.TileWidth, t.TileRef._sheetPosY * t.TileHeight, t.TileWidth, t.TileHeight), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0f); } sp.End(); Penumbra.Draw(gameTime); 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) { light.Position = player.getCenter(); GraphicsDevice.SetRenderTarget(rt); penumbra.Transform = cam.get_transformation(GraphicsDevice); penumbra.BeginDraw(); GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here spriteBatch.Begin(samplerState: SamplerState.PointWrap, transformMatrix: cam.get_transformation(GraphicsDevice)); world.drawBackground(spriteBatch); //world.drawOutlines(spriteBatch); // player.drawOutlines(spriteBatch); world.Draw(spriteBatch); player.Draw(spriteBatch); spriteBatch.End(); penumbra.Draw(gameTime); GraphicsDevice.SetRenderTarget(null); /* Bloom Pass Begin */ GraphicsDevice.SetRenderTarget(preBloomTarget); GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(samplerState: SamplerState.LinearClamp, transformMatrix: cam.get_transformation(GraphicsDevice)); world.drawIllumination(spriteBatch); player.drawIllumination(spriteBatch); spriteBatch.End(); GraphicsDevice.SetRenderTarget(null); bloomMipmap.generate(spriteBatch); // blurPass.blur(spriteBatch, bloomMipmap.getLevel(4), bloomMipmap.getLevel(4)); blurPass2.blur(spriteBatch, bloomMipmap.getLevel(1), bloomMipmap.getLevel(1)); blurPass1.blur(spriteBatch, bloomMipmap.getLevel(3), bloomMipmap.getLevel(3)); blurPass.blur(spriteBatch, bloomMipmap.getLevel(4), bloomMipmap.getLevel(4)); /* Bloom Pass End */ spriteBatch.Begin(samplerState: SamplerState.PointClamp); spriteBatch.Draw(rt, new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), new Color(0.8f, 0.8f, 0.8f, 1)); spriteBatch.End(); if (bloomEnabled) { spriteBatch.Begin(blendState: BlendState.Additive, samplerState: SamplerState.LinearClamp); spriteBatch.Draw(bloomMipmap.getLevel(1), new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), Color.White); spriteBatch.Draw(bloomMipmap.getLevel(3), new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), Color.White); spriteBatch.Draw(bloomMipmap.getLevel(4), new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), Color.White); spriteBatch.End(); } guiBatch.Begin(); EditorGui.Draw(guiBatch); TextDialog.draw(guiBatch); guiBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { // Matrix projection und Matrix view for PhysicsDebugView // // Calculate the projection and view adjustments for the debug view projection = Matrix.CreateOrthographicOffCenter(0f, graphics.GraphicsDevice.Viewport.Width / MeterInPixels, graphics.GraphicsDevice.Viewport.Height / MeterInPixels, 0f, 0f, 1f); view = Matrix.Identity; // Everything between penumbra.BeginDraw and penumbra.Draw will be // lit by the lighting system. penumbra.BeginDraw(); GraphicsDevice.Clear(Color.White); // Draw items affected by lighting here ... spriteBatch.Begin(SpriteSortMode.Deferred, null); // Draw the texture of the physics body spriteBatch.Draw(tBodyTexture, ConvertUnits.ToDisplayUnits(tBody.Position), null, Color.Tomato, tBody.Rotation, tBodyOrigin, 1f, SpriteEffects.None, 0); spriteBatch.End(); penumbra.Draw(gameTime); // Draw items NOT affected by lighting here ... (UI, for example) spriteBatch.Begin(SpriteSortMode.Deferred, null); // Draw Shadow spriteBatch.DrawString(Font, "[F2] Toggle the visibility of the physics shape." + "\n" + "[Left Mouse Button] Manipulate the physics object.", new Vector2(10, 400), Color.Black); // Draw Default spriteBatch.DrawString(Font, "[F2] Toggle the visibility of the physics shape." + "\n" + "[Left Mouse Button] Manipulate the physics object.", new Vector2(9, 399), Color.Yellow); spriteBatch.End(); // Draw the physics debug view PhysicsDebugView.RenderDebugData(ref projection); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { penumbra.BeginDraw(); GameReference.SpriteBatch.Begin(rasterizerState: GameReference.RasterizerState); GameReference.SpriteBatch.Draw(background, Vector2.Zero, Color.White); GameReference.SpriteBatch.End(); penumbra.Draw(gameTime); base.Draw(gameTime); GameReference.SpriteBatch.Begin(rasterizerState: GameReference.RasterizerState); menuComponent.Draw(gameTime, GameReference.SpriteBatch); GameReference.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) { // Everything between penumbra.BeginDraw and penumbra.Draw will be // lit by the lighting system. penumbra.BeginDraw(); GraphicsDevice.Clear(Color.CornflowerBlue); // Draw items affected by lighting here ... penumbra.Draw(gameTime); // Draw items NOT affected by lighting here ... (UI, for example) 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) { _penumbra.BeginDraw(); GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); foreach (var sprite in _sprites) { sprite.Draw(gameTime, spriteBatch); } spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime time) { penumbra.BeginDraw(); penumbra.Transform = camera.TranslationMatrix; GraphicsDevice.Clear(ClearColor); batch.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, transformMatrix: camera.TranslationMatrix); gsm.Draw(batch, primitives); world.Draw(batch); batch.End(); try { penumbra.Draw(time); } catch (Exception e) { } //batch.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, transformMatrix: camera.TranslationMatrix); //batch.End(); // GUI batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp); world.UiDraw(batch); gsm.DrawGui(batch, primitives); TheGame.UiDraw(batch, primitives); // Draw Fps if (TheGame.Debugging) { var font = Assets.GetFont("Font"); primitives.DrawRect(new Rectangle(10, 10, 64, 64), Color.DarkSlateGray); batch.DrawString(font, (Math.Floor(1 / time.ElapsedGameTime.TotalSeconds)).ToString(), new Vector2(20, 20), Color.White); } batch.End(); #if DEVELOPMENT_BUILD console.Draw(time); #endif //base.Draw(time); }
/// <summary> /// Draws the game from background to foreground. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { // Everything after this call will be affected by the lighting system. penumbra.BeginDraw(); graphics.GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, globalTransformation); level.Draw(gameTime, spriteBatch); spriteBatch.End(); // Draw the actual lit scene. penumbra.Draw(gameTime); // Draw stuff that is not affected by lighting (UI, etc). spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, globalTransformation); DrawHud(); spriteBatch.End(); base.Draw(gameTime); }
protected override void Draw(GameTime gameTime) { penumbra.BeginDraw(); GraphicsDevice.Clear(WindowManager.BackgroundColor); // Draw Game spriteBatch.Begin(camera, SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null); renderer.Draw(spriteBatch, penumbra); spriteBatch.End(); // Update Lighting penumbra.Draw(gameTime); // Draw UI UserInterface.Active.Draw(spriteBatch); // Draw Debug spriteBatch.Draw(WindowManager.Camera.Debug); 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) { penumbra.BeginDraw(); GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, playerCam.GetTransformation()); worlds[0].Draw(spriteBatch); Player.Draw(spriteBatch); spriteBatch.End(); penumbra.Draw(gameTime); spriteBatch.Begin(); spriteBatch.DrawString(basicFont, "GOLD: " + Player.gold, new Vector2(1, 100), Color.White); ToolBelt.Draw(spriteBatch); var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; _frameCounter.Update(deltaTime); var fps = string.Format("FPS: {0}", _frameCounter.AverageFramesPerSecond); spriteBatch.DrawString(basicFont, fps, new Vector2(1, 1), Color.White); spriteBatch.End(); //base.Draw(gameTime); }
// We use begin draw to start drawing the lights that have // ben added to the penumbra instance. All the items that // are rendered betweend this BeginDraw and EndDraw will be affected. public void BeginDraw(PenumbraComponent penumbraComponent) { penumbraComponent.BeginDraw(); }
public static void drawgame(SpriteBatch sb, GraphicsDevice gd, Matrix matrix, PenumbraComponent penumbra, GameTime gameTime) { if (Play.mainmenu) { gd.Clear(Color.CornflowerBlue); sb.Begin(); sb.Draw(Drawing.whitetexture, new Rectangle(200, 120, 400, 30), Color.Green); sb.DrawString(Drawing.font, "Start Game", new Vector2(250, 120), Color.White); sb.Draw(Drawing.whitetexture, new Rectangle(200, 160, 400, 30), Color.Red); sb.DrawString(Drawing.font, "Exit", new Vector2(350, 160), Color.White); sb.End(); } else { if (Play.escmenu) { gd.Clear(Color.CornflowerBlue); sb.Begin(); sb.Draw(Drawing.whitetexture, new Rectangle(200, 120, 400, 30), Color.Green); sb.DrawString(Drawing.font, "Continue", new Vector2(250, 120), Color.White); sb.Draw(Drawing.whitetexture, new Rectangle(200, 160, 400, 30), Color.Orange); sb.DrawString(Drawing.font, "Restart", new Vector2(250, 160), Color.White); sb.Draw(Drawing.whitetexture, new Rectangle(200, 200, 400, 30), Color.Red); sb.DrawString(Drawing.font, "Exit", new Vector2(250, 200), Color.White); sb.End(); } else { penumbra.BeginDraw(); gd.Clear(Color.White); penumbra.Transform = matrix; sb.Begin(SpriteSortMode.Immediate, null, null, null, null, null, matrix); for (int i = 0; i < 500; i++) { if (Play.ball[i] != new Vector2(0, 0)) { sb.Draw(balltexture, new Vector2(Play.ball[i].X * 32 - 16, Play.ball[i].Y * 32 - 16), Play.balllight[i].Color); } } sb.Draw(Drawing.playertexture, new Vector2(Player.x * 32 - 32, Player.y * 32 - 32), Player.color); for (int x = 0; x < Map.width; x++) { for (int y = 0; y < Map.height; y++) { if (Map.tile[x][y] == 2) { sb.Draw(whitetexture, new Vector2(x * 32 - 16, y * 32 - 16), Color.Green); } } } sb.End(); // Draw items affected by lighting here ... penumbra.Draw(gameTime); if (Play.level == 0) { sb.Begin(SpriteSortMode.Immediate, null, null, null, null, null, matrix); sb.DrawString(Drawing.font, "WASD = move", new Vector2(100, 0), Color.White); sb.DrawString(Drawing.font, "Shift,Ctrl = Zoom", new Vector2(100, 50), Color.White); sb.DrawString(Drawing.font, "Mouse drag = Throw balls", new Vector2(100, 100), Color.White); sb.End(); } if (Play.level == 1) { sb.Begin(SpriteSortMode.Immediate, null, null, null, null, null, matrix); sb.DrawString(Drawing.font, "Level 2", new Vector2(100, 0), Color.White); sb.End(); } if (Play.level == 2) { sb.Begin(SpriteSortMode.Immediate, null, null, null, null, null, matrix); sb.DrawString(Drawing.font, "Level 3", new Vector2(100, 0), Color.White); sb.End(); } if (Play.level == 3) { sb.Begin(SpriteSortMode.Immediate, null, null, null, null, null, matrix); sb.DrawString(Drawing.font, "Level 4", new Vector2(100, 0), Color.White); sb.End(); } if (Play.level == 4) { sb.Begin(SpriteSortMode.Immediate, null, null, null, null, null, matrix); sb.DrawString(Drawing.font, "Level 5", new Vector2(100, 0), Color.White); sb.End(); } sb.Begin(); sb.DrawString(Drawing.font, "FPS: " + fps, new Vector2(0, 0), Color.White); //sb.DrawString(Drawing.font, "UPS: " + ups, new Vector2(0, 30), Color.White); sb.End(); // Draw items NOT affected by lighting here ... (UI, for example) } } }
protected override void Draw(GameTime gameTime) { penumbra.BeginDraw(); GraphicsDevice.Clear(Color.CornflowerBlue); float X = 0; switch (enums.gState) { case GameState.Game: foreach (Hero h in rm.heroes) { X = h.position.X; spriteBatch.Begin(transformMatrix: camera.transform); spriteBatch.Draw(vars.gameBG, new Rectangle((int)X - 1000, (int)h.position.Y - 500, vars.gameBG.Width, vars.gameBG.Height), Color.White); h.Draw(spriteBatch); } foreach (Monster m in rm.monsters) { m.Draw(spriteBatch); } foreach (Tile t in rm.tileList) { t.Draw(spriteBatch); } foreach (Tile it in rm.invisibleTiles) { it.Draw(spriteBatch); } foreach (RestorationBlock r in rm.restoList) { r.Draw(spriteBatch); } foreach (Lever l in rm.leverList) { l.Draw(spriteBatch); } foreach (DynamicSpikeTrap dgo in rm.dGameObjects) { dgo.Draw(spriteBatch); } foreach (Chests c in rm.chestList) { c.Draw(spriteBatch); } spriteBatch.End(); break; case GameState.Combat: foreach (Hero h in rm.heroes) { X = h.savedCombatPos.X; spriteBatch.Begin(transformMatrix: camera.transform); spriteBatch.Draw(vars.gameBG, new Rectangle((int)X - 1000, (int)h.position.Y - 500, vars.gameBG.Width, vars.gameBG.Height), Color.White); h.Draw(spriteBatch); } foreach (Monster m in rm.monsters) { m.Draw(spriteBatch); } spriteBatch.End(); foreach (Hero h in rm.heroes) { h.DrawParticles(spriteBatch); } break; case GameState.Menu: spriteBatch.Begin(); spriteBatch.Draw(vars.menuBG, new Rectangle(0, 0, (int)Width, (int)Height), Color.White); spriteBatch.End(); break; } penumbra.Draw(gameTime); UserInterface.Active.Draw(spriteBatch); }