1
Graphics / Re: Regarding the VertexBuffer implementation in Renderables..
« on: March 26, 2019, 10:18:48 pm »
For what it's worth, I'm doing something very similar in my own engine:
Regardless of whether or not this is a "correct" usage of sf::Sprite, it seems like a pretty major change to deprecate this pattern in a minor version.
pub fn draw_image(ctx: &mut Context, image: &Image, params: DrawImageParams) {
let mut sprite = SfSprite::with_texture(&image.texture);
sprite.set_position(SfVector2f::from(params.position));
if let Some(clip_rect) = params.clip_rect {
sprite.set_texture_rect(&clip_rect.into());
}
if let Some(color) = params.color {
sprite.set_color(&color.into());
}
if let Some(scale) = params.scale {
sprite.set_scale(scale);
}
ctx.window.draw_sprite(&sprite, SfRenderStates::default())
}
let mut sprite = SfSprite::with_texture(&image.texture);
sprite.set_position(SfVector2f::from(params.position));
if let Some(clip_rect) = params.clip_rect {
sprite.set_texture_rect(&clip_rect.into());
}
if let Some(color) = params.color {
sprite.set_color(&color.into());
}
if let Some(scale) = params.scale {
sprite.set_scale(scale);
}
ctx.window.draw_sprite(&sprite, SfRenderStates::default())
}
Regardless of whether or not this is a "correct" usage of sf::Sprite, it seems like a pretty major change to deprecate this pattern in a minor version.