Esempio n. 1
0
 public ToolbarBackground(BufferedContainer screen)
 {
     RelativeSizeAxes = Axes.Both;
     Children         = new Drawable[]
     {
         new BufferedContainer
         {
             RelativeSizeAxes = Axes.Both,
             BackgroundColour = Color4.Black,
             BlurSigma        = new Vector2(15),
             Child            = screen.CreateView().With(d =>
             {
                 d.RelativeSizeAxes     = Axes.Both;
                 d.SynchronisedDrawQuad = true;
             })
         },
         solidBackground = new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = Color4.Black.Opacity(0.2f),
             Alpha            = alpha_normal,
         },
         gradientBackground = new Box
         {
             RelativeSizeAxes = Axes.X,
             Anchor           = Anchor.BottomLeft,
             Alpha            = 0,
             Height           = 90,
             Colour           = ColourInfo.GradientVertical(
                 Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)),
         },
     };
 }
        public TestSceneBufferedContainer()
        {
            Remove(TestContainer);

            BufferedContainer buffer;

            Add(buffer = new BufferedContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new[] { TestContainer }
            });

            AddSliderStep("blur", 0f, 20f, 0f, blur =>
            {
                buffer.BlurTo(new Vector2(blur));
            });

            AddSliderStep("fbo scale (x)", 0.01f, 4f, 1f, scale =>
            {
                buffer.FrameBufferScale = new Vector2(scale, buffer.FrameBufferScale.Y);
            });

            AddSliderStep("fbo scale (y)", 0.01f, 4f, 1f, scale =>
            {
                buffer.FrameBufferScale = new Vector2(buffer.FrameBufferScale.X, scale);
            });
        }
Esempio n. 3
0
        public TestSceneForms()
        {
            HoloTrackForm form;

            BufferedContainer container = new BufferedContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = new Box
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Size     = new Vector2(100),
                    Rotation = 45,
                }
            };

            AddRange(new Drawable[]
            {
                container,
                form = new TestForm(container)
                {
                    Size   = new Vector2(400, 300),
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                }
            });

            AddToggleStep("toggle titlebar", v => form.TitleBarVisibility = v);
        }
            public BlurView(BufferedContainer buffer, float blur, bool displayEffects, bool synchronisedQuad)
            {
                Size            = new Vector2(200);
                Masking         = true;
                CornerRadius    = 20;
                BorderColour    = Color4.Magenta;
                BorderThickness = 2;

                InternalChildren = new Drawable[]
                {
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        Content          = new[]
                        {
                            new Drawable[]
                            {
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = Color4.Magenta
                                        },
                                        new SpriteText
                                        {
                                            Anchor = Anchor.Centre,
                                            Origin = Anchor.Centre,
                                            Text   = "You can drag this view.",
                                            Font   = new FontUsage(size: 16),
                                        }
                                    }
                                }
                            },
                            new Drawable[]
                            {
                                new BufferedContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    BackgroundColour = Color4.Black,
                                    BlurSigma        = new Vector2(blur),
                                    Child            = buffer.CreateView().With(d =>
                                    {
                                        d.RelativeSizeAxes       = Axes.Both;
                                        d.SynchronisedDrawQuad   = synchronisedQuad;
                                        d.DisplayOriginalEffects = displayEffects;
                                    })
                                }
                            },
                        },
                        RowDimensions = new[]
                        {
                            new Dimension(GridSizeMode.Absolute, 20),
                        }
                    }
                };
            }
        private void createTest(float originalBlur, float viewBlur, bool originalEffects, bool synchronisedQuad = true)
        {
            AddStep("create container", () =>
            {
                Clear();

                BufferedContainer container = new BufferedContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    BlurSigma        = new Vector2(originalBlur),
                    Children         = new Drawable[]
                    {
                        new BackgroundScreenStack(new BackgroundScreenDefault()),
                        new Box
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Colour = Color4.Aqua,
                            Size   = new Vector2(100)
                        }
                    }
                };

                Children = new Drawable[]
                {
                    container,
                    new BlurView(container, viewBlur, originalEffects, synchronisedQuad)
                    {
                        Position = new Vector2(100, 100)
                    }
                };
            });
        }
