diff options
| author | 2024-12-30 19:33:48 -0600 | |
|---|---|---|
| committer | 2024-12-30 19:33:48 -0600 | |
| commit | e62d05698ba6af03906fb79acee1da488e64871a (patch) | |
| tree | 000c2c5c1a682694d4dfadb809937a4edd14915b /ozone-ui/src/main.rs | |
| parent | when the (diff) | |
some stuff has changed
Diffstat (limited to 'ozone-ui/src/main.rs')
| -rw-r--r-- | ozone-ui/src/main.rs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/ozone-ui/src/main.rs b/ozone-ui/src/main.rs new file mode 100644 index 0000000..8fbec8e --- /dev/null +++ b/ozone-ui/src/main.rs @@ -0,0 +1,71 @@ +use iced::{Background, Border, Element, Fill, FillPortion, Theme}; +use iced::border::Radius; +use iced::widget::{container, column, row, button, text, horizontal_rule, vertical_rule, Themer}; +use iced::widget::button::Status; +use iced::window::Settings; + +fn main() -> iced::Result { + let mut settings = Settings::default(); + + settings.size = [640.0, 480.0].into(); + settings.min_size = Some([320.0, 200.0].into()); + + iced::application("Title", update, view) + .window(settings) + .theme(|s: &State| { + Theme::ALL[(s.count as usize) % Theme::ALL.len()].clone() + }) + .run() +} + +#[derive(Debug, Clone, Default)] +struct State { + count: u64 +} + +#[derive(Debug, Clone, Copy)] +enum Message { + Increment, + Decrement +} + +fn update(counter: &mut State, message: Message) { + match message { + Message::Increment => counter.count = counter.count.wrapping_add(1), + Message::Decrement => counter.count = counter.count.wrapping_sub(1), + } +} + +fn view(counter: &State) -> Element<Message> { + container(column([ + container(row([ + button("amogus") + .style(button::text) + .on_press(Message::Decrement).into() + ])) + .style(container::bordered_box) + .width(Fill) + .into(), + row([ + container("this is where a sane person might choose a profile to play.") + .width(FillPortion(3)) + .height(Fill).into(), + vertical_rule(1).into(), + container("the goddamn user interface.") + .width(Fill).into() + ]).height(Fill).into(), + horizontal_rule(1).into(), + container(row([ + text("yippee!!").height(Fill).width(Fill).into(), + container(button(text("Play").height(Fill).width(Fill).center()).style(button::primary).on_press(Message::Increment)).max_width(150.0).into(), + text("you're logged in or something").height(Fill).width(Fill).into(), + ]) + .padding(10) + .spacing(10)) + .height(75).into(), + container(text(format!("Counter: {}", counter.count))).padding(5).width(Fill).style(container::bordered_box).into() + ])) + .center_x(Fill) + .center_y(Fill) + .into() +}
\ No newline at end of file |
