Skip to content

Commit

Permalink
Added application icon
Browse files Browse the repository at this point in the history
  • Loading branch information
clayamore committed Mar 23, 2024
1 parent 02b8dbe commit 4537205
Show file tree
Hide file tree
Showing 12 changed files with 601 additions and 5 deletions.
565 changes: 563 additions & 2 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ egui-phosphor = { version = "0.4.0", features = ["regular", "fill"] }
egui_extras = "0.26.2"
encoding_rs = "0.8.33"
env_logger = "0.11.2"
image = "0.25.0"
md5 = "0.7.0"
miniz_oxide = "0.7.2"
once_cell = "1.19.0"
rfd = "0.13.0"
rust-embed = "8.3.0"
strsim = "0.11.0"

[build-dependencies]
winres = "0.1.12"
Binary file added assets/128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use {
std::{
env,
io,
},
winres::WindowsResource,
};

fn main() -> io::Result<()> {
if env::var_os("CARGO_CFG_WINDOWS").is_some() {
WindowsResource::new()
// This path can be absolute, or relative to your crate root.
.set_icon("./icon/icon.ico")
.compile()?;
}
Ok(())
}
Binary file added icon/icon.ico
Binary file not shown.
Binary file added icon/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 16 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
//use std::env;
mod vm;
mod save;
mod util;
Expand All @@ -16,15 +15,29 @@ use save::save::save::{Save, SaveType};
use ui::{equipment::equipment::equipment, events::events::events, general::general::general, importer::import::character_importer, inventory::inventory::inventory::inventory, menu::menu::{menu, Route}, none::none::none, regions::regions::regions, stats::stats::stats};
use vm::{importer::general_view_model::ImporterViewModel, vm::vm::ViewModel};
use crate::write::write::Write as w;
use rust_embed::RustEmbed;

#[derive(RustEmbed)]
#[folder = "icon/"]
struct Asset;

const WINDOW_WIDTH: f32 = 1920.;
const WINDOW_HEIGHT: f32 = 960.;

fn main() -> Result<(), eframe::Error> {
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
// App Icon
let mut app_icon = egui::IconData::default();

let image = Asset::get("icon.png").expect("Failed to get image data").data;
let icon = image::load_from_memory(&image).expect("Failed to open icon path").to_rgba8();
let (icon_width, icon_height) = icon.dimensions();
app_icon.rgba = icon.into_raw();
app_icon.width = icon_width;
app_icon.height = icon_height;

let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([WINDOW_WIDTH, WINDOW_HEIGHT]),
viewport: egui::ViewportBuilder::default().with_inner_size([WINDOW_WIDTH, WINDOW_HEIGHT])
.with_icon(app_icon),
..Default::default()
};

Expand Down

0 comments on commit 4537205

Please sign in to comment.