This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<'a, W: Window> | |
Iterator<Event> | |
for EventIterator<'a, W> { | |
/// Returns the next game event. | |
fn next(&mut self) -> Option<Event> { | |
loop { | |
self.state = match self.state { | |
RenderState => { | |
if self.window.should_close() { return None; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let opengl = piston::shader_version::opengl::OpenGL_3_2; | |
let mut window = WindowSDL2::new( | |
opengl, | |
{ title: "Image".to_string(), size: [300, 300], .. } | |
); | |
let asset_store = AssetStore::from_folder("../bin/assets"); | |
let image = asset_store.path("rust-logo.png").unwrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 CGLSetOption(pname = kCGLGOUseErrorHandler, param = 0) = kCGLNoError | |
1 CGLChoosePixelFormat(attribs = {kCGLPFAOpenGLProfile, kCGLOGLPVersion_3_2_Core, kCGLPFAColorSize, 32, kCGLPFADepthSize, 16, kCGLPFADoubleBuffer, kCGLPFADisplayMask, 4, 0}, pix = &0x7f86ead063c0, npix = &2) = kCGLNoError | |
2 CGLSetOption(pname = kCGLGOUseErrorHandler, param = 0) = kCGLNoError | |
3 CGLCreateContext(pix = 0x7f86ead063c0, share = NULL, ctx = &0x7f86eb811400) = kCGLNoError | |
4 CGLSetParameter(ctx = 0x7f86eb811400, pname = 1236, params = &-355444128) = kCGLNoError | |
5 CGLReleasePixelFormat(pix = 0x7f86ead063c0) | |
6 CGLSetSurface(ctx = 0x7f86eb811400, cid = 0x125cf, wid = 39922, sid = 744855519) = kCGLNoError | |
8 CGLUpdateContext(ctx = 0x7f86eb811400) = kCGLNoError | |
9 CGLSetCurrentContext(ctx = 0x7f86eb811400) = kCGLNoError | |
10 glViewport(x = 0, y = 0, width = 300, height = 300) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/main.rs:103:29: 103:68 error: unable to infer enough type information to locate the impl of the trait `graphics::image_size::ImageSize` for the type `<generic #737>`; type annotations required | |
src/main.rs:103 c.color(settings::WATER_COLOR).draw(gl); | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Moving average: | |
avg * n / (n + 1) + x / (n + 1) | |
= (avg * n + x) / (n + 1) | |
substitue 1 with k: | |
(avg * n + x) / (n + k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/gfx2d.rs:112:5: 112:20 error: mismatched types: expected `[f32, .. 2]` but found `&[f32]` (expected vector but found &-ptr) | |
src/gfx2d.rs:112 pos: [f32, ..2], | |
^~~~~~~~~~~~~~~ | |
note: in expansion of #[deriving] | |
src/gfx2d.rs:110:1: 110:19 note: expansion site | |
src/gfx2d.rs:113:5: 113:22 error: mismatched types: expected `[f32, .. 4]` but found `&[f32]` (expected vector but found &-ptr) | |
src/gfx2d.rs:113 color: [f32, ..4], | |
^~~~~~~~~~~~~~~~~ | |
note: in expansion of #[deriving] | |
src/gfx2d.rs:110:1: 110:19 note: expansion site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct Gfx2d { | |
state: gfx::DrawState, | |
program: gfx::shade::EmptyProgram, | |
program_uv: gfx::Program, | |
vertex_data: Vec<Vertex>, | |
vertex_data_uv: Vec<VertexUV>, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![crate_name = "triangle"] | |
#![feature(phase)] | |
extern crate piston; | |
extern crate gfx; | |
#[phase(plugin)] | |
extern crate gfx_macros; | |
extern crate device; | |
extern crate sdl2; | |
extern crate sdl2_game_window; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error: error while parsing the registry | |
src/gl/lib.rs:88 generate_gl_bindings!("gl", "core", "4.5", "static", [ "GL_EXT_texture_filter_anisotropic" ]) | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
src/gl/lib.rs:88:1: 88:94 error: Did not find version 4.5 in the registry | |
src/gl/lib.rs:88 generate_gl_bindings!("gl", "core", "4.5", "static", [ "GL_EXT_texture_filter_anisotropic" ]) | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub enum UserInput { | |
Press(&'static str), | |
Release(&'static str), | |
Repeat(&'static str), | |
Position(&'static str, f64, f64), | |
Scroll(&'static str, f64, f64), | |
Character(&'static str, char), | |
} |