From e62d05698ba6af03906fb79acee1da488e64871a Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Mon, 30 Dec 2024 19:33:48 -0600 Subject: some stuff has changed --- ozone-ui/src/main.rs | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 ozone-ui/src/main.rs (limited to 'ozone-ui/src/main.rs') 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 { + 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 -- cgit v1.2.3-70-g09d2