Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve way to instace object 2d #16

Merged
merged 5 commits into from
Oct 27, 2024
Merged

improve way to instace object 2d #16

merged 5 commits into from
Oct 27, 2024

Conversation

Juanperias
Copy link
Owner

The way in which the struct Object2d is instantiated can be cryptic, e.g.:

let mut obj = obj2d(
    vec2(75.0, 200.0),
    2.0,
    2.0,
    vec2(2.0, 231.0),
    vec2(2.0, -240.0),
    20.0,
    Shape::Circle,
);

This pull request sets obj2d as deprecated and add this way:

    let obj = Object2dBuilder::new()
        .position(vec2(2.0, 2.0))
        .density(2.0)
        .mass(3.0)
        .velocity(vec2(4.0, 4.0))
        .acceleration(vec2(3.0, 3.0))
        .radius(2,0)
        .shape(Shape::Circle)
        .build();

```

@Juanperias Juanperias merged commit cbd49ed into main Oct 27, 2024
1 check passed
@Juanperias Juanperias deleted the dev branch October 27, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant