1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 16:42:57 +08:00

Make parallax container work with global mouse state (so it ignores bounds checks).

This commit is contained in:
Dean Herbert 2016-11-24 15:30:55 +09:00
parent bb0424f83f
commit 9938084343

View File

@ -25,18 +25,20 @@ namespace osu.Game.Graphics.Containers
} }
private Container content; private Container content;
private InputManager input;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
protected override bool OnMouseMove(InputState state) [BackgroundDependencyLoader]
private void load(UserInputManager input)
{ {
content.Position = (state.Mouse.Position - DrawSize / 2) * ParallaxAmount; this.input = input;
return base.OnMouseMove(state);
} }
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
content.Position = (input.CurrentState.Mouse.Position - DrawSize / 2) * ParallaxAmount;
content.Scale = new Vector2(1 + ParallaxAmount); content.Scale = new Vector2(1 + ParallaxAmount);
} }
} }