public static Entity CreateCamera(this EntityWorld world, string tag, GraphicsDevice device) { var entity = world.CreateEntity(); var camera = new Camera(device); entity.AddComponent(camera); entity.Tag = tag; return entity; }
protected override void ProcessEntities(IDictionary<int, Entity> entities) { var previousRState = _device.RasterizerState; _device.RasterizerState = _antiAliasRasterizerState; _device.SamplerStates[0] = SamplerState.AnisotropicWrap; _camera = EntityWorld.GetActiveCamera(); foreach(var entity in entities.Values) { var spaceObjectComponent = entity.GetComponent<SpaceObjectComponent>(); if (spaceObjectComponent.Object is Planet) DrawPlanet(entity, (Planet)spaceObjectComponent.Object); else if (spaceObjectComponent.Object is Star) DrawStar(entity, (Star)spaceObjectComponent.Object); } _device.RasterizerState = previousRState; }