Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try 113 about us pop up #54

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "raytracing"
version = "0.1.0"
version = "1.0.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down Expand Up @@ -55,7 +55,7 @@ eframe = { version = "0.25", features = [
egui = { version = "0.25", features = ["log", "color-hex"] }
egui-wgpu = { version = "0.25" }
egui_file = "0.14.1"
egui_extras = { version = "0.25", features = ["svg"] }
egui_extras = { version = "0.25", features = ["svg", "image"] }
color-hex = "0.2.0"

# BVH
Expand Down
43 changes: 42 additions & 1 deletion src/ui/status.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::sync::atomic::Ordering;

use egui::{Align, Button, Color32, Layout, ProgressBar, RichText, Ui};
use egui::special_emojis::GITHUB;
use egui::{Align, Button, Color32, Layout, ProgressBar, RichText, Ui, Window};
use egui_file::FileDialog;
use log::{info, warn};

Expand All @@ -10,12 +11,14 @@ use super::{render::Render, Tab};

pub struct Status {
save_image_dialog: Option<FileDialog>,
show_popup: bool,
}

impl Status {
pub fn new() -> Self {
Self {
save_image_dialog: None,
show_popup: false,
}
}

Expand All @@ -40,13 +43,51 @@ impl Status {
});

ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
self.about_us_button(ui);
self.export_button(ui, render);
Self::render_button(ui, render, scene, current_tab);
Self::progress_bar(ui, render);
});
self.about_window(ui);
});
}

pub fn about_us_button(&mut self, ui: &mut Ui) {
ui.add(Button::new(" ? ").rounding(40.0))
.clicked()
.then(|| {
self.show_popup = true;
});
}

fn about_window(&mut self, ui: &mut Ui) {
Window::new("About us")
.resizable(false)
.collapsible(false)
.movable(false)
.open(&mut self.show_popup)
.min_size((100.0, 100.0))
.show(ui.ctx(), |ui| {
ui.vertical_centered(|ui| {
ui.add_space(5.0);
ui.add(
egui::Image::new(egui::include_image!("../../res/icon.png"))
.max_width(150.0)
.rounding(10.0),
);
ui.label(RichText::new("TrayRacer"));
ui.label(format!("Version: {}", env!("CARGO_PKG_VERSION")));
ui.hyperlink_to(
format!("{GITHUB} GitHub"),
"https://github.com/bircni/Raytracing",
);
ui.hyperlink_to("Built with egui", "https://docs.rs/egui/");
ui.label("© 2024 Team TrayRacer");
ui.add_space(5.0);
});
});
}

pub fn export_button(&mut self, ui: &mut Ui, render: &mut Render) {
if ui
.add_enabled(
Expand Down