Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - maxdeviant

Pages: [1]
1
For what it's worth, I'm doing something very similar in my own engine:

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())
}
 

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.

Pages: [1]
anything