Add UI window icon

This commit is contained in:
Connor Slade
2024-06-22 14:47:14 -04:00
parent 60a546edee
commit 46106939ff
4 changed files with 13 additions and 5 deletions

1
Cargo.lock generated
View File

@@ -3806,6 +3806,7 @@ dependencies = [
"egui-wgpu",
"encase",
"goo_format",
"image 0.25.1",
"nalgebra",
"rfd",
"slicer",

View File

@@ -10,6 +10,7 @@ eframe = { version = "0.27.2", features = ["wgpu"] }
egui = "0.27.2"
egui-wgpu = "0.27.2"
encase = "0.8.0"
image = "0.25.1"
nalgebra = "0.32.6"
rfd = "0.14.1"
wgpu = "0.19.4"

BIN
ui/src/assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

View File

@@ -1,6 +1,6 @@
use anyhow::Result;
use eframe::NativeOptions;
use egui::Vec2;
use egui::{IconData, Vec2, ViewportBuilder};
use wgpu::TextureFormat;
const TEXTURE_FORMAT: TextureFormat = TextureFormat::Bgra8Unorm;
@@ -12,14 +12,20 @@ mod workspace;
use app::App;
use workspace::render;
const ICON: &[u8] = include_bytes!("assets/icon.png");
fn main() -> Result<()> {
let icon = image::load_from_memory(ICON)?;
eframe::run_native(
"mslicer",
NativeOptions {
window_builder: Some(Box::new(|builder| {
builder.with_inner_size(Vec2::new(1920.0, 1080.0))
})),
viewport: ViewportBuilder::default()
.with_inner_size(Vec2::new(1920.0, 1080.0))
.with_icon(IconData {
rgba: icon.to_rgba8().to_vec(),
width: icon.width(),
height: icon.height(),
}),
depth_buffer: 24,
stencil_buffer: 8,
..Default::default()