Skip to content

Commit

Permalink
set windows icon
Browse files Browse the repository at this point in the history
  • Loading branch information
fralonra committed Aug 3, 2023
1 parent 06992bc commit f659080
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
Binary file added build/windows/ppd-editor.ico
Binary file not shown.
Binary file added build/windows/ppd-viewer.ico
Binary file not shown.
19 changes: 16 additions & 3 deletions src/bin/editor.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
#![windows_subsystem = "windows"]

use ppd_editor::editor;

fn main() {
env_logger::init();

let native_options = eframe::NativeOptions {
let mut native_options = eframe::NativeOptions {
centered: true,
initial_window_size: Some(eframe::epaint::vec2(1200.0, 700.0)),
..Default::default()
};

#[cfg(not(target_os = "macos"))]
{
use eframe::IconData;

native_options.icon_data = match IconData::try_from_png_bytes(include_bytes!(
"../../build/windows/ppd-editor.ico"
)) {
Ok(icon) => Some(icon),
Err(err) => {
log::warn!("Failed to load window icon: {}", err);
None
}
};
}

eframe::run_native(
editor::APP_TITLE,
native_options,
Expand Down
19 changes: 16 additions & 3 deletions src/bin/viewer.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
#![windows_subsystem = "windows"]

use ppd_editor::viewer;

fn main() {
env_logger::init();

let native_options = eframe::NativeOptions {
let mut native_options = eframe::NativeOptions {
centered: true,
initial_window_size: Some(eframe::epaint::vec2(1200.0, 700.0)),
..Default::default()
};

#[cfg(not(target_os = "macos"))]
{
use eframe::IconData;

native_options.icon_data = match IconData::try_from_png_bytes(include_bytes!(
"../../build/windows/ppd-viewer.ico"
)) {
Ok(icon) => Some(icon),
Err(err) => {
log::warn!("Failed to load window icon: {}", err);
None
}
};
}

eframe::run_native(
viewer::APP_TITLE,
native_options,
Expand Down
2 changes: 1 addition & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anyhow::anyhow;
use eframe::{
egui::{
self, widget_text::WidgetTextGalley, Context, CursorIcon, FontData, FontDefinitions,
Response, Style, TextStyle, TextureOptions, Ui, WidgetText,
Response, TextStyle, TextureOptions, Ui, WidgetText,
},
epaint::{vec2, ColorImage, FontFamily, Rect, TextureHandle, Vec2},
};
Expand Down

0 comments on commit f659080

Please sign in to comment.