A game framework written with osu! in mind.
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2// See the LICENCE file in the repository root for full licence text.
3
4using osu.Framework.Graphics.Containers;
5using osu.Framework.Graphics.Sprites;
6
7namespace osu.Framework.Graphics.UserInterface
8{
9 public class BasicMenu : Menu
10 {
11 public BasicMenu(Direction direction, bool topLevelMenu = false)
12 : base(direction, topLevelMenu)
13 {
14 BackgroundColour = FrameworkColour.Blue;
15 }
16
17 protected override Menu CreateSubMenu() => new BasicMenu(Direction.Vertical)
18 {
19 Anchor = Direction == Direction.Horizontal ? Anchor.BottomLeft : Anchor.TopRight
20 };
21
22 protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new BasicDrawableMenuItem(item);
23
24 protected override ScrollContainer<Drawable> CreateScrollContainer(Direction direction) => new BasicScrollContainer(direction);
25
26 public class BasicDrawableMenuItem : DrawableMenuItem
27 {
28 public BasicDrawableMenuItem(MenuItem item)
29 : base(item)
30 {
31 BackgroundColour = FrameworkColour.BlueGreen;
32 BackgroundColourHover = FrameworkColour.Green;
33 }
34
35 protected override Drawable CreateContent() => new SpriteText
36 {
37 Anchor = Anchor.CentreLeft,
38 Origin = Anchor.CentreLeft,
39 Padding = new MarginPadding(2),
40 Font = FrameworkFont.Condensed,
41 };
42 }
43 }
44}