mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
Implement General options section
This commit is contained in:
parent
2aaff01675
commit
9f78f8607b
25
osu.Desktop.VisualTests/OpenTK.dll.config
Normal file
25
osu.Desktop.VisualTests/OpenTK.dll.config
Normal file
@ -0,0 +1,25 @@
|
||||
<configuration>
|
||||
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
|
||||
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
|
||||
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
|
||||
<dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
|
||||
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
|
||||
<dllmap os="linux" dll="libX11" target="libX11.so.6"/>
|
||||
<dllmap os="linux" dll="libXi" target="libXi.so.6"/>
|
||||
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
|
||||
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
|
||||
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
|
||||
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
|
||||
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
|
||||
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
|
||||
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
|
||||
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
|
||||
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
|
||||
<!-- XQuartz compatibility (X11 on Mac) -->
|
||||
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
|
||||
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
|
||||
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
|
||||
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
|
||||
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
|
||||
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
|
||||
</configuration>
|
29
osu.Desktop.VisualTests/Tests/TestCaseOptions.cs
Normal file
29
osu.Desktop.VisualTests/Tests/TestCaseOptions.cs
Normal file
@ -0,0 +1,29 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.GameModes.Testing;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
class TestCaseOptions : TestCase
|
||||
{
|
||||
public override string Name => @"Options";
|
||||
|
||||
public override string Description => @"Tests the options overlay";
|
||||
|
||||
private Options options;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
Children = new[] { options = new Options() };
|
||||
options.ToggleVisibility();
|
||||
}
|
||||
}
|
||||
}
|
@ -166,6 +166,7 @@
|
||||
<Compile Include="Tests\TestCasePlaySongSelect.cs" />
|
||||
<Compile Include="VisualTestGame.cs" />
|
||||
<Compile Include="Platform\TestStorage.cs" />
|
||||
<Compile Include="Tests\TestCaseOptions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
|
@ -1,26 +1,34 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Diagnostics;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Platform;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class Options : OverlayContainer
|
||||
{
|
||||
private const float width = 300;
|
||||
private const float width = 400;
|
||||
private FlowContainer optionsContainer;
|
||||
private BasicStorage storage;
|
||||
|
||||
protected override void Load(BaseGame game)
|
||||
{
|
||||
base.Load(game);
|
||||
|
||||
storage = game.Host.Storage;
|
||||
|
||||
Depth = float.MaxValue;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
Size = new Vector2(width, 1);
|
||||
@ -32,8 +40,101 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.9f)
|
||||
},
|
||||
// TODO: Links on the side to jump to a section
|
||||
new ScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = 5, Right = 5, Top = 50 },
|
||||
Children = new[]
|
||||
{
|
||||
optionsContainer = new FlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FlowDirection.VerticalOnly,
|
||||
Children = new[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
Text = "Options",
|
||||
TextSize = 40,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Colour = new Color4(235, 117, 139, 255),
|
||||
Text = "Change the way osu! behaves",
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Bottom = 25 },
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = "TODO: SEARCH",
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Bottom = 25 },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
addGeneral();
|
||||
}
|
||||
|
||||
private void addGeneral()
|
||||
{
|
||||
optionsContainer.Add(new OptionsSection
|
||||
{
|
||||
Header = "General",
|
||||
Children = new[]
|
||||
{
|
||||
new OptionsSubsection
|
||||
{
|
||||
Header = "Sign In",
|
||||
Children = new[]
|
||||
{
|
||||
new SpriteText { Text = "TODO" }
|
||||
}
|
||||
},
|
||||
new OptionsSubsection
|
||||
{
|
||||
Header = "Language",
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText { Text = "TODO: Dropdown" },
|
||||
new BasicCheckBox
|
||||
{
|
||||
Children = new[] { new SpriteText { Text = "Prefer metadata in original language" } }
|
||||
},
|
||||
new BasicCheckBox
|
||||
{
|
||||
Children = new[] { new SpriteText { Text = "Use alternative font for chat display" } }
|
||||
},
|
||||
}
|
||||
},
|
||||
new OptionsSubsection
|
||||
{
|
||||
Header = "Updates",
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText { Text = "TODO: Dropdown" },
|
||||
new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality
|
||||
new Button
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Colour = new Color4(14, 132, 165, 255),
|
||||
Text = "Open osu! folder",
|
||||
Action = storage.OpenOsuDirectory,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
@ -59,4 +160,86 @@ namespace osu.Game.Overlays
|
||||
MoveToX(-width, 300, EasingTypes.Out);
|
||||
}
|
||||
}
|
||||
|
||||
class OptionsSection : Container
|
||||
{
|
||||
private SpriteText header;
|
||||
private FlowContainer content;
|
||||
protected override Container Content => content;
|
||||
|
||||
public string Header
|
||||
{
|
||||
get { return header.Text; }
|
||||
set { header.Text = value.ToUpper(); }
|
||||
}
|
||||
|
||||
public OptionsSection()
|
||||
{
|
||||
const int headerSize = 40, headerMargin = 25;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AddInternal(new[]
|
||||
{
|
||||
header = new SpriteText
|
||||
{
|
||||
TextSize = headerSize,
|
||||
Colour = new Color4(88, 218, 254, 255),
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
content = new FlowContainer
|
||||
{
|
||||
Margin = new MarginPadding { Top = headerSize + headerMargin, Left = 10 },
|
||||
Direction = FlowDirection.VerticalOnly,
|
||||
Spacing = new Vector2(0, 25),
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class OptionsSubsection : Container
|
||||
{
|
||||
private SpriteText header;
|
||||
private Container content;
|
||||
protected override Container Content => content;
|
||||
|
||||
public string Header
|
||||
{
|
||||
get { return header.Text; }
|
||||
set { header.Text = value.ToUpper(); }
|
||||
}
|
||||
|
||||
public OptionsSubsection()
|
||||
{
|
||||
const int borderWidth = 3, borderMargin = 10;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
AddInternal(new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = new Color4(50, 50, 50, 255),
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = borderWidth,
|
||||
},
|
||||
content = new FlowContainer
|
||||
{
|
||||
Direction = FlowDirection.VerticalOnly,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Left = borderWidth + borderMargin },
|
||||
Children = new[]
|
||||
{
|
||||
header = new SpriteText
|
||||
{
|
||||
TextSize = 25,
|
||||
// TODO: Bold
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user