Пример #1
0
 public void Render(Scene scene, IDrawer drawer, float delta)
 {
     drawer.BeginDraw(
         scene.WindowCanvas,
         samplerState: SamplerState.PointClamp
     );
     drawWidget(scene.UI.Root, delta, drawer);
     drawer.EndDraw();
 }
        public void Render(Scene s, IDrawer drawer, float delta)
        {
            var camera = s.Entities
                         .With <Camera>()
                         .Many()
                         .Where(e => e.Component.Active)
                         .FirstOrDefault();

            if (camera == null)
            {
                return;
            }

            var cam = camera.Component;

            var entities = s.Entities
                           .With <ISprite>()
                           .With <Position>()
                           .Many();

            drawer.BeginDraw(
                s.Canvas,
                transformMatrix: this.scale * cam.TransformationMatrix,
                samplerState: sampler
                );

            foreach (var entity in entities)
            {
                var(pos, _) = entity;

                foreach (var sprite in entity.FindAll <ISprite>())
                {
                    sprite.Draw(pos.Vector, delta, drawer);
                }
            }

            drawer.EndDraw();
        }