PistonDevelopers / graphics

A library for 2D graphics, written in Rust, that works with multiple back-ends
MIT License
479 stars 55 forks source link

Dynamical extensions #957

Open bvssvni opened 9 years ago

bvssvni commented 9 years ago

Some effects or use cases require special data structures or shaders. It is difficult to design an abstraction that works across all the use cases. One problem is that generic libraries are limited to the set of functionality of the graphics abstraction, which means that if we want this set to be extensible we need a way to leverage new functionality through it. In a way this is a similar problem to what piston-event solves, except that you want to send data instead of receiving it.

bvssvni commented 9 years ago

Suggestion:

pub struct ExtensionId(pub &'static str);

pub trait Graphics {
    ...
    fn extension(id: ExtensionId, args: &Any);
}