1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 08:22:56 +08:00

Bring framework and resources up-to-date.

This commit is contained in:
Dean Herbert 2016-10-01 18:40:14 +09:00
parent 7db555be5d
commit ac16bffe49
24 changed files with 90 additions and 60 deletions

@ -1 +1 @@
Subproject commit 3f68cf9d03d47d07d4c804027f45d32432e08ee6 Subproject commit 4d78fdfbe01e3ecb213c19a3f3243c80a71bb668

@ -1 +1 @@
Subproject commit fd4a3dd5223af6eb1c261af070b4220c9ff9ec2d Subproject commit cc107f9bcfc8efeeff88f19c2df8cec9755eda39

View File

@ -54,7 +54,7 @@ namespace osu.Desktop.Tests
flow = new FlowContainer flow = new FlowContainer
{ {
Direction = FlowDirection.VerticalOnly, Direction = FlowDirection.VerticalOnly,
SizeMode = InheritMode.X, RelativeSizeAxes = Axes.X,
LayoutDuration = 100, LayoutDuration = 100,
LayoutEasing = EasingTypes.Out, LayoutEasing = EasingTypes.Out,
Padding = new Vector2(1, 1) Padding = new Vector2(1, 1)

View File

@ -31,8 +31,10 @@ namespace osu.Desktop.Tests
{ {
base.Reset(); base.Reset();
///create a new clock offset to 0. //ensure we are at offset 0
localClock = new FramedOffsetClock(base.Clock) { Offset = -base.Clock.CurrentTime }; if (localClock == null)
localClock = new FramedOffsetClock(base.Clock);
localClock.Offset = -base.Clock.CurrentTime;
List<HitObject> objects = new List<HitObject>(); List<HitObject> objects = new List<HitObject>();

View File

@ -30,7 +30,7 @@ namespace osu.Desktop.Tests
Add(flow = new FlowContainer() Add(flow = new FlowContainer()
{ {
SizeMode = InheritMode.XY, RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f), Size = new Vector2(0.5f),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre

View File

@ -33,7 +33,7 @@ namespace osu.Game.GameModes
popButton.Alpha = 1; popButton.Alpha = 1;
Content.Alpha = 0; Content.Alpha = 0;
textContainer.Position = new Vector2(ActualSize.X / 16, 0); textContainer.Position = new Vector2(Size.X / 16, 0);
Content.Delay(300); Content.Delay(300);
textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo); textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo);
@ -43,14 +43,14 @@ namespace osu.Game.GameModes
protected override double OnExiting(GameMode next) protected override double OnExiting(GameMode next)
{ {
textContainer.MoveTo(new Vector2((ActualSize.X / 16), 0), transition_time, EasingTypes.OutExpo); textContainer.MoveTo(new Vector2((Size.X / 16), 0), transition_time, EasingTypes.OutExpo);
Content.FadeOut(transition_time, EasingTypes.OutExpo); Content.FadeOut(transition_time, EasingTypes.OutExpo);
return transition_time; return transition_time;
} }
protected override double OnSuspending(GameMode next) protected override double OnSuspending(GameMode next)
{ {
textContainer.MoveTo(new Vector2(-(ActualSize.X / 16), 0), transition_time, EasingTypes.OutExpo); textContainer.MoveTo(new Vector2(-(Size.X / 16), 0), transition_time, EasingTypes.OutExpo);
Content.FadeOut(transition_time, EasingTypes.OutExpo); Content.FadeOut(transition_time, EasingTypes.OutExpo);
return transition_time; return transition_time;
} }
@ -70,7 +70,7 @@ namespace osu.Game.GameModes
{ {
new Box new Box
{ {
SizeMode = InheritMode.XY, RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.7f), Size = new Vector2(0.7f),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -103,7 +103,7 @@ namespace osu.Game.GameModes
popButton = new Button popButton = new Button
{ {
Text = @"Back", Text = @"Back",
SizeMode = InheritMode.X, RelativeSizeAxes = Axes.X,
Size = new Vector2(0.1f, 40), Size = new Vector2(0.1f, 40),
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
@ -118,7 +118,7 @@ namespace osu.Game.GameModes
Direction = FlowDirection.VerticalOnly, Direction = FlowDirection.VerticalOnly,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
SizeMode = InheritMode.XY, RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.1f, 1) Size = new Vector2(0.1f, 1)
} }
}; };
@ -130,7 +130,7 @@ namespace osu.Game.GameModes
childModeButtons.Add(new Button childModeButtons.Add(new Button
{ {
Text = $@"{t.Name}", Text = $@"{t.Name}",
SizeMode = InheritMode.X, RelativeSizeAxes = Axes.X,
Size = new Vector2(1, 40), Size = new Vector2(1, 40),
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,

View File

@ -19,7 +19,7 @@ using OpenTK.Input;
namespace osu.Game.GameModes.Menu namespace osu.Game.GameModes.Menu
{ {
public class ButtonSystem : LargeContainer public class ButtonSystem : Container
{ {
public Action OnEdit; public Action OnEdit;
public Action OnExit; public Action OnExit;
@ -58,6 +58,11 @@ namespace osu.Game.GameModes.Menu
Exit, Exit,
} }
public ButtonSystem()
{
RelativeSizeAxes = Axes.Both;
}
public override void Load() public override void Load()
{ {
base.Load(); base.Load();
@ -68,14 +73,14 @@ namespace osu.Game.GameModes.Menu
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
SizeMode = InheritMode.X, RelativeSizeAxes = Axes.X,
Size = new Vector2(1, button_area_height), Size = new Vector2(1, button_area_height),
Alpha = 0, Alpha = 0,
Children = new Drawable[] Children = new Drawable[]
{ {
buttonAreaBackground = new Box buttonAreaBackground = new Box
{ {
SizeMode = InheritMode.XY, RelativeSizeAxes = Axes.Both,
Size = new Vector2(2, 1), Size = new Vector2(2, 1),
Colour = new Color4(50, 50, 50, 255), Colour = new Color4(50, 50, 50, 255),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -279,7 +284,7 @@ namespace osu.Game.GameModes.Menu
private MenuVisualisation vis; private MenuVisualisation vis;
private Action clickAction; private Action clickAction;
public float SizeForFlow => logo == null ? 0 : logo.ActualSize.X * logo.Scale.X * logoBounceContainer.Scale.X * 0.8f; public float SizeForFlow => logo == null ? 0 : logo.Size.X * logo.Scale.X * logoBounceContainer.Scale.X * 0.8f;
public override void Load() public override void Load()
{ {

View File

@ -66,10 +66,10 @@ namespace osu.Game.GameModes.Play.Catch
//render stuff! //render stuff!
Sprite s = new Sprite Sprite s = new Sprite
{ {
Texture = Game.Textures.Get(@"menu-osu"), Texture = Game.Textures.Get(@"Menu/logo"),
Origin = Anchor.Centre, Origin = Anchor.Centre,
Scale = new Vector2(0.1f), Scale = new Vector2(0.1f),
PositionMode = InheritMode.Y, RelativePositionAxes = Axes.Y,
Position = new Vector2(h.Position, -0.1f) Position = new Vector2(h.Position, -0.1f)
}; };

View File

@ -14,7 +14,7 @@ namespace osu.Game.GameModes.Play.Catch
{ {
public CatchPlayfield() public CatchPlayfield()
{ {
SizeMode = InheritMode.Y; RelativeSizeAxes = Axes.Y;
Size = new Vector2(512, 0.9f); Size = new Vector2(512, 0.9f);
Anchor = Anchor.BottomCentre; Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre; Origin = Anchor.BottomCentre;
@ -24,7 +24,7 @@ namespace osu.Game.GameModes.Play.Catch
{ {
base.Load(); base.Load();
Add(new Box { SizeMode = InheritMode.XY, Alpha = 0.5f }); Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
} }
} }
} }

View File

@ -11,15 +11,20 @@ using OpenTK;
namespace osu.Game.GameModes.Play namespace osu.Game.GameModes.Play
{ {
public abstract class HitRenderer : LargeContainer public abstract class HitRenderer : Container
{ {
public abstract List<HitObject> Objects { set; } public abstract List<HitObject> Objects { set; }
public HitRenderer()
{
RelativeSizeAxes = Axes.Both;
}
public override void Load() public override void Load()
{ {
base.Load(); base.Load();
Add(new Box() { SizeMode = InheritMode.XY, Alpha = 0.1f, Scale = new Vector2(0.99f) }); Add(new Box() { RelativeSizeAxes = Axes.Both, Alpha = 0.1f, Scale = new Vector2(0.99f) });
} }
} }
} }

View File

@ -72,10 +72,10 @@ namespace osu.Game.GameModes.Play.Mania
//render stuff! //render stuff!
Sprite s = new Sprite Sprite s = new Sprite
{ {
Texture = Game.Textures.Get(@"menu-osu"), Texture = Game.Textures.Get(@"Menu/logo"),
Origin = Anchor.Centre, Origin = Anchor.Centre,
Scale = new Vector2(0.1f), Scale = new Vector2(0.1f),
PositionMode = InheritMode.XY, RelativePositionAxes = Axes.Both,
Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f) Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f)
}; };

View File

@ -17,7 +17,7 @@ namespace osu.Game.GameModes.Play.Mania
public ManiaPlayfield(int columns) public ManiaPlayfield(int columns)
{ {
this.columns = columns; this.columns = columns;
SizeMode = InheritMode.XY; RelativeSizeAxes = Axes.Both;
Size = new Vector2(columns / 20f, 1f); Size = new Vector2(columns / 20f, 1f);
Anchor = Anchor.BottomCentre; Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre; Origin = Anchor.BottomCentre;
@ -27,14 +27,14 @@ namespace osu.Game.GameModes.Play.Mania
{ {
base.Load(); base.Load();
Add(new Box() { SizeMode = InheritMode.XY, Alpha = 0.5f }); Add(new Box() { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
for (int i = 0; i < columns; i++) for (int i = 0; i < columns; i++)
Add(new Box() Add(new Box()
{ {
SizeMode = InheritMode.Y, RelativeSizeAxes = Axes.Y,
Size = new Vector2(2, 1), Size = new Vector2(2, 1),
PositionMode = InheritMode.XY, RelativePositionAxes = Axes.Both,
Position = new Vector2((float)i / columns, 0), Position = new Vector2((float)i / columns, 0),
Alpha = 0.5f, Alpha = 0.5f,
Colour = Color4.Black Colour = Color4.Black

View File

@ -44,7 +44,7 @@ namespace osu.Game.GameModes.Play.Osu
//render stuff! //render stuff!
Sprite s = new Sprite Sprite s = new Sprite
{ {
Texture = Game.Textures.Get(@"menu-osu"), Texture = Game.Textures.Get(@"Menu/logo"),
Origin = Anchor.Centre, Origin = Anchor.Centre,
Scale = new Vector2(0.1f), Scale = new Vector2(0.1f),
Alpha = 0, Alpha = 0,

View File

@ -12,7 +12,7 @@ namespace osu.Game.GameModes.Play.Osu
{ {
public OsuPlayfield() public OsuPlayfield()
{ {
SizeMode = InheritMode.None; RelativeSizeAxes = Axes.None;
Size = new Vector2(512, 384); Size = new Vector2(512, 384);
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
@ -26,7 +26,7 @@ namespace osu.Game.GameModes.Play.Osu
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
SizeMode = InheritMode.XY, RelativeSizeAxes = Axes.Both,
Alpha = 0.5f Alpha = 0.5f
}); });
} }

View File

@ -65,10 +65,10 @@ namespace osu.Game.GameModes.Play.Taiko
//render stuff! //render stuff!
Sprite s = new Sprite Sprite s = new Sprite
{ {
Texture = Game.Textures.Get(@"menu-osu"), Texture = Game.Textures.Get(@"Menu/logo"),
Origin = Anchor.Centre, Origin = Anchor.Centre,
Scale = new Vector2(0.2f), Scale = new Vector2(0.2f),
PositionMode = InheritMode.XY, RelativePositionAxes = Axes.Both,
Position = new Vector2(1.1f, 0.5f) Position = new Vector2(1.1f, 0.5f)
}; };

View File

@ -14,7 +14,7 @@ namespace osu.Game.GameModes.Play.Taiko
{ {
public TaikoPlayfield() public TaikoPlayfield()
{ {
SizeMode = InheritMode.X; RelativeSizeAxes = Axes.X;
Size = new Vector2(1, 100); Size = new Vector2(1, 100);
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
@ -24,14 +24,14 @@ namespace osu.Game.GameModes.Play.Taiko
{ {
base.Load(); base.Load();
Add(new Box { SizeMode = InheritMode.XY, Alpha = 0.5f }); Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
Add(new Sprite Add(new Sprite
{ {
Texture = Game.Textures.Get(@"menu-osu"), Texture = Game.Textures.Get(@"Menu/logo"),
Origin = Anchor.Centre, Origin = Anchor.Centre,
Scale = new Vector2(0.2f), Scale = new Vector2(0.2f),
PositionMode = InheritMode.XY, RelativePositionAxes = Axes.Both,
Position = new Vector2(0.1f, 0.5f), Position = new Vector2(0.1f, 0.5f),
Colour = Color4.Gray Colour = Color4.Gray
}); });

View File

@ -11,10 +11,15 @@ using osu.Framework.Graphics.Containers;
namespace osu.Game.Graphics.Background namespace osu.Game.Graphics.Background
{ {
class Background : LargeContainer class Background : Container
{ {
protected Sprite BackgroundSprite; protected Sprite BackgroundSprite;
public Background()
{
RelativeSizeAxes = Axes.Both;
}
public override void Load() public override void Load()
{ {
base.Load(); base.Load();
@ -31,7 +36,7 @@ namespace osu.Game.Graphics.Background
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
BackgroundSprite.Scale = new Vector2(Math.Max(ActualSize.X / BackgroundSprite.Size.X, ActualSize.Y / BackgroundSprite.Size.Y)); BackgroundSprite.Scale = new Vector2(Math.Max(Size.X / BackgroundSprite.Size.X, Size.Y / BackgroundSprite.Size.Y));
} }
} }
} }

View File

@ -5,14 +5,20 @@ using OpenTK;
namespace osu.Game.Graphics.Containers namespace osu.Game.Graphics.Containers
{ {
class ParallaxContainer : LargeContainer class ParallaxContainer : Container
{ {
public float ParallaxAmount = 0.02f; public float ParallaxAmount = 0.02f;
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
private Container content = new LargeContainer() public ParallaxContainer()
{ {
RelativeSizeAxes = Axes.Both;
}
private Container content = new Container()
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre
}; };
@ -27,7 +33,7 @@ namespace osu.Game.Graphics.Containers
protected override bool OnMouseMove(InputState state) protected override bool OnMouseMove(InputState state)
{ {
content.Position = (state.Mouse.Position - ActualSize / 2) * ParallaxAmount; content.Position = (state.Mouse.Position - Size / 2) * ParallaxAmount;
return base.OnMouseMove(state); return base.OnMouseMove(state);
} }

View File

@ -4,17 +4,23 @@
using System; using System;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using OpenTK; using OpenTK;
using osu.Framework.Graphics;
namespace osu.Game.Graphics.Processing namespace osu.Game.Graphics.Processing
{ {
class RatioAdjust : LargeContainer class RatioAdjust : Container
{ {
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
public RatioAdjust()
{
RelativeSizeAxes = Axes.Both;
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
Vector2 parent = Parent.ActualSize; Vector2 parent = Parent.Size;
Scale = new Vector2(Math.Min(parent.Y / 768f, parent.X / 1024f)); Scale = new Vector2(Math.Min(parent.Y / 768f, parent.X / 1024f));
Size = new Vector2(1 / Scale.X); Size = new Vector2(1 / Scale.X);

View File

@ -80,7 +80,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
SizeMode = InheritMode.XY, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText new SpriteText
@ -88,7 +88,7 @@ namespace osu.Game.Graphics.UserInterface
Text = Name, Text = Name,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
PositionMode = InheritMode.XY, RelativePositionAxes = Axes.Both,
Position = new Vector2(0, -0.25f), Position = new Vector2(0, -0.25f),
Colour = KeyUpTextColor Colour = KeyUpTextColor
}, },
@ -97,7 +97,7 @@ namespace osu.Game.Graphics.UserInterface
Text = Count.ToString(@"#,0"), Text = Count.ToString(@"#,0"),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
PositionMode = InheritMode.XY, RelativePositionAxes = Axes.Both,
Position = new Vector2(0, 0.25f), Position = new Vector2(0, 0.25f),
Colour = KeyUpTextColor Colour = KeyUpTextColor
} }

View File

@ -25,11 +25,11 @@ namespace osu.Game.Online.Chat.Display
{ {
base.Load(); base.Load();
SizeMode = InheritMode.X; RelativeSizeAxes = Axes.X;
Add(new Box Add(new Box
{ {
SizeMode = InheritMode.XY, RelativeSizeAxes = Axes.Both,
Colour = Color4.Aqua, Colour = Color4.Aqua,
Alpha = 0.2f Alpha = 0.2f
}); });
@ -44,16 +44,16 @@ namespace osu.Game.Online.Chat.Display
{ {
Text = msg.User.Name, Text = msg.User.Name,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
PositionMode = InheritMode.X, RelativePositionAxes = Axes.X,
Position = new Vector2(0.14f,0), Position = new Vector2(0.14f,0),
}); });
Add(new SpriteText Add(new SpriteText
{ {
Text = msg.Content, Text = msg.Content,
PositionMode = InheritMode.X, RelativePositionAxes = Axes.X,
Position = new Vector2(0.15f, 0), Position = new Vector2(0.15f, 0),
SizeMode = InheritMode.X, RelativeSizeAxes = Axes.X,
Size = new Vector2(0.85f, 1), Size = new Vector2(0.85f, 1),
}); });
} }

View File

@ -29,6 +29,8 @@ namespace osu.Game
{ {
base.Load(); base.Load();
ShowPerformanceOverlay = true;
Add(new Drawable[] { Add(new Drawable[] {
new ParallaxContainer new ParallaxContainer
{ {
@ -47,8 +49,8 @@ namespace osu.Game
if (Parent != null) if (Parent != null)
{ {
Config.Set(OsuConfig.Width, ActualSize.X); Config.Set(OsuConfig.Width, Size.X);
Config.Set(OsuConfig.Height, ActualSize.Y); Config.Set(OsuConfig.Height, Size.Y);
} }
return true; return true;
} }

View File

@ -21,7 +21,7 @@ namespace osu.Game.Overlays
base.Load(); base.Load();
Depth = float.MaxValue; Depth = float.MaxValue;
SizeMode = InheritMode.Y; RelativeSizeAxes = Axes.Y;
Size = new Vector2(width, 1); Size = new Vector2(width, 1);
Position = new Vector2(-width, 0); Position = new Vector2(-width, 0);
@ -29,7 +29,7 @@ namespace osu.Game.Overlays
{ {
new Box new Box
{ {
SizeMode = InheritMode.XY, RelativeSizeAxes = Axes.Both,
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.9f) Colour = new Color4(0.1f, 0.1f, 0.1f, 0.9f)
} }
}; };

View File

@ -22,15 +22,14 @@ namespace osu.Game.Overlays
{ {
base.Load(); base.Load();
Depth = float.MaxValue; RelativeSizeAxes = Axes.X;
SizeMode = InheritMode.X;
Size = new Vector2(1, height); Size = new Vector2(1, height);
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
SizeMode = InheritMode.XY, RelativeSizeAxes = Axes.Both,
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.9f) Colour = new Color4(0.1f, 0.1f, 0.1f, 0.9f)
} }
}; };