Esempio n. 6
0
        public Toolbar(BufferedContainer Screen)
        {
            RelativeSizeAxes = Axes.X;
            Size             = new Vector2(1, HEIGHT);

            screen = Screen;
        }
Esempio n. 7
0
        internal BufferedContainerView(BufferedContainer <T> container, BufferedDrawNodeSharedData sharedData)
        {
            this.container  = container;
            this.sharedData = sharedData;

            container.OnDispose += removeContainer;
        }
Esempio n. 8
0
        private void load([CanBeNull] DrawableHitObject drawableObject)
        {
            InternalChildren = new[]
            {
                Background = new Box {
                    RelativeSizeAxes = Axes.Both
                },
                Foreground = new BufferedContainer
                {
                    Blending              = BlendingParameters.Additive,
                    RelativeSizeAxes      = Axes.Both,
                    CacheDrawnFrameBuffer = true,
                    Children              = new Drawable[]
                    {
                        new Box {
                            RelativeSizeAxes = Axes.Both
                        },
                        subtractionContainer = new BufferedContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            // This is needed because we're blending with another object
                            BackgroundColour      = Color4.White.Opacity(0),
                            CacheDrawnFrameBuffer = true,
                            // The 'hole' is achieved by subtracting the result of this container with the parent
                            Blending = new BlendingParameters {
                                AlphaEquation = BlendingEquation.ReverseSubtract
                            },
                            Child = subtractionLayer = new CircularContainer
                            {
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                                // Height computed in Update
                                Width   = 1,
                                Masking = true,
                                Child   = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Alpha            = 0,
                                    AlwaysPresent    = true
                                }
                            }
                        }
                    }
                }
            };

            if (drawableObject != null)
            {
                var holdNote = (DrawableHoldNote)drawableObject;

                AccentColour.BindTo(drawableObject.AccentColour);
                isHitting.BindTo(holdNote.IsHitting);
            }

            AccentColour.BindValueChanged(onAccentChanged, true);
            isHitting.BindValueChanged(_ => onAccentChanged(new ValueChangedEvent <Color4>(AccentColour.Value, AccentColour.Value)), true);
        }
Esempio n. 9
0
        public MusicController(BufferedContainer Screen)
        {
            Width  = 400;
            Margin = new MarginPadding(10);

            AlwaysPresent = true;

            screen = Screen;
        }
Esempio n. 10
0
 public TestForm(BufferedContainer buffer)
 {
     Title            = "Draggable Test Form";
     Background.Child = buffer.CreateView().With(d =>
     {
         d.RelativeSizeAxes       = Axes.Both;
         d.DisplayOriginalEffects = true;
         d.SynchronisedDrawQuad   = true;
     });
 }
Esempio n. 11
0
        public TestCaseBufferedContainer()
        {
            Remove(TestContainer);

            Add(buffer = new BufferedContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new[] { TestContainer }
            });
        }
Esempio n. 12
0
            public Background(BeatmapMeta beatmap = null)
            {
                this.beatmap     = beatmap;
                Depth            = float.MaxValue;
                RelativeSizeAxes = Axes.Both;

                BufferedContainer container = new BufferedContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Children         = new Drawable[]
                    {
                        sprite = new Sprite
                        {
                            RelativeSizeAxes = Axes.Both,
                            FillMode         = FillMode.Fill,
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Size             = new Vector2(1f, 0.8f),
                            Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0f))
                        }
                    }
                };

                Children = new Drawable[]
                {
                    container,
                    new BufferedContainer
                    {
                        RelativeSizeAxes = Axes.X,
                        Height           = bottom_black_area_height,
                        Origin           = Anchor.BottomCentre,
                        Anchor           = Anchor.BottomCentre,
                        BlurSigma        = new Vector2(10),
                        Child            = container.CreateView().With(d =>
                        {
                            d.RelativeSizeAxes     = Axes.Both;
                            d.SynchronisedDrawQuad = true;
                        })
                    },
                    new Box
                    {
                        RelativeSizeAxes = Axes.X,
                        Height           = bottom_black_area_height,
                        Origin           = Anchor.BottomCentre,
                        Anchor           = Anchor.BottomCentre,
                        Colour           = Color4.Black.Opacity(0.2f)
                    }
                };
            }
