Skip to content

Commit c631103

Browse files
committed
Merge pull request #35 from mitchmindtree/master
Updated to latest gfx and use crates.io dependencies
2 parents 8ef011f + 7c82350 commit c631103

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

Cargo.toml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "piston_window"
4-
version = "0.0.6"
4+
version = "0.0.7"
55
authors = ["bvssvni <[email protected]>"]
66
keywords = ["window", "piston"]
77
description = "The official Piston window back-end for the Piston game engine"
@@ -15,22 +15,14 @@ homepage = "https://github.com/pistondevelopers/piston_window"
1515
path = "src/lib.rs"
1616
name = "piston_window"
1717

18-
[dependencies.piston]
19-
#git = "https://github.com/pistondevelopers/piston"
20-
version = "0.1.3"
2118

22-
[dependencies.gfx]
23-
git = "https://github.com/gfx-rs/gfx-rs"
19+
[dependencies]
20+
gfx = "0.6.*"
21+
gfx_device_gl = "0.4.*"
22+
piston = "0.1.3"
23+
piston2d-gfx_graphics = "0.1.20"
24+
piston2d-graphics = "0.0.48"
2425

25-
[dependencies.gfx_device_gl]
26-
git = "https://github.com/gfx-rs/gfx_device_gl"
26+
[dev-dependencies]
27+
pistoncore-glutin_window = "0.0.8"
2728

28-
[dependencies.piston2d-gfx_graphics]
29-
git = "https://github.com/pistondevelopers/gfx_graphics"
30-
31-
[dependencies.piston2d-graphics]
32-
git = "https://github.com/pistondevelopers/graphics"
33-
34-
[dev-dependencies.pistoncore-glutin_window]
35-
#git = "https://github.com/pistondevelopers/glutin_window"
36-
version = "0.0.8"

src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pub struct PistonWindow<W: window::Window, T = ()> {
3636
pub event: Option<event::Event<W::Event>>,
3737
/// Application structure.
3838
pub app: Rc<RefCell<T>>,
39+
/// The factory that was created along with the device.
40+
pub factory: Rc<RefCell<gfx_device_gl::Factory>>,
3941
}
4042

4143
impl<W, T> Clone for PistonWindow<W, T>
@@ -50,6 +52,7 @@ impl<W, T> Clone for PistonWindow<W, T>
5052
events: self.events.clone(),
5153
event: self.event.clone(),
5254
app: self.app.clone(),
55+
factory: self.factory.clone(),
5356
}
5457
}
5558
}
@@ -64,8 +67,8 @@ impl<W, T> PistonWindow<W, T>
6467
use piston::event::Events;
6568
use piston::window::{ OpenGLWindow, Window };
6669

67-
let device = gfx_device_gl::Device::new(|s| window.borrow_mut().get_proc_address(s));
68-
let mut factory = device.spawn_factory();
70+
let (device, mut factory) =
71+
gfx_device_gl::create(|s| window.borrow_mut().get_proc_address(s));
6972

7073
let draw_size = window.borrow().draw_size();
7174
let output = factory.make_fake_output(draw_size.width as u16, draw_size.height as u16);
@@ -82,6 +85,7 @@ impl<W, T> PistonWindow<W, T>
8285
events: Rc::new(RefCell::new(window.events())),
8386
event: None,
8487
app: app,
88+
factory: Rc::new(RefCell::new(factory)),
8589
}
8690
}
8791

@@ -95,6 +99,7 @@ impl<W, T> PistonWindow<W, T>
9599
events: self.events,
96100
event: self.event,
97101
app: app,
102+
factory: self.factory,
98103
}
99104
}
100105

@@ -163,6 +168,7 @@ impl<W, T> Iterator for PistonWindow<W, T>
163168
events: self.events.clone(),
164169
event: Some(e),
165170
app: self.app.clone(),
171+
factory: self.factory.clone(),
166172
})
167173
} else { None }
168174
}
@@ -196,6 +202,7 @@ impl<W, T> event::GenericEvent for PistonWindow<W, T>
196202
events: old_event.events.clone(),
197203
event: Some(e),
198204
app: old_event.app.clone(),
205+
factory: old_event.factory.clone(),
199206
})
200207
}
201208
None => None

0 commit comments

Comments
 (0)