Render the board in the background
parent
0a62c96b0f
commit
f8adac484e
|
@ -37,14 +37,16 @@ You should have received a copy of the GNU General Public License along with On
|
|||
|
||||
use crate::perftrace;
|
||||
|
||||
use gio::resources_lookup_data;
|
||||
use glib::Object;
|
||||
use gtk::{
|
||||
gdk_pixbuf::{InterpType, Pixbuf},
|
||||
prelude::*,
|
||||
subclass::prelude::*,
|
||||
};
|
||||
|
||||
use image::io::Reader as ImageReader;
|
||||
use otg_core::{Color, Coordinate};
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
use std::{cell::RefCell, io::Cursor, rc::Rc};
|
||||
|
||||
const WIDTH: i32 = 800;
|
||||
const HEIGHT: i32 = 800;
|
||||
|
@ -105,7 +107,6 @@ impl Goban {
|
|||
|
||||
fn redraw(&self, ctx: &cairo::Context, width: i32, height: i32) {
|
||||
println!("{} x {}", width, height);
|
||||
/*
|
||||
let wood_texture = resources_lookup_data(
|
||||
"/com/luminescent-dreams/otg-gtk/wood_texture.jpg",
|
||||
gio::ResourceLookupFlags::NONE,
|
||||
|
@ -136,10 +137,6 @@ impl Goban {
|
|||
}
|
||||
Ok(None) | Err(_) => ctx.set_source_rgb(0.7, 0.7, 0.7),
|
||||
}
|
||||
*/
|
||||
|
||||
ctx.set_source_rgb(0.7, 0.7, 0.7);
|
||||
let _ = ctx.paint();
|
||||
|
||||
let board = self.imp().board_state.borrow();
|
||||
|
||||
|
@ -188,8 +185,8 @@ impl Goban {
|
|||
|
||||
(0..board.size.height).for_each(|row| {
|
||||
(0..board.size.width).for_each(|column| {
|
||||
match board.stone(&Coordinate{ row, column }) {
|
||||
None => {},
|
||||
match board.stone(&Coordinate { row, column }) {
|
||||
None => {}
|
||||
Some(Color::White) => pen.stone(ctx, row, column, Color::White, None),
|
||||
Some(Color::Black) => pen.stone(ctx, row, column, Color::Black, None),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue