start button restyle
This commit is contained in:
parent
a5c5e74f7f
commit
7bfb71fff3
3 changed files with 14 additions and 11 deletions
19
src/main.rs
19
src/main.rs
|
@ -4,7 +4,7 @@ mod utils;
|
||||||
use file_format::FileFormat;
|
use file_format::FileFormat;
|
||||||
use ::image::{DynamicImage, ImageReader};
|
use ::image::{DynamicImage, ImageReader};
|
||||||
use iced::{
|
use iced::{
|
||||||
alignment::Vertical::{Bottom, Top}, border, font::{self, Family, Stretch, Weight}, gradient, mouse::{self, Interaction}, wgpu::naga::back, widget::{button, center, column, container, image, mouse_area, opaque, row, stack, text, Column, Space}, window::{self, icon, Settings}, Alignment::Center, Color, Element, Font, Length::{self, Fill}, Point, Renderer, Size, Subscription, Task, Theme
|
alignment::Vertical::{Bottom, Top}, border, font::{self, Family, Stretch, Weight}, gradient, mouse::{self, Interaction}, wgpu::naga::back, widget::{button, center, column, container, image, mouse_area, opaque, row, stack, text, Column, Space}, window::{self, icon, Settings}, Alignment::Center, Color, Element, Font, Length::{self, Fill}, Padding, Point, Renderer, Size, Subscription, Task, Theme
|
||||||
};
|
};
|
||||||
use iced_video_player::{Video, VideoPlayer};
|
use iced_video_player::{Video, VideoPlayer};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -273,6 +273,10 @@ impl Launcher {
|
||||||
let mut font = Font::with_name("Quodlibet Sans");
|
let mut font = Font::with_name("Quodlibet Sans");
|
||||||
font.weight = Weight::Normal;
|
font.weight = Weight::Normal;
|
||||||
font.stretch = Stretch::Normal;
|
font.stretch = Stretch::Normal;
|
||||||
|
|
||||||
|
let mut bolded_font = Font::with_name("Quodlibet Sans");
|
||||||
|
bolded_font.weight = Weight::Bold;
|
||||||
|
bolded_font.stretch = Stretch::Normal;
|
||||||
println!("Rerender triggered!");
|
println!("Rerender triggered!");
|
||||||
match self {
|
match self {
|
||||||
Launcher::Loading => center(text("Loading...").size(50)).into(),
|
Launcher::Loading => center(text("Loading...").size(50)).into(),
|
||||||
|
@ -289,10 +293,9 @@ impl Launcher {
|
||||||
].spacing(20)
|
].spacing(20)
|
||||||
].align_y(Center).padding(4),
|
].align_y(Center).padding(4),
|
||||||
state.get_game_icon_row(),
|
state.get_game_icon_row(),
|
||||||
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
.padding(5)
|
.padding(Padding { top: 5.0, right: 10.0, bottom: 5.0, left: 10.0 })
|
||||||
.align_y(Top)
|
.align_y(Top)
|
||||||
.align_x(Center)
|
.align_x(Center)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
|
@ -307,10 +310,10 @@ impl Launcher {
|
||||||
];
|
];
|
||||||
|
|
||||||
let bottom_bar = container(row![
|
let bottom_bar = container(row![
|
||||||
text("The quick brown fox jumped over the lazy dog.").size(25).font(font).align_y(Bottom),
|
text("The quick brown fox jumped over the lazy dog.").size(25).font(font),
|
||||||
Space::new(Length::Fill, Length::Fixed(0.0)),
|
Space::new(Length::Fill, Length::Fixed(0.0)),
|
||||||
opaque(mouse_area(button(text("Launch").size(25))
|
opaque(mouse_area(button(text("Start").size(25).font(bolded_font).align_x(Center))
|
||||||
.padding(10)
|
.padding(Padding { top: 10.0, right: 70.0, bottom: 10.0, left: 70.0 })
|
||||||
.style(move |_, _| {
|
.style(move |_, _| {
|
||||||
button::Style {
|
button::Style {
|
||||||
text_color: Color::from_rgba8(0, 0, 0, 1.0),
|
text_color: Color::from_rgba8(0, 0, 0, 1.0),
|
||||||
|
@ -318,7 +321,9 @@ impl Launcher {
|
||||||
border: border::rounded(5),
|
border: border::rounded(5),
|
||||||
..button::Style::default()
|
..button::Style::default()
|
||||||
}
|
}
|
||||||
})).interaction(Interaction::Pointer))
|
}))
|
||||||
|
.interaction(Interaction::Pointer)
|
||||||
|
)
|
||||||
])
|
])
|
||||||
.align_y(Bottom)
|
.align_y(Bottom)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use std::io::Cursor;
|
use image::{DynamicImage, GenericImageView, ImageBuffer, Rgba};
|
||||||
|
|
||||||
use image::{DynamicImage, GenericImageView, ImageBuffer, ImageReader, Rgba};
|
|
||||||
|
|
||||||
pub fn is_in_rounded_rect(x: u32, y: u32, width: u32, height: u32, radius: f32) -> bool {
|
pub fn is_in_rounded_rect(x: u32, y: u32, width: u32, height: u32, radius: f32) -> bool {
|
||||||
let x = x as f32;
|
let x = x as f32;
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::{io::{Cursor, Write}, sync::Arc};
|
||||||
use file_format::FileFormat;
|
use file_format::FileFormat;
|
||||||
use iced_video_player::Video;
|
use iced_video_player::Video;
|
||||||
use ::image::{DynamicImage, ImageReader};
|
use ::image::{DynamicImage, ImageReader};
|
||||||
use iced::{gradient, widget::{container, image}, Color};
|
use iced::{gradient, widget::container, Color};
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
|
|
||||||
use crate::{Assets, LauncherBackground, PossibleGames, State};
|
use crate::{Assets, LauncherBackground, PossibleGames, State};
|
||||||
|
|
Loading…
Reference in a new issue