Пример #1
0
        public DefaultGameContext(Size windowBoundsInPixels) {
            Bounds = windowBoundsInPixels;

            _camera = Camera.CreateOrthographic(windowBoundsInPixels);

            Annotations = new BucketCollection<string, IEntityRecord>();

            Registry = EntityRegistry.Current;
            Registry.Entered += OnEntityEntered;
            Registry.Removed += OnEntityRemoved;

            Registry.SetTrigger(
                ForRenderables,
                (sender, args) => {
                    _renderer.Entered(args.AttachedComponents);
                    _renderer.Removed(args.DettachedComponents);
                });

            Registry.SetTrigger(
                ForTransformables,
                (sender, args) => {
                    _transformer.Entered(args.AttachedComponents);
                    _transformer.Removed(args.DettachedComponents);
                });

            Registry.SetTrigger(
                ForAnimatables,
                (sender, args) => {
                    _timeline.Entered(args.AttachedComponents);
                    _timeline.Removed(args.DettachedComponents);
                });

            _camera.Background = new Color4(255, 0, 0, 255);
        }
Пример #2
0
        public OrthographicCamera(Size boundsInPixels) {
            if (Main == null) {
                Main = this;
            }

            Bounds = boundsInPixels;
            Scale = 1.0f;
        }