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

[Merged by Bors] - Default image used in PipelinedSpriteBundle to be able to render without loading a texture #3270

Closed
wants to merge 3 commits into from

Conversation

mockersf
Copy link
Member

@mockersf mockersf commented Dec 7, 2021

Objective

PipelinedSpriteBundle {
    sprite: Sprite {
        color: Color::rgba(0.8, 0.0, 0.0, 0.3),
        custom_size: Some(Vec2::new(500.0, 500.0)),
        ..Default::default()
    },
    ..Default::default()
}

Solution

  • The default impl for Image was creating a one pixel image with all values at 1. I changed it to 255 as picking 1 for it doesn't really make sense, it should be either 0 or 255
  • I created a static handle and added the default image to the assets with this handle
  • I changed the default impl for PipelinedSpriteBundle to use this handle

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Dec 7, 2021
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled labels Dec 7, 2021
@mockersf mockersf added the S-Needs-Triage This issue needs to be labelled label Dec 7, 2021
@alice-i-cecile alice-i-cecile added S-Needs-Review and removed S-Needs-Triage This issue needs to be labelled labels Dec 7, 2021
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review labels Dec 7, 2021
@cart
Copy link
Member

cart commented Dec 7, 2021

Good call. Love that this is a simple solution without any changes to the pipeline!

@cart
Copy link
Member

cart commented Dec 7, 2021

bors r+

bors bot pushed a commit that referenced this pull request Dec 7, 2021
…out loading a texture (#3270)

# Objective

- Fix #3188 
- Allow creating a `PipelinedSpriteBundle` without an image, just a plain color

```rust
PipelinedSpriteBundle {
    sprite: Sprite {
        color: Color::rgba(0.8, 0.0, 0.0, 0.3),
        custom_size: Some(Vec2::new(500.0, 500.0)),
        ..Default::default()
    },
    ..Default::default()
}
```

## Solution

- The default impl for `Image` was creating a one pixel image with all values at `1`. I changed it to `255` as picking `1` for it doesn't really make sense, it should be either `0` or `255`
- I created a static handle and added the default image to the assets with this handle
- I changed the default impl for `PipelinedSpriteBundle` to use this handle
@bors bors bot changed the title Default image used in PipelinedSpriteBundle to be able to render without loading a texture [Merged by Bors] - Default image used in PipelinedSpriteBundle to be able to render without loading a texture Dec 7, 2021
@bors bors bot closed this Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PipelinedSpriteBundle is not rendered without a texture
3 participants