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
1 changed files with 5 additions and 3 deletions

View File

@ -25,18 +25,20 @@ public ParallaxContainer()
}
private Container content;
private InputManager input;
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;
return base.OnMouseMove(state);
this.input = input;
}
protected override void Update()
{
base.Update();
content.Position = (input.CurrentState.Mouse.Position - DrawSize / 2) * ParallaxAmount;
content.Scale = new Vector2(1 + ParallaxAmount);
}
}