update for new Piston

Gl => GlGraphics
fix for new Piston:Graphics
This commit is contained in:
Andi-K 2015-05-14 04:20:54 +02:00
parent df3d3e5fcb
commit 17fddeee6c
2 changed files with 4 additions and 4 deletions

View file

@ -100,7 +100,7 @@ impl<'a> App<'a> {
let w_bg_col = self.window_background_color;
let ref nr = self.number_renderer;
gl.draw([0,0,args.width as i32, args.height as i32], |_, gl| {
gl.draw(args.viewport(), |_, gl| {
clear(w_bg_col, gl);
self.render_ui(c, gl);
self.board.render(nr.iter().next().unwrap(), c, gl);

View file

@ -2,7 +2,7 @@
use std::path::Path;
use graphics::*;
use opengl_graphics::{
Gl,
GlGraphics,
Texture,
};
@ -21,7 +21,7 @@ impl NumberRenderer {
}
pub fn render(&self, number: u32, center_x: f64, center_y: f64, max_width: f64,
color: [f32; 3], c: &Context, gl: &mut Gl) {
color: [f32; 3], c: &Context, gl: &mut GlGraphics) {
let digits = number_to_digits(number);
let total_width = DIGITS_WIDTH * digits.len() as f64;
let total_width = if total_width > max_width {
@ -36,7 +36,7 @@ impl NumberRenderer {
for digit in digits.iter() {
Image::new_colored([color[0], color[1], color[2], 1.0])
.src_rect([(*digit * DIGITS_WIDTH as u32) as i32, 0, (*digit * DIGITS_WIDTH as u32) as i32 + 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])
.draw(&self.image,
default_draw_state(),