Skip to content

Instantly share code, notes, and snippets.

@jamwaffles
Created August 13, 2015 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamwaffles/4d51ca67438041b6f2ae to your computer and use it in GitHub Desktop.
Save jamwaffles/4d51ca67438041b6f2ae to your computer and use it in GitHub Desktop.
Rust "class" definition
struct Sprite {
image_data: SomeBinaryType,
width: i16,
height: i16
}
impl Sprite {
pub fn new(filename: str) -> Sprite {
// TOOD: Load image into a Piston/OpenGL texture
Sprite {
image_data: loaded_image.data,
width: loaded_image.width,
height: loaded_image.height
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment