Skip to content

Conversation

silverjam
Copy link
Contributor

@silverjam silverjam commented May 9, 2022

Update splash screen and icon png (updated to be much largest so it isn't pixelated when blown up).

@john-michaelburke
Copy link
Collaborator

I believe all you will need to change now is this line to something like ...../splash.png

let logo = include_bytes!("../../resources/images/LogoBackground.jpg");

Might have been nicer for me to make it a constant 😬

@silverjam silverjam changed the title Update splash screen and icon artwork [CPP-744] Update splash screen and icon artwork [CPP-744] [CPP-752] May 9, 2022
let size = current_monitor.size();
let pos_x = ((size.width as f64 - image.width() as f64) / 2.0) as isize;
let pos_y = ((size.height as f64 - image.height() as f64) / 2.0) as isize;
let scale_factor = fetch_scale_factor(&current_monitor);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been having success using the to_logical function, I believe it should just be dividing the scale factor though.

    let size = current_monitor.size();
    let (width, height) = if cfg!(target_os = "macos") {
        let size = size.to_logical::<f64>(current_monitor.scale_factor());
        (size.width, size.height)
    } else {
        (size.width as f64, size.height as f64)
    };
    let pos_x = ((width - image.width() as f64) / 2.0) as isize;
    let pos_y = ((height - image.height() as f64) / 2.0) as isize;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll paste this in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this code in, can't test it currently though.

@silverjam silverjam changed the title Update splash screen and icon artwork [CPP-744] [CPP-752] splash: update splash screen and icon artwork [CPP-744] [CPP-752] May 10, 2022
@silverjam silverjam changed the title splash: update splash screen and icon artwork [CPP-744] [CPP-752] splash: update artwork, tweak timeout and positioning logic [CPP-744] [CPP-752] May 10, 2022
@silverjam silverjam enabled auto-merge (squash) May 10, 2022 19:21
@silverjam silverjam merged commit 0109ff9 into main May 10, 2022
@silverjam silverjam deleted the silverjam/update-art branch May 10, 2022 19:33
@silverjam
Copy link
Contributor Author

FWIW if we wanted to implement support for Wayland with the splash screen we would probably need to use a different package to display the splash image, such as just using winit directly: rust-windowing/winit#1240 -- there's a package that implements showing images with winit: https://github.com/robohouse-delft/show-image-rs -- it says it's a "debugging tool for writing image manipulation software" but probably sufficient for implementing a splash screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants