コード例 #1
0
ファイル: PageNavigator.cs プロジェクト: Hengle/Engine-Nine
        public override void Draw(DrawingContext context, IList <IDrawableObject> drawables)
        {
            if (this.Viewport != (BoundingRectangle)context.GraphicsDevice.Viewport.TitleSafeArea)
            {
                this.Viewport = (BoundingRectangle)context.GraphicsDevice.Viewport.TitleSafeArea;
            }

            if (Viewport == null)
            {
                throw new ArgumentNullException("Viewport");
            }

            BoundingRectangle bounds = new BoundingRectangle
            {
                X      = Viewport.X,
                Y      = Viewport.Y,
                Width  = Viewport.Width,
                Height = Viewport.Height,
            };

            var availableSize = new Vector2(bounds.Width, bounds.Height);

            pages.ForEach <Page>(o => o.Measure(availableSize));
            pages.ForEach <Page>(o => o.Arrange(bounds));

            pages[SelectedIndex].Render(Renderer);
            base.Draw(context, drawables);
        }