Piston Sudoku up through 3rd chapter
This commit is contained in:
parent
6cf80e09b1
commit
96f5f85a27
1876
piston-tutorials/sudoku/Cargo.lock
generated
Normal file
1876
piston-tutorials/sudoku/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
12
piston-tutorials/sudoku/Cargo.toml
Normal file
12
piston-tutorials/sudoku/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "sudoku"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
piston = "0.53.2"
|
||||
piston2d-graphics = "0.43.0"
|
||||
piston2d-opengl_graphics = "0.82.0"
|
||||
pistoncore-glutin_window = "0.70.1"
|
31
piston-tutorials/sudoku/src/main.rs
Normal file
31
piston-tutorials/sudoku/src/main.rs
Normal file
@ -0,0 +1,31 @@
|
||||
#![deny(missing_docs)]
|
||||
|
||||
//! An Sudoko please.
|
||||
|
||||
extern crate glutin_window;
|
||||
|
||||
use glutin_window::GlutinWindow;
|
||||
use opengl_graphics::{GlGraphics, OpenGL};
|
||||
use piston::event_loop::{EventSettings, Events};
|
||||
use piston::{EventLoop, RenderEvent, WindowSettings};
|
||||
|
||||
fn main() {
|
||||
let opengl = OpenGL::V3_2;
|
||||
let settings = WindowSettings::new("Sudoku", (640, 480))
|
||||
.exit_on_esc(true)
|
||||
.graphics_api(opengl)
|
||||
.vsync(true);
|
||||
let mut window: GlutinWindow = settings.build().expect("could not create window");
|
||||
let mut events = Events::new(EventSettings::new().lazy(true));
|
||||
let mut gl = GlGraphics::new(opengl);
|
||||
|
||||
while let Some(e) = events.next(&mut window) {
|
||||
if let Some(args) = e.render_args() {
|
||||
gl.draw(args.viewport(), |c, g| {
|
||||
use graphics::clear;
|
||||
|
||||
clear([1.0; 4], g);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user