gui with text
parent
c70d48d630
commit
54a7befcb9
|
|
@ -1,5 +1,6 @@
|
||||||
use iced::widget::{button, column, text};
|
use iced::widget::{button, column, text};
|
||||||
use iced::{Alignment, Element, Sandbox, Settings};
|
use iced::{Alignment, Element, Sandbox, Settings};
|
||||||
|
use iced_native::Event;
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main() -> iced::Result {
|
||||||
Main::run(Settings::default())
|
Main::run(Settings::default())
|
||||||
|
|
@ -11,6 +12,7 @@ struct Main {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
enum ControllerButton {
|
enum ControllerButton {
|
||||||
|
EventOccurred(iced_native::Event),
|
||||||
Up,
|
Up,
|
||||||
Down,
|
Down,
|
||||||
Left,
|
Left,
|
||||||
|
|
@ -39,7 +41,14 @@ impl Sandbox for Main {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, controllerButton: ControllerButton) {
|
fn update(&mut self, controllerButton: ControllerButton) {
|
||||||
|
match message {
|
||||||
|
ControllerButton::EventOccurred(Event) => {
|
||||||
|
Err(String::from("ohno")).unwrap();
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
self.ntfy = format!("push a key to bind to {:?}", controllerButton);
|
self.ntfy = format!("push a key to bind to {:?}", controllerButton);
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Element<ControllerButton> {
|
fn view(&self) -> Element<ControllerButton> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue