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

High level library discussion #780

Closed
bvssvni opened this issue Dec 19, 2014 · 0 comments
Closed

High level library discussion #780

bvssvni opened this issue Dec 19, 2014 · 0 comments

Comments

@bvssvni
Copy link
Member

bvssvni commented Dec 19, 2014

The high level library turned out pretty well, I managed to get rid of lot of the boilerplate, such that a typical main method will look like this:

fn main() {
    let opengl = piston::shader_version::OpenGL::_3_2;
    piston::start(
        opengl,
        piston::WindowSettings {
            title: "Sea Birds' Breakfast".to_string(),
            size: [640, 480],
            samples: 4,
            fullscreen: false,
            exit_on_esc: true,
        },
        || load_assets(|| setup())
    );
}

It is called "high level" because it you can take a closure with no arguments and it will set up a hidden context. In this case it sets up a window, Gfx device and both gfx_graphics and opengl_graphics back-ends.

I used this under previous Ludum Dare, and it was very convenient. It is a lot easier to keep projects from breaking on top of such libraries because you don't depend on the interface of the underlying library. We can add some conditional compilation for different back-ends.

One drawback is we have to fix all the libraries when Rust breaks something. I removed a lot of libraries that are less frequently used or might fit better with another library. Next time there is a breakage, there will be less things to fix.

Some people are already using it, it seems. If people learn to write their own high level libraries, we could end up some libraries you can compose together with Piston. This is something I'm pretty excited about!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant