PistonDevelopers / gfx_text

Draw text for gfx using freetype
http://docs.piston.rs/gfx_text/gfx_text/
MIT License
22 stars 12 forks source link

Update to gfx 0.9.1 #40

Closed guycook closed 8 years ago

guycook commented 8 years ago

Fixes #37

This isn't quite ready to merge yet, I think it's ok except for one issue - draw isn't generic over the RenderTargetView format, i.e if in example/style.rs you try to init with an Srgb8 output format it won't build.

I'm not sure what the right approach is here, paging @kvark, @sectopod

kvark commented 8 years ago

@guycook Nice work!

I see the problem with the output format. There can be several solutions:

  1. Have the whole Renderer generic over the output format. Is it supposed to be drawing to surfaces of different formats?
  2. Have 2 separate functions for Rgba8 and Srgba8, which use different PSOs.
  3. Have a map of output_format -> PSO in either a typed form (AnyMap? Haven't used it so I don't know), or raw form:
pub fn draw<T: gfx::format::RenderFormat>(..., target: gfx::RenderTargetView<R, T>) {
    use gfx::core::factory::Typed;
    self.draw_raw(..., target.raw(), T::get_format());
}
fn draw_raw(..., target: gfx::RawRenderTargetView<R>, format: gfx::format::Format) {
    // have a map of `Format -> PSO`, pick the PSO from there and draw
}
kvark commented 8 years ago

Ping @guycook Is this PR dead? gfx-0.10 is out

guycook commented 8 years ago

Not dead (in my mind), I just haven't really had the time to attack the problem above due to baby/uni/work etc. Sorry about that.

That said, probably there is no need for this now if gfx 0.10 is out - I would say that if gfx were > 1.0 it would make sense to support minor revisions but while it's 0.* may as well just track head. Depending on how different 0.9 and 0.10 is maybe this would be a better base to work from than the existing 0.8 code

kvark commented 8 years ago

@guycook no worries! You can't just jump right to 0.10 anyway. The difference between 0.9 and 0.10 is small, but you've still got to do the 0.8 to 0.9 step, so your PR needs to be completed in some way.

kvark commented 8 years ago

Closing in favor of #41