/// <inheritdoc /> /// <summary> /// </summary> /// <param name="screen"></param> public TestScrollContainerScreenView(Screen screen) : base(screen) { ScrollContainer = new ScrollContainer(new ScalableVector2(400, 400), new ScalableVector2(400, 1000)) { Parent = Container, Alignment = Alignment.MidCenter, InputEnabled = true }; ScrollContainer.AddContainedDrawable(new Sprite() { Alignment = Alignment.TopCenter, Y = 0, Size = new ScalableVector2(100, 100), Tint = Color.Black }); ScrollContainer.AddContainedDrawable(new SpriteText("exo2-regular", "I love eggplants.", 12) { Alignment = Alignment.MidCenter, Tint = Color.Purple }); var testText = new SpriteText("exo2-regular", "This should be clipped off-screen!", 12) { Alignment = Alignment.BotCenter, Y = 0, Tint = Color.Black }; testText.Y = -testText.Height / 2f; ScrollContainer.AddContainedDrawable(testText); }
/// <summary> /// Creates the ScrollContainer that holds all the settings items. /// </summary> private void CreateContainer() { var size = new ScalableVector2(Dialog.ContentContainer.Width - Dialog.DividerLine.X - 20, Dialog.DividerLine.Height); Container = new ScrollContainer(size, size) { Alignment = Alignment.MidLeft, X = Dialog.DividerLine.X + 10, Alpha = 0, InputEnabled = true, DestroyIfParentIsNull = false }; Container.Scrollbar.Tint = Color.White; Container.Scrollbar.Width = 5; Container.Scrollbar.X += 8; Container.ScrollSpeed = 150; Container.EasingType = Easing.OutQuint; Container.TimeToCompleteScroll = 1500; var totalHeight = 0f; for (var i = 0; i < Items.Count; i++) { var item = Items[i]; Container.AddContainedDrawable(item); totalHeight += item.Height; if (i == 0) { continue; } const int spacing = 10; item.Y = Items[i - 1].Y + Items[i - 1].Height + spacing; totalHeight += spacing; } if (Container.ContentContainer.Height < totalHeight) { Container.ContentContainer.Height = totalHeight; } }
/// <summary> /// Creates the container that displays the song title. /// </summary> private void CreateSongTitleContainer() { SongTitleContainer = new ScrollContainer(new ScalableVector2(Width - TitleBackground.Width - 100 - Height * 0.50f - 10, Height), new ScalableVector2(Width - TitleBackground.Width - 100 - Height * 0.50f - 10, Height)) { Parent = this, X = TitleBackground.Width, Alpha = 0 }; SongTitleText = new SpriteText(Fonts.Exo2SemiBold, " ", 13) { Y = 2, Alignment = Alignment.MidLeft }; UpdateSongTitleText(); SongTitleContainer.AddContainedDrawable(SongTitleText); }
/// <summary> /// Creates the container that displays the song title. /// </summary> private void CreateSongTitleContainer() { SongTitleContainer = new ScrollContainer(new ScalableVector2(Width - TitleBackground.Width - 100 - Height * 0.50f - 10, Height), new ScalableVector2(Width - TitleBackground.Width - 100 - Height * 0.50f - 10, Height)) { Parent = this, X = TitleBackground.Width, Alpha = 0 }; SongTitleText = new SpriteTextBitmap(FontsBitmap.GothamRegular, " ") { Y = 2, Alignment = Alignment.MidLeft, FontSize = 16 }; UpdateSongTitleText(); SongTitleContainer.AddContainedDrawable(SongTitleText); }