public static void Render(RenderEngine renderEngine, int cameraOffset) { foreach (Particle particle in ParticleList) { renderEngine.Render(particle, cameraOffset); } }
protected override void Draw(RenderEngine renderEngine) { int cameraOffset = 0; //Splitscreen camera? if (_playerList.Count == 2 && (_playerList[0].Position - _playerList[1].Position).LengthSquared() >= 800*480 / 2) { foreach (Player player in _playerList) { Camera.ViewPortWidth = 800 / _playerList.Count; Camera.ViewPortHeight = 480; Camera.Position = player.Position - new Vector2(Camera.ViewPortWidth, Camera.ViewPortHeight) / 2; //Draw the level renderEngine.Render(_tileMap, cameraOffset); //Draw each entity visible on the screen foreach (Entity entity in _entities.Where(entity => Camera.ObjectIsVisible(entity.Bounds))) { renderEngine.Render(entity, cameraOffset); } //Draw particle effects ParticleEngine.Render(renderEngine, cameraOffset); cameraOffset += Camera.ViewPortWidth + 32; } //Draw splitscreen bar if (_playerList.Count > 1) { renderEngine.Draw(ResourceManager.GetTexture("split.png"), Camera.ViewPortWidth - 32, 0, 64, Camera.ViewPortHeight, Color.White); } } //Normal Camera else { Camera.ViewPortWidth = 800; Camera.ViewPortHeight = 480; if (_playerList.Count == 1) Camera.Position = _playerList[0].Position - new Vector2(Camera.ViewPortWidth, Camera.ViewPortHeight) / 2; else { Camera.Position = (_playerList[0].Position + _playerList[1].Position)/2 - new Vector2(Camera.ViewPortWidth, Camera.ViewPortHeight) / 2; } //Draw the level renderEngine.Render(_tileMap, cameraOffset); //Draw each entity visible on the screen foreach (Entity entity in _entities.Where(entity => Camera.ObjectIsVisible(entity.Bounds))) { renderEngine.Render(entity, cameraOffset); } //Draw particle effects ParticleEngine.Render(renderEngine, cameraOffset); } }