Convert visible app to iced
This commit is contained in:
Generated
+3986
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -6,4 +6,5 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
assertables = "8.18.0"
|
assertables = "8.18.0"
|
||||||
ndarray = "0.16.1"
|
ndarray = "0.16.1"
|
||||||
num-traits = "0.2.19"
|
num-traits = "0.2.19"
|
||||||
|
iced = "0.13.1"
|
||||||
+32
-4
@@ -1,10 +1,38 @@
|
|||||||
|
use iced::widget::button;
|
||||||
|
use iced::widget::text;
|
||||||
use rustdoku::Board;
|
use rustdoku::Board;
|
||||||
use rustdoku::CellValue;
|
use rustdoku::CellValue;
|
||||||
use rustdoku::Point;
|
use rustdoku::Point;
|
||||||
|
|
||||||
fn main() {
|
use iced;
|
||||||
let mut board = Board::new();
|
|
||||||
|
|
||||||
board.set_value(&Point::new(1, 2), CellValue::One);
|
#[derive(Debug, Clone)]
|
||||||
println!("{}", board);
|
enum Message {
|
||||||
|
Pressed,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct State {
|
||||||
|
board: Board,
|
||||||
|
message: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for State {
|
||||||
|
fn default() -> State {
|
||||||
|
State {
|
||||||
|
board: Board::new(),
|
||||||
|
message: "What do you want?".to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update(state: &mut State, message: Message) {
|
||||||
|
state.message = "Hello, world".to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn display(state: &State) -> iced::Element<Message> {
|
||||||
|
button(text(&state.message)).on_press(Message::Pressed).into()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() -> iced::Result {
|
||||||
|
iced::run("SuDoKu", update, display)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user