Merge pull request #20 from denis-golubev/master
Update dependencies and fix compilation errors
This commit is contained in:
commit
771bd5f192
7 changed files with 629 additions and 326 deletions
922
Cargo.lock
generated
922
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
13
Cargo.toml
13
Cargo.toml
|
|
@ -12,13 +12,6 @@ path = "src/main.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
rand = "0.3.7"
|
rand = "0.3.7"
|
||||||
|
piston_window = "0.52.0"
|
||||||
[dependencies.piston_window]
|
pistoncore-sdl2_window = "0.34.0"
|
||||||
git = "https://github.com/pistondevelopers/piston_window"
|
piston2d-opengl_graphics = "0.32.0"
|
||||||
|
|
||||||
[dependencies.piston2d-opengl_graphics]
|
|
||||||
git = "https://github.com/PistonDevelopers/opengl_graphics.git"
|
|
||||||
|
|
||||||
[dependencies.pistoncore-sdl2_window]
|
|
||||||
git = "https://github.com/pistondevelopers/sdl2_window"
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,13 @@ impl<'a> App<'a> {
|
||||||
fn render_ui(&self, c: &Context, gl: &mut GlGraphics) {
|
fn render_ui(&self, c: &Context, gl: &mut GlGraphics) {
|
||||||
Image::new_color(rgb2rgba(self.settings.text_dark_color))
|
Image::new_color(rgb2rgba(self.settings.text_dark_color))
|
||||||
.draw(self.logo.iter().next().unwrap(),
|
.draw(self.logo.iter().next().unwrap(),
|
||||||
default_draw_state(),
|
&DrawState::default(),
|
||||||
c.trans(self.settings.board_padding,self.settings.board_padding).transform,
|
c.trans(self.settings.board_padding,self.settings.board_padding).transform,
|
||||||
gl);
|
gl);
|
||||||
|
|
||||||
Rectangle::new(rgb2rgba(self.settings.label_color))
|
Rectangle::new(rgb2rgba(self.settings.label_color))
|
||||||
.draw(self.settings.best_rect,
|
.draw(self.settings.best_rect,
|
||||||
default_draw_state(),
|
&DrawState::default(),
|
||||||
c.transform,
|
c.transform,
|
||||||
gl);
|
gl);
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ impl<'a> App<'a> {
|
||||||
Image::new_color(rgb2rgba(settings.text_dark_color))
|
Image::new_color(rgb2rgba(settings.text_dark_color))
|
||||||
.rect([settings.board_padding, y, w, h])
|
.rect([settings.board_padding, y, w, h])
|
||||||
.draw( comment,
|
.draw( comment,
|
||||||
default_draw_state(),
|
&DrawState::default(),
|
||||||
c.transform,
|
c.transform,
|
||||||
gl);
|
gl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ impl<'a> Board<'a> {
|
||||||
self.settings.board_padding + self.settings.board_offset_y,
|
self.settings.board_padding + self.settings.board_offset_y,
|
||||||
self.settings.board_size[0],
|
self.settings.board_size[0],
|
||||||
self.settings.board_size[1]],
|
self.settings.board_size[1]],
|
||||||
default_draw_state(),
|
&DrawState::default(),
|
||||||
c.transform,
|
c.transform,
|
||||||
gl);
|
gl);
|
||||||
|
|
||||||
|
|
@ -414,7 +414,7 @@ impl<'a> Board<'a> {
|
||||||
Rectangle::new(
|
Rectangle::new(
|
||||||
rgb2rgba(self.settings.tiles_colors[0]))
|
rgb2rgba(self.settings.tiles_colors[0]))
|
||||||
.draw([x, y, self.settings.tile_size, self.settings.tile_size],
|
.draw([x, y, self.settings.tile_size, self.settings.tile_size],
|
||||||
default_draw_state(),
|
&DrawState::default(),
|
||||||
c.transform,
|
c.transform,
|
||||||
gl);
|
gl);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ fn main() {
|
||||||
let (width, height) = (settings.window_size[0],
|
let (width, height) = (settings.window_size[0],
|
||||||
settings.window_size[1]);
|
settings.window_size[1]);
|
||||||
|
|
||||||
let window: PistonWindow<(), Sdl2Window> =
|
// according to piston WindowSettings documentation, OpenGL::V3_2 is the default version
|
||||||
|
let mut window: PistonWindow<Sdl2Window> =
|
||||||
WindowSettings::new("Rust-2048", [width, height])
|
WindowSettings::new("Rust-2048", [width, height])
|
||||||
.exit_on_esc(true)
|
.exit_on_esc(true)
|
||||||
.opengl(OpenGL::V3_2)
|
|
||||||
.build()
|
.build()
|
||||||
.unwrap_or_else(|e| { panic!("Failed to build PistonWindow: {}", e) });
|
.unwrap_or_else(|e| { panic!("Failed to build PistonWindow: {}", e) });
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ fn main() {
|
||||||
|
|
||||||
let mut gl = GlGraphics::new(OpenGL::V3_2);
|
let mut gl = GlGraphics::new(OpenGL::V3_2);
|
||||||
|
|
||||||
for e in window.events() {
|
while let Some(e) = window.next() {
|
||||||
if let Some(ref args) = e.render_args() {
|
if let Some(ref args) = e.render_args() {
|
||||||
app.render(args, &mut gl);
|
app.render(args, &mut gl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ impl NumberRenderer {
|
||||||
.src_rect([(*digit * DIGITS_WIDTH as u32) as i32, 0, DIGITS_WIDTH as i32, DIGITS_HEIGHT as i32])
|
.src_rect([(*digit * DIGITS_WIDTH as u32) as i32, 0, DIGITS_WIDTH as i32, DIGITS_HEIGHT as i32])
|
||||||
.rect([x, y, width, height])
|
.rect([x, y, width, height])
|
||||||
.draw(&self.image,
|
.draw(&self.image,
|
||||||
default_draw_state(),
|
&DrawState::default(),
|
||||||
c.transform,
|
c.transform,
|
||||||
gl);
|
gl);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ impl<'a> Tile<'a> {
|
||||||
.draw(rectangle::centered([x + self.settings.tile_size / 2.0,
|
.draw(rectangle::centered([x + self.settings.tile_size / 2.0,
|
||||||
y + self.settings.tile_size / 2.,
|
y + self.settings.tile_size / 2.,
|
||||||
w/2.0, h/2.0]),
|
w/2.0, h/2.0]),
|
||||||
default_draw_state(),
|
&DrawState::default(),
|
||||||
c.transform,
|
c.transform,
|
||||||
gl);
|
gl);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue