FilledRectTests ControlRectanglesWithMouseAndWhenTheyCollideTheyChangeColor Method Delta Engine Documentation

Namespace: DeltaEngine.Rendering2D.Shapes.Tests
Assembly: DeltaEngine.Rendering2D.Shapes.Tests (in DeltaEngine.Rendering2D.Shapes.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void ControlRectanglesWithMouseAndWhenTheyCollideTheyChangeColor()
Examples

[Test]
public void ControlRectanglesWithMouseAndWhenTheyCollideTheyChangeColor()
{
    var r1 = new FilledRect(new Rectangle(0.2f, 0.2f, 0.1f, 0.1f), Color.Red) { Rotation = 45 };
    var r2 = new FilledRect(new Rectangle(0.6f, 0.6f, 0.1f, 0.2f), Color.Red) { Rotation = 70 };
    r1.Start<CollidingChangesColor>();
    r2.Start<CollidingChangesColor>();
    new Command(point => r1.Center = point).Add(new MouseButtonTrigger(MouseButton.Left,
        State.Pressed));
    new Command(point => r2.Center = point).Add(new MouseButtonTrigger(MouseButton.Right,
        State.Pressed));
}
See Also