Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (28 sloc) 863 Bytes
extern crate piston_window;
extern crate find_folder;
use piston_window::*;
fn main() {
let opengl = OpenGL::V3_2;
let mut window: PistonWindow =
WindowSettings::new("piston: image", [300, 300])
.exit_on_esc(true)
.graphics_api(opengl)
.build()
.unwrap();
let assets = find_folder::Search::ParentsThenKids(3, 3)
.for_folder("assets").unwrap();
let rust_logo = assets.join("rust.png");
let rust_logo: G2dTexture = Texture::from_path(
&mut window.create_texture_context(),
&rust_logo,
Flip::None,
&TextureSettings::new()
).unwrap();
window.set_lazy(true);
while let Some(e) = window.next() {
window.draw_2d(&e, |c, g, _| {
clear([1.0; 4], g);
image(&rust_logo, c.transform, g);
});
}
}
You can’t perform that action at this time.