Esempio n. 13
0
        public BodyPiece()
        {
            Blending = BlendingParameters.Additive;

            Children = new[]
            {
                Background = new Box {
                    RelativeSizeAxes = Axes.Both
                },
                Foreground = new BufferedContainer
                {
                    Blending              = BlendingParameters.Additive,
                    RelativeSizeAxes      = Axes.Both,
                    CacheDrawnFrameBuffer = true,
                    Children              = new Drawable[]
                    {
                        new Box {
                            RelativeSizeAxes = Axes.Both
                        },
                        subtractionContainer = new BufferedContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            // This is needed because we're blending with another object
                            BackgroundColour      = Color4.White.Opacity(0),
                            CacheDrawnFrameBuffer = true,
                            // The 'hole' is achieved by subtracting the result of this container with the parent
                            Blending = new BlendingParameters {
                                AlphaEquation = BlendingEquation.ReverseSubtract
                            },
                            Child = subtractionLayer = new CircularContainer
                            {
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                                // Height computed in Update
                                Width   = 1,
                                Masking = true,
                                Child   = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Alpha            = 0,
                                    AlwaysPresent    = true
                                }
                            }
                        }
                    }
                }
            };

            AddLayout(subtractionCache);
        }
Esempio n. 14
0
 public PlayfieldCoveringWrapper(Drawable content)
 {
     InternalChild = new BufferedContainer
     {
         RelativeSizeAxes = Axes.Both,
         Children         = new[]
         {
             content,
             cover = new Container
             {
                 Anchor           = Anchor.Centre,
                 Origin           = Anchor.Centre,
                 RelativeSizeAxes = Axes.Both,
                 Blending         = new BlendingParameters
                 {
                     // Don't change the destination colour.
                     RGBEquation = BlendingEquation.Add,
                     Source      = BlendingType.Zero,
                     Destination = BlendingType.One,
                     // Subtract the cover's alpha from the destination (points with alpha 1 should make the destination completely transparent).
                     AlphaEquation    = BlendingEquation.Add,
                     SourceAlpha      = BlendingType.Zero,
                     DestinationAlpha = BlendingType.OneMinusSrcAlpha
                 },
                 Children = new Drawable[]
                 {
                     gradient = new Box
                     {
                         Anchor               = Anchor.BottomLeft,
                         Origin               = Anchor.BottomLeft,
                         RelativeSizeAxes     = Axes.Both,
                         RelativePositionAxes = Axes.Both,
                         Height               = 0.25f,
                         Colour               = ColourInfo.GradientVertical(
                             Color4.White.Opacity(0f),
                             Color4.White.Opacity(1f)
                             )
                     },
                     filled = new Box
                     {
                         Anchor           = Anchor.BottomLeft,
                         Origin           = Anchor.BottomLeft,
                         RelativeSizeAxes = Axes.Both,
                         Height           = 0
                     }
                 }
             }
         }
     };
 }
Esempio n. 15
0
        /// <summary>
        /// Smoothly adjusts <see cref="IBufferedContainer.BlurSigma"/> over time.
        /// </summary>
        /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
        public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None)
        {
            if (bufferedContainer == null && newBlurSigma != Vector2.Zero)
            {
                RemoveInternal(Sprite);

                AddInternal(bufferedContainer = new BufferedContainer
                {
                    CacheDrawnFrameBuffer = true,
                    RelativeSizeAxes      = Axes.Both,
                    Child = Sprite
                });
            }

            bufferedContainer?.BlurTo(newBlurSigma, duration, easing);
        }
Esempio n. 16
0
        private void load()
        {
            dependencies.CacheAs(this);

            Add(new DrawSizePreservingFillContainer
            {
                Child = new HoloTrackKeyBindingContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Child            = globalBufferedContainer = new BufferedContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        Child            = new ScreenStack(new Main()),
                    },
                },
            });
        }
Esempio n. 17
0
        /// <summary>
        /// Smoothly adjusts <see cref="IBufferedContainer.BlurSigma"/> over time.
        /// </summary>
        /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
        public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None)
        {
            if (bufferedContainer == null && newBlurSigma != Vector2.Zero)
            {
                RemoveInternal(Sprite);

                AddInternal(bufferedContainer = new BufferedContainer(cachedFrameBuffer: true)
                {
                    RelativeSizeAxes = Axes.Both,
                    RedrawOnScale    = false,
                    Child            = Sprite
                });
            }

            if (bufferedContainer != null)
            {
                transformBlurSigma(newBlurSigma, duration, easing);
            }
        }
Esempio n. 18
0
        public TestCaseBufferedContainer()
        {
            Remove(TestContainer);

            BufferedContainer buffer;

            Add(buffer = new BufferedContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new[] { TestContainer }
            });

            double timer = 0.0;

            buffer.OnUpdate += delegate
            {
                timer           += 0.001;
                buffer.BlurSigma = new Vector2((float)Math.Abs(Math.Sin(timer) * 10 + 10), (float)Math.Abs(Math.Sin(timer) * 10 + 10));
            };
        }
Esempio n. 19
0
        /// <summary>
        /// Smoothly adjusts <see cref="IBufferedContainer.BlurSigma"/> over time.
        /// </summary>
        /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
        public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None)
        {
            if (bufferedContainer == null && newBlurSigma != Vector2.Zero)
            {
                RemoveInternal(Sprite);

                AddInternal(bufferedContainer = new BufferedContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    CacheDrawnFrameBuffer = true,
                    RedrawOnScale = false,
                    Child = Sprite
                });
            }

            if (bufferedContainer != null)
                bufferedContainer.FrameBufferScale = newBlurSigma == Vector2.Zero ? Vector2.One : new Vector2(blur_scale);

            bufferedContainer?.BlurTo(newBlurSigma * blur_scale, duration, easing);
        }
Esempio n. 20
0
            private void load()
            {
                InternalChild = foregroundBuffer = new BufferedContainer(cachedFrameBuffer: true)
                {
                    Blending         = BlendingParameters.Additive,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new Box {
                            RelativeSizeAxes = Axes.Both
                        },
                        subtractionBuffer = new BufferedContainer(cachedFrameBuffer: true)
                        {
                            RelativeSizeAxes = Axes.Both,
                            // This is needed because we're blending with another object
                            BackgroundColour = Colour4.White.Opacity(0),
                            // The 'hole' is achieved by subtracting the result of this container with the parent
                            Blending = new BlendingParameters {
                                AlphaEquation = BlendingEquation.ReverseSubtract
                            },
                            Child = subtractionLayer = new CircularContainer
                            {
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                                // Height computed in Update
                                Width   = 1,
                                Masking = true,
                                Child   = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Alpha            = 0,
                                    AlwaysPresent    = true
                                }
                            }
                        }
                    }
                };

                AccentColour.BindValueChanged(onAccentChanged, true);
                IsHitting.BindValueChanged(_ => onAccentChanged(new ValueChangedEvent <Colour4>(AccentColour.Value, AccentColour.Value)), true);
            }
Esempio n. 21
0
        public PlayfieldMaskingContainer(Drawable content, MaskingMode mode)
        {
            RelativeSizeAxes = Axes.Both;

            InternalChild = new BufferedContainer
            {
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(1.5f),
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Children         = new[]
                {
                    new Container
                    {
                        Size   = TauPlayfield.BASE_SIZE,
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Child  = content
                    },
                    new Container
                    {
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Size             = new Vector2(2f),
                        RelativeSizeAxes = Axes.Both,
                        Blending         = new BlendingParameters
                        {
                            // Don't change the destination colour.
                            RGBEquation = BlendingEquation.Add,
                            Source      = BlendingType.Zero,
                            Destination = BlendingType.One,
                            // Subtract the cover's alpha from the destination (points with alpha 1 should make the destination completely transparent).
                            AlphaEquation    = BlendingEquation.Add,
                            SourceAlpha      = BlendingType.Zero,
                            DestinationAlpha = mode == MaskingMode.FadeOut ? BlendingType.OneMinusSrcAlpha : BlendingType.SrcAlpha
                        },
                        Child = cover = new PlayfieldMaskDrawable()
                    }
                }
            };
        }
Esempio n. 22
0
            protected override void LoadComplete()
            {
                base.LoadComplete();

                bufferedContainer = new BufferedContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Child            = background = new Sprite
                    {
                        RelativeSizeAxes = Axes.Both,
                        FillMode         = FillMode.Fill,
                        Texture          = WorkingBeatmap.Value?.Background
                    }
                };

                Children = new Drawable[]
                {
                    bufferedContainer,
                    new BufferedContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        BlurSigma        = new osuTK.Vector2(10),
                        Children         = new Drawable[]
                        {
                            bufferedContainer.CreateView().With(d =>
                            {
                                d.RelativeSizeAxes     = Axes.Both;
                                d.SynchronisedDrawQuad = true;
                            }),
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = Colour4.Black,
                                Alpha            = 0.6f
                            }
                        }
                    }
                };

                WorkingBeatmap.ValueChanged += beatmapUpdated;
            }
Esempio n. 23
0
        private void load()
        {
            RelativeSizeAxes = Axes.Both;

            InternalChild = new BufferedContainer
            {
                CacheDrawnFrameBuffer = true,
                RelativeSizeAxes      = Axes.Both,
                Children = new Drawable[]
                {
                    // We will create the white-to-black gradient by modulating transparency and having
                    // a black backdrop. This results in an sRGB-space gradient and not linear space,
                    // transitioning from white to black more perceptually uniformly.
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4.Black,
                    },
                    // We use a container, such that we can set the colour gradient to go across the
                    // vertices of the masked container instead of the vertices of the (larger) sprite.
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
                        Children         = new[]
                        {
                            // Zoomed-in and cropped beatmap background
                            new BeatmapBackgroundSprite(beatmap)
                            {
                                RelativeSizeAxes = Axes.Both,
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.Centre,
                                FillMode         = FillMode.Fill,
                            },
                        },
                    },
                }
            };
        }
Esempio n. 24
0
 public MainMenu(BufferedContainer Screen)
 {
     AddRangeInternal(new Drawable[]
     {
         new DrawSizePreservingFillContainer
         {
             Strategy         = DrawSizePreservationStrategy.Minimum,
             RelativeSizeAxes = Axes.Both,
             Children         = new Drawable[]
             {
                 new Container
                 {
                     AutoSizeAxes = Axes.Both,
                     Margin       = new MarginPadding(50),
                     Anchor       = Anchor.TopRight,
                     Origin       = Anchor.TopRight,
                     Children     = new Drawable[]
                     {
                         logo = new RhythmicLogo
                         {
                             Scale  = new Vector2(0.5f),
                             Alpha  = 0,
                             Action = () => this.Push(new VisualizerScreen())
                         },
                     }
                 },
                 new ButtonSystem(Screen)
                 {
                     Anchor   = Anchor.BottomLeft,
                     Origin   = Anchor.BottomLeft,
                     Margin   = new MarginPadding(50),
                     OnPlay   = onSolo,
                     OnEditor = () => this.Push(new Editor())
                 }
             }
         }
     });
 }
        public void TestInsideBufferedContainer()
        {
            TestDrawableModel drawableModel = null;

            AddStep("setup", () =>
            {
                Child = new BufferedContainer
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Size   = new Vector2(200),
                    Child  = backedDrawable = new TestModelBackedDrawable
                    {
                        RelativeSizeAxes = Axes.Both,
                        HasIntermediate  = false,
                        ShowNullModel    = false,
                        Model            = new TestModel(drawableModel = new TestDrawableModel(1).With(d => d.AllowLoad.Set()))
                    }
                };
            });

            assertDrawableVisibility(1, () => drawableModel);
        }
Esempio n. 26
0
        /// <summary>
        /// Blur a Triangle in a cool way!
        /// </summary>
        /// <param name="backBuffer">Background for the Blur as example <see cref="BackgroundImageContainer"/></param>
        /// <param name="blur"></param>
        public BlurredTriangle(BufferedContainer backBuffer, float blur)
        {
            Size    = new Vector2(200);
            Masking = true;

            CornerRadius    = 20;
            BorderColour    = Color4.Magenta;
            BorderThickness = 2;

            InternalChildren = new Drawable[]
            {
                new Triangle
                {
                    //RelativeSizeAxes = Axes.Both,
                    Size   = new Vector2(50),
                    Anchor = Anchor.Centre,
                    Colour = Color4.Red
                },

                new BufferedContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    BlurSigma        = new Vector2(blur),
                    Children         = new Drawable[]
                    {
                        backBuffer
                        .CreateView()
                        .With(d =>
                        {
                            d.RelativeSizeAxes       = Axes.Both;
                            d.SynchronisedDrawQuad   = true;
                            d.DisplayOriginalEffects = true;
                        }),
                    },
                }
            };
        }
        private void createTest(float originalBlur, float viewBlur, bool originalEffects, bool synchronisedQuad = true)
        {
            AddStep("create container", () =>
            {
                BufferedContainer container = new BufferedContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Scale            = new Vector2(0.75f),
                    BlurSigma        = new Vector2(originalBlur),
                    Child            = new TestSceneCachedBufferedContainer()
                };

                Children = new Drawable[]
                {
                    container,
                    new BlurView(container, viewBlur, originalEffects, synchronisedQuad)
                    {
                        Position = new Vector2(100, 100)
                    }
                };
            });
        }
Esempio n. 28
0
        private void load()
        {
            InternalChild = new Container
            {
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                RelativeSizeAxes = Axes.Both,
                FillMode         = FillMode.Fit,
                Children         = new Drawable[]
                {
                    new CircularContainer
                    {
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        RelativeSizeAxes = Axes.Both,
                        Size             = new Vector2(inner_portion),
                        Masking          = true,
                        BorderThickness  = line_thickness,
                        BorderColour     = Color4.White,
                        Child            = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = Color4Extensions.FromHex("#202624")
                        }
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Children         = new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding(1),
                                Child            = new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Masking          = true,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                            EdgeSmoothness   = new Vector2(1),
                                            RelativeSizeAxes = Axes.Y,
                                            Height           = 2, // We're rotating along a diagonal - we don't really care how big this is.
                                            Width            = line_thickness / 2,
                                            Rotation         = -rotation,
                                            Alpha            = 0.3f,
                                        },
                                        new Box
                                        {
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                            EdgeSmoothness   = new Vector2(1),
                                            RelativeSizeAxes = Axes.Y,
                                            Height           = 2,                  // We're rotating along a diagonal - we don't really care how big this is.
                                            Width            = line_thickness / 2, // adjust for edgesmoothness
                                            Rotation         = rotation
                                        },
                                    }
                                },
                            },
                            new Box
                            {
                                Anchor         = Anchor.TopRight,
                                Origin         = Anchor.TopRight,
                                Width          = 10,
                                EdgeSmoothness = new Vector2(1),
                                Height         = line_thickness / 2, // adjust for edgesmoothness
                            },
                            new Box
                            {
                                Anchor         = Anchor.TopRight,
                                Origin         = Anchor.TopRight,
                                EdgeSmoothness = new Vector2(1),
                                Width          = line_thickness / 2, // adjust for edgesmoothness
                                Height         = 10,
                            }
                        }
                    },
                    bufferedGrid = new BufferedContainer
                    {
                        RelativeSizeAxes      = Axes.Both,
                        CacheDrawnFrameBuffer = true,
                        BackgroundColour      = Color4Extensions.FromHex("#202624").Opacity(0),
                        Child = pointGrid = new GridContainer
                        {
                            RelativeSizeAxes = Axes.Both
                        }
                    },
                }
            };

            Vector2 centre      = new Vector2(points_per_dimension) / 2;
            float   innerRadius = centre.X * inner_portion;

            Drawable[][] points = new Drawable[points_per_dimension][];

            for (int r = 0; r < points_per_dimension; r++)
            {
                points[r] = new Drawable[points_per_dimension];

                for (int c = 0; c < points_per_dimension; c++)
                {
                    HitPointType pointType = Vector2.Distance(new Vector2(c, r), centre) <= innerRadius
                        ? HitPointType.Hit
                        : HitPointType.Miss;

                    var point = new HitPoint(pointType, this)
                    {
                        BaseColour = pointType == HitPointType.Hit ? new Color4(102, 255, 204, 255) : new Color4(255, 102, 102, 255)
                    };

                    points[r][c] = point;
                }
            }

            pointGrid.Content = points;

            if (score.HitEvents == null || score.HitEvents.Count == 0)
            {
                return;
            }

            // Todo: This should probably not be done like this.
            float radius = OsuHitObject.OBJECT_RADIUS * (1.0f - 0.7f * (playableBeatmap.Difficulty.CircleSize - 5) / 5) / 2;

            foreach (var e in score.HitEvents.Where(e => e.HitObject is HitCircle && !(e.HitObject is SliderTailCircle)))
            {
                if (e.LastHitObject == null || e.Position == null)
                {
                    continue;
                }

                AddPoint(((OsuHitObject)e.LastHitObject).StackedEndPosition, ((OsuHitObject)e.HitObject).StackedEndPosition, e.Position.Value, radius);
            }
        }
Esempio n. 29
0
        private void load(OsuColour colours)
        {
            Add(new Container
            {
                Size         = new Vector2(120, 20),
                CornerRadius = 10,
                Masking      = true,
                Margin       = new MarginPadding {
                    Left = circleSize + 10
                },
                Origin   = Anchor.CentreLeft,
                Anchor   = Anchor.CentreLeft,
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colours.Gray1,
                        Alpha            = 0.9f,
                    },
                    new OsuSpriteText
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Font   = "Exo2.0-Bold",
                        Text   = name
                    }
                }
            });

            CircularProgress bgProgress;

            Add(new CircularContainer
            {
                Masking  = true,
                Size     = new Vector2(circleSize),
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colours.Gray1,
                        Alpha            = 0.9f,
                    },
                    bgProgress = new CircularProgress
                    {
                        RelativeSizeAxes = Axes.Both,
                        InnerRadius      = 0.05f,
                        Rotation         = 180,
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        Colour           = colours.Gray2,
                        Size             = new Vector2(0.8f)
                    },
                    (volumeCircle = new CircularProgress
                    {
                        RelativeSizeAxes = Axes.Both,
                        InnerRadius = 0.05f,
                        Rotation = 180,
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Size = new Vector2(0.8f)
                    }).WithEffect(new GlowEffect
                    {
                        Colour   = meterColour,
                        Strength = 2
                    }),
                    maxGlow = (text = new OsuSpriteText
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Font = "Venera",
                        TextSize = 0.16f * circleSize
                    }).WithEffect(new GlowEffect
                    {
                        Colour    = Color4.Transparent,
                        PadExtent = true,
                    })
                }
            });

            Bindable.ValueChanged   += newVolume => { this.TransformTo("DisplayVolume", newVolume, 400, Easing.OutQuint); };
            bgProgress.Current.Value = 0.75f;
        }
Esempio n. 30
0
 public BeatmapUsecase(BeatmapMeta beatmap, BufferedContainer background)
 {
     this.beatmap    = beatmap;
     this.background = background;
 }