public void Render(Canvas2D canvas) { float worldOffsetX = (Game.Window.Width + TileSize - World.Width * TileSize) / 2; float worldOffsetY = (Game.Window.Height + TileSize - World.Height * TileSize) / 2; using (canvas <= m_frameBuffer) { canvas.Clear(ColorU.Black); DrawGround(canvas); using (canvas <= new Translation(worldOffsetX, worldOffsetY)) { DrawPlayer(canvas, World.Player); DrawEnemies(canvas, World.Enemies); RenderWalls(canvas, World.Walls); DrawBullets(canvas, World.Bullets); DrawBonuses(canvas, World.Bonuses); m_renderer.Render(canvas); } } m_renderer.Render(canvas, m_frameBuffer); DrawWorldEvents(canvas, World); }
public virtual void Render(Canvas2D canvas) { canvas.Clear(Configuration.BackgroundColor); if (TransparentBack) { var boxWidth = (int)(0.01f * Target.Width); var qtdeX = (int)Math.Ceiling((double)RenderRegion.Width / boxWidth); var qtdeY = (int)Math.Ceiling((double)RenderRegion.Height / boxWidth); var color1 = ColorU.White; var color2 = ColorU.LightGray; for (var i = 0; i < qtdeX; i++) { for (var j = 0; j < qtdeY; j++) { var curColor = i % 2 == j % 2 ? color1 : color2; canvas.DrawFilledRect(i * boxWidth, j * boxWidth, boxWidth, boxWidth, curColor); } } } }