Skip to content

Commit

Permalink
gui: smaller min width/height
Browse files Browse the repository at this point in the history
  • Loading branch information
hinto-janai committed Jun 28, 2023
1 parent 894a5f1 commit 075f1b8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
17 changes: 15 additions & 2 deletions gui/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,22 @@ pub const STATE_VERSION: u8 = 0;
pub const SETTINGS_VERSION: u8 = 0;

//---------------------------------------------------------------------------------------------------- Resolution
pub const APP_WIDTH_MIN: f32 = 1000.0;
pub const APP_HEIGHT_MIN: f32 = 800.0;
// It can't be lower than this or some of
// the static pixel size UI elements get weird.
pub const APP_WIDTH_MIN: f32 = 700.0;
pub const APP_HEIGHT_MIN: f32 = 560.0;
pub const APP_WIDTH_DEFAULT: f32 = 1000.0;
pub const APP_HEIGHT_DEFAULT: f32 = 800.0;

// Ratios should be the same.
const _: () = {
const RATIO_MIN: f32 = APP_WIDTH_MIN / APP_HEIGHT_MIN;
const RATIO_DEFAULT: f32 = APP_WIDTH_DEFAULT / APP_HEIGHT_DEFAULT;
const_assert!(RATIO_MIN == RATIO_DEFAULT);
};

pub const APP_RESOLUTION_MIN: [f32; 2] = [APP_WIDTH_MIN, APP_HEIGHT_MIN];
pub const APP_RESOLUTION_DEFAULT: [f32; 2] = [APP_WIDTH_DEFAULT, APP_HEIGHT_DEFAULT];
pub const ALBUM_ART_SIZE_MIN: f32 = 100.0;
// Downscale the internal `shukusai` art
// just a little bit for a sharper image.
Expand Down
9 changes: 6 additions & 3 deletions gui/src/func/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use crate::constants::{
VISUALS,
SPACING,
FONT_ARRAY,
APP_RESOLUTION_MIN,
APP_WIDTH_MIN,
APP_HEIGHT_MIN,
APP_WIDTH_DEFAULT,
APP_HEIGHT_DEFAULT,
SETTINGS_VERSION,
STATE_VERSION,
};
Expand Down Expand Up @@ -127,8 +130,8 @@ impl crate::data::Gui {

// The rest
eframe::NativeOptions {
min_window_size: Some(egui::vec2(APP_RESOLUTION_MIN[0], APP_RESOLUTION_MIN[1])),
initial_window_size: Some(egui::vec2(APP_RESOLUTION_MIN[0], APP_RESOLUTION_MIN[1])),
min_window_size: Some(egui::vec2(APP_WIDTH_MIN, APP_HEIGHT_MIN)),
initial_window_size: Some(egui::vec2(APP_WIDTH_DEFAULT, APP_HEIGHT_DEFAULT)),
follow_system_theme: false,
default_theme: eframe::Theme::Dark,
renderer: eframe::Renderer::Wgpu,
Expand Down

0 comments on commit 075f1b8

Please # to comment.