Continuing update
This commit is contained in:
parent
d030563e49
commit
73b7af9777
61
iced-tetris/Cargo.lock
generated
61
iced-tetris/Cargo.lock
generated
@ -1028,6 +1028,12 @@ dependencies = [
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "float_next_after"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8"
|
||||
|
||||
[[package]]
|
||||
name = "font-types"
|
||||
version = "0.6.0"
|
||||
@ -1509,6 +1515,7 @@ dependencies = [
|
||||
"iced_core",
|
||||
"iced_futures",
|
||||
"log",
|
||||
"lyon_path",
|
||||
"once_cell",
|
||||
"raw-window-handle",
|
||||
"rustc-hash 2.0.0",
|
||||
@ -1572,6 +1579,7 @@ dependencies = [
|
||||
"iced_glyphon",
|
||||
"iced_graphics",
|
||||
"log",
|
||||
"lyon",
|
||||
"once_cell",
|
||||
"rustc-hash 2.0.0",
|
||||
"thiserror",
|
||||
@ -1786,6 +1794,58 @@ version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904"
|
||||
|
||||
[[package]]
|
||||
name = "lyon"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91e7f9cda98b5430809e63ca5197b06c7d191bf7e26dfc467d5a3f0290e2a74f"
|
||||
dependencies = [
|
||||
"lyon_algorithms",
|
||||
"lyon_tessellation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lyon_algorithms"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3bca95f9a4955b3e4a821fbbcd5edfbd9be2a9a50bb5758173e5358bfb4c623"
|
||||
dependencies = [
|
||||
"lyon_path",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lyon_geom"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edecfb8d234a2b0be031ab02ebcdd9f3b9ee418fb35e265f7a540a48d197bff9"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"euclid",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lyon_path"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c08a606c7a59638d6c6aa18ac91a06aa9fb5f765a7efb27e6a4da58700740d7"
|
||||
dependencies = [
|
||||
"lyon_geom",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lyon_tessellation"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "579d42360a4b09846eff2feef28f538696c7d6c7439bfa65874ff3cbe0951b2c"
|
||||
dependencies = [
|
||||
"float_next_after",
|
||||
"lyon_path",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "malloc_buf"
|
||||
version = "0.0.6"
|
||||
@ -1923,6 +1983,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -7,7 +7,7 @@ resolver = "2"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
iced = { version = "0.13.1", features = ["tokio"] }
|
||||
iced = { version = "0.13.1", features = ["tokio", "canvas"] }
|
||||
chrono = "0.4.19"
|
||||
rand = "0.8.4"
|
||||
tetris-logic = { path = "../tetris-logic" }
|
||||
|
@ -8,8 +8,8 @@ use tetris_logic::{BlockGrid, MoveDirection, Tetromino};
|
||||
*/
|
||||
|
||||
use iced::{
|
||||
widget::{button, text},
|
||||
Element, Subscription, Task,
|
||||
widget::{button, canvas, text},
|
||||
Element, Renderer, Subscription, Task, Theme,
|
||||
};
|
||||
use tetris_logic::{BlockGrid, MoveDirection, Tetromino};
|
||||
|
||||
@ -96,8 +96,8 @@ fn subscription(_state: &Tetris) -> Subscription<Message> {
|
||||
Subscription::batch([time_subscription, keyboard_subscription])
|
||||
}
|
||||
|
||||
fn view(_state: &Tetris) -> Element<Message> {
|
||||
button(text("FOO")).on_press(Message::Up).into()
|
||||
fn view(state: &Tetris) -> Element<Message> {
|
||||
canvas(state).into()
|
||||
}
|
||||
|
||||
struct Tetris {
|
||||
@ -202,8 +202,21 @@ impl Application for Tetris {
|
||||
}
|
||||
*/
|
||||
|
||||
impl canvas::Program<Message> for Tetris {
|
||||
type State = ();
|
||||
|
||||
fn draw(
|
||||
&self,
|
||||
state: &Self::State,
|
||||
renderer: &Renderer,
|
||||
theme: &Theme,
|
||||
bounds: iced::Rectangle,
|
||||
_cursor: iced::mouse::Cursor,
|
||||
) -> Vec<canvas::Geometry<Renderer>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/*
|
||||
impl<'a> canvas::Program<Message> for Tetris {
|
||||
fn draw(&self, bounds: Rectangle, _cursor: canvas::Cursor) -> Vec<canvas::Geometry> {
|
||||
let game_width = bounds.width / 3.0;
|
||||
let block_length = game_width / 10.0;
|
||||
@ -267,8 +280,8 @@ impl<'a> canvas::Program<Message> for Tetris {
|
||||
|
||||
vec![background, frame.into_geometry()]
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
fn handle_keypress(key_code: keyboard::KeyCode) -> Option<Message> {
|
||||
|
Loading…
Reference in New Issue
Block